Skip to content

Commit

Permalink
Fixes an issue when the wrong csources was downloaded (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez authored Aug 23, 2024
1 parent 1eba1d5 commit c3aff2a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/nimblepkg/nimenv.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
display("Error", "Failed to execute: $1" % cmd, Error, HighPriority)
return
let nimVersion = v.getNimVersion()
let canUseCsources = v.kind != verAny
let workspace = nimDest.parentDir()
if dirExists(workspace / nimDest):
if not fileExists(nimDest / ActivationFile):
Expand Down Expand Up @@ -55,18 +56,19 @@ proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
exec "git clone https://github.com/nim-lang/" & csourcesVersion

var csourcesSucceed = false
cd workspace / csourcesVersion:
when defined(windows):
let cmd = "build.bat"
csourcesSucceed = os.execShellCmd(cmd) == 0
else:
let makeExe = findExe("make")
if makeExe.len == 0:
let cmd = "sh build.sh"
if canUseCsources:
cd workspace / csourcesVersion:
when defined(windows):
let cmd = "build.bat"
csourcesSucceed = os.execShellCmd(cmd) == 0
else:
let cmd = "make"
csourcesSucceed = os.execShellCmd(cmd) == 0
let makeExe = findExe("make")
if makeExe.len == 0:
let cmd = "sh build.sh"
csourcesSucceed = os.execShellCmd(cmd) == 0
else:
let cmd = "make"
csourcesSucceed = os.execShellCmd(cmd) == 0

cd nimDest:
#Sometimes building from csources fails and we cant do much about it. So we fallback to the slow build_all method
Expand Down

0 comments on commit c3aff2a

Please sign in to comment.