Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Dominik Picheta
6e8f691b42 Add test for #620 with attempted workaround. 2019-03-17 15:27:50 +00:00
2 changed files with 22 additions and 0 deletions

View file

@ -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:

View file

@ -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")