finish tool can use 'nimgrab' tool to download the mingw version
This commit is contained in:
parent
51ece61f03
commit
7d1a96151c
4 changed files with 27 additions and 2 deletions
|
|
@ -91,10 +91,11 @@ Files: "bin/nimgrep.exe"
|
||||||
Files: "bin/nimsuggest.exe"
|
Files: "bin/nimsuggest.exe"
|
||||||
Files: "bin/nimble.exe"
|
Files: "bin/nimble.exe"
|
||||||
Files: "bin/vccexe.exe"
|
Files: "bin/vccexe.exe"
|
||||||
|
Files: "bin/nimgrab.exe"
|
||||||
|
|
||||||
Files: "koch.exe"
|
Files: "koch.exe"
|
||||||
Files: "finish.exe"
|
Files: "finish.exe"
|
||||||
Files: "bin/downloader.exe"
|
; Files: "bin/downloader.exe"
|
||||||
|
|
||||||
; Files: "dist/mingw"
|
; Files: "dist/mingw"
|
||||||
Files: r"tools\start.bat"
|
Files: r"tools\start.bat"
|
||||||
|
|
|
||||||
3
koch.nim
3
koch.nim
|
|
@ -223,7 +223,9 @@ proc bundleWinTools() =
|
||||||
copyExe("tools/finish".exe, "finish".exe)
|
copyExe("tools/finish".exe, "finish".exe)
|
||||||
removeFile("tools/finish".exe)
|
removeFile("tools/finish".exe)
|
||||||
nimexec("c -o:bin/vccexe.exe tools/vccenv/vccexe")
|
nimexec("c -o:bin/vccexe.exe tools/vccenv/vccexe")
|
||||||
|
nimexec("c -o:bin/nimgrab.exe -d:ssl tools/nimgrab.nim")
|
||||||
when false:
|
when false:
|
||||||
|
# not yet a tool worth including
|
||||||
nimexec(r"c --cc:vcc --app:gui -o:bin\downloader.exe -d:ssl --noNimblePath " &
|
nimexec(r"c --cc:vcc --app:gui -o:bin\downloader.exe -d:ssl --noNimblePath " &
|
||||||
r"--path:..\ui tools\downloader.nim")
|
r"--path:..\ui tools\downloader.nim")
|
||||||
|
|
||||||
|
|
@ -541,6 +543,7 @@ of cmdArgument:
|
||||||
of "test", "tests": tests(op.cmdLineRest)
|
of "test", "tests": tests(op.cmdLineRest)
|
||||||
of "temp": temp(op.cmdLineRest)
|
of "temp": temp(op.cmdLineRest)
|
||||||
of "winrelease": winRelease()
|
of "winrelease": winRelease()
|
||||||
|
of "wintools": bundleWinTools()
|
||||||
of "nimble": buildNimble(existsDir(".git"))
|
of "nimble": buildNimble(existsDir(".git"))
|
||||||
of "nimsuggest": bundleNimsuggest(buildExe=true)
|
of "nimsuggest": bundleNimsuggest(buildExe=true)
|
||||||
of "tools": buildTools(existsDir(".git"))
|
of "tools": buildTools(existsDir(".git"))
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,12 @@ proc unzip(): bool =
|
||||||
|
|
||||||
proc downloadMingw(): DownloadResult =
|
proc downloadMingw(): DownloadResult =
|
||||||
let curl = findExe"curl"
|
let curl = findExe"curl"
|
||||||
|
var cmd: string
|
||||||
if curl.len > 0:
|
if curl.len > 0:
|
||||||
let cmd = curl & " --out " & "dist" / mingw & " " & url
|
cmd = curl & " --out " & "dist" / mingw & " " & url
|
||||||
|
elif fileExists"bin/nimgrab.exe":
|
||||||
|
cmd = "bin/nimgrab.exe " & url & " dist" / mingw
|
||||||
|
if cmd.len > 0:
|
||||||
if execShellCmd(cmd) != 0:
|
if execShellCmd(cmd) != 0:
|
||||||
echo "download failed! ", cmd
|
echo "download failed! ", cmd
|
||||||
openDefaultBrowser(url)
|
openDefaultBrowser(url)
|
||||||
|
|
|
||||||
17
tools/nimgrab.nim
Normal file
17
tools/nimgrab.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
import os, asyncdispatch, httpclient
|
||||||
|
|
||||||
|
proc syncDownload(url, file: string) =
|
||||||
|
var client = newHttpClient()
|
||||||
|
proc onProgressChanged(total, progress, speed: BiggestInt) =
|
||||||
|
echo "Downloading " & url & " " & $(speed div 1000) & "kb/s"
|
||||||
|
echo clamp(int(progress*100 div total), 0, 100), "%"
|
||||||
|
|
||||||
|
client.onProgressChanged = onProgressChanged
|
||||||
|
client.downloadFile(url, file)
|
||||||
|
echo "100%"
|
||||||
|
|
||||||
|
if os.paramCount() != 2:
|
||||||
|
quit "Usage: nimgrab <url> <file>"
|
||||||
|
else:
|
||||||
|
syncDownload(os.paramStr(1), os.paramStr(2))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue