Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/choosenimpkg/builder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ proc buildCompiler(version: Version, params: CliParams) =
display("Warning:", "Building from latest C sources. They may not be " &
"compatible with the Nim version you have chosen to " &
"install.", Warning, HighPriority)
let path = downloadCSources(params)
let path = downloadCSources(version, params)
let extractDir = getCurrentDir() / "csources"
extract(path, extractDir)

Expand Down
14 changes: 11 additions & 3 deletions src/choosenimpkg/download.nim
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,19 @@ proc download*(version: Version, params: CliParams): string =
raise newException(ChooseNimError, "Version $1 does not exist." %
$version)

proc downloadCSources*(params: CliParams): string =
template useCSourcesV2(version: Version): bool =
$version in ["#head", "#devel", "#version-2-0"]

proc downloadCSources*(version: Version, params: CliParams): string =
let csourcesAdaptedUrl =
if useCSourcesV2(version):
csourcesUrl & "_v2"
else:
csourcesUrl
let
commit = getLatestCommit(csourcesUrl, "master")
commit = getLatestCommit(csourcesAdaptedUrl, "master")
archive = if commit.len != 0: commit else: "master"
csourcesArchiveUrl = $(parseUri(csourcesUrl) / (dlArchive % archive))
csourcesArchiveUrl = $(parseUri(csourcesAdaptedUrl) / (dlArchive % archive))

var outputPath: string
if not needsDownload(params, csourcesArchiveUrl, outputPath):
Expand Down