mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-25 00:35:26 +00:00
downloader changes
This commit is contained in:
@@ -94,7 +94,7 @@ Files: "bin/vccexe.exe"
|
||||
|
||||
Files: "koch.exe"
|
||||
Files: "finish.exe"
|
||||
Files: "downloader.exe"
|
||||
Files: "bin/downloader.exe"
|
||||
|
||||
; Files: "dist/mingw"
|
||||
Files: r"tools\start.bat"
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
# Helper that is run after Nim's installation.
|
||||
## Helper that is run after Nim's installation.
|
||||
|
||||
## We download mirror'ed mingw packages. The originals came from:
|
||||
##
|
||||
## https://sourceforge.net/projects/mingw-w64/files/Toolchains%20
|
||||
## targetting%20Win32/Personal%20Builds/mingw-builds/6.3.0/threads-win32/
|
||||
## dwarf/i686-6.3.0-release-win32-dwarf-rt_v5-rev1.7z/download
|
||||
## https://sourceforge.net/projects/mingw-w64/files/Toolchains%20
|
||||
## targetting%20Win64/Personal%20Builds/mingw-builds/6.3.0/threads-win32/
|
||||
## seh/x86_64-6.3.0-release-win32-seh-rt_v5-rev1.7z/download
|
||||
##
|
||||
|
||||
|
||||
import
|
||||
ui, asyncdispatch, httpclient, os, finish, registry, strutils
|
||||
@@ -22,30 +33,22 @@ proc download(pkg: string; c: Controls) {.async.} =
|
||||
|
||||
client.onProgressChanged = onProgressChanged
|
||||
# XXX give a destination filename instead
|
||||
let contents = await client.getContent("https://nim-lang.org/download/" & pkg & ".zip")
|
||||
let z = "dist" / pkg & ".zip"
|
||||
let contents = await client.getContent("https://nim-lang.org/download/" & pkg & ".7z")
|
||||
let z = r"..\dist" / pkg & ".7z"
|
||||
# XXX make this async somehow:
|
||||
writeFile(z, contents)
|
||||
c.bar.value = 100
|
||||
let olddir = getCurrentDir()
|
||||
try:
|
||||
setCurrentDir(olddir / "dist")
|
||||
if os.execShellCmd("bin\\7zG.exe x " & pkg & ".zip") != 0:
|
||||
if os.execShellCmd("7zG.exe x " & pkg & ".7z") != 0:
|
||||
c.lab.text = "Unpacking failed: " & z
|
||||
finally:
|
||||
setCurrentdir(olddir)
|
||||
|
||||
when false:
|
||||
var a: ZipArchive
|
||||
if open(a, z, fmRead):
|
||||
extractAll(a, "dist")
|
||||
close(a)
|
||||
else:
|
||||
c.lab.text = "Error: cannot open: " & z
|
||||
|
||||
proc apply(a: Actions; c: Controls) {.async.} =
|
||||
if a.mingw:
|
||||
await download("mingw" & arch, c)
|
||||
await download("mingw" & arch & "-6.3.0", c)
|
||||
if a.aporia:
|
||||
await download("aporia-0.4.0", c)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user