Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e8f691b42 |
2 changed files with 22 additions and 0 deletions
|
|
@ -310,6 +310,7 @@ proc execScript(scriptName: string, flags: Flags, options: Options): PSym =
|
|||
graph = newModuleGraph(graph.config)
|
||||
|
||||
let conf = graph.config
|
||||
conf.searchPaths = @[]
|
||||
when declared(NimCompilerApiVersion):
|
||||
if "nimblepkg/nimscriptapi" notin conf.implicitImports:
|
||||
conf.implicitImports.add("nimblepkg/nimscriptapi")
|
||||
|
|
@ -381,11 +382,20 @@ proc execScript(scriptName: string, flags: Flags, options: Options): PSym =
|
|||
let pkgName = scriptName.splitFile.name
|
||||
|
||||
# Ensure that "nimblepkg/nimscriptapi" is in the PATH.
|
||||
var issue620 = false
|
||||
block:
|
||||
echo(scriptName.splitFile.dir / "nimblepkg" / "nimscriptapi.nim")
|
||||
if existsFile(scriptName.splitFile.dir / "nimblepkg" / "nimscriptapi.nim"):
|
||||
# TODO: hacky workaround for #620.
|
||||
issue620 = true
|
||||
conf.disableNimblePath()
|
||||
break
|
||||
|
||||
let t = getTempDir() / "nimblecache"
|
||||
let tmpNimscriptApiPath = t / "nimblepkg" / "nimscriptapi.nim"
|
||||
createDir(tmpNimscriptApiPath.splitFile.dir)
|
||||
writeFile(tmpNimscriptApiPath, nimscriptApi)
|
||||
echo("before ", conf.searchPaths)
|
||||
when declared(NimCompilerApiVersion):
|
||||
when NimCompilerApiVersion >= 3:
|
||||
conf.searchPaths.add(AbsoluteDir t)
|
||||
|
|
@ -393,6 +403,7 @@ proc execScript(scriptName: string, flags: Flags, options: Options): PSym =
|
|||
conf.searchPaths.add(t)
|
||||
else:
|
||||
searchPaths.add(t)
|
||||
echo("after ", conf.searchPaths)
|
||||
|
||||
when declared(NimCompilerApiVersion):
|
||||
initDefines(conf.symbols)
|
||||
|
|
@ -428,6 +439,8 @@ proc execScript(scriptName: string, flags: Flags, options: Options): PSym =
|
|||
|
||||
searchPaths.add(compiler_options.libpath)
|
||||
|
||||
echo("after2 ", conf.searchPaths)
|
||||
|
||||
when declared(resetAllModulesHard):
|
||||
result = makeModule(scriptName)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -67,6 +67,15 @@ proc inLines(lines: seq[string], line: string): bool =
|
|||
for i in lines:
|
||||
if line.normalize in i.normalize: return true
|
||||
|
||||
suite "Issue 620":
|
||||
test "install nimble":
|
||||
cd "..":
|
||||
check execNimble(["install", "-y"]).exitCode == QuitSuccess
|
||||
|
||||
test "nimble check the installed nimble file":
|
||||
cd execNimble(["path", "nimble"]).output:
|
||||
check execNimble(["check"]).exitCode == QuitSuccess
|
||||
|
||||
test "picks #head when looking for packages":
|
||||
cd "versionClashes" / "aporiaScenario":
|
||||
let (output, exitCode) = execNimble("install", "-y", "--verbose")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue