From 53856db8ff11ae1e73495801fa9c93895c04e93f Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 27 Dec 2016 13:54:54 +0000 Subject: [PATCH] Fixes tests. --- src/nimble.nim | 8 ++++---- src/nimblepkg/packageparser.nim | 4 +++- tests/issue289/issue289.nimble | 2 +- tests/packageStructure/a/a.nimble | 2 +- tests/packageStructure/b/b.nimble | 2 +- tests/packageStructure/c/c.nimble | 2 +- tests/packageStructure/x/x.nimble | 2 +- tests/packageStructure/y/y.nimble | 2 +- tests/packageStructure/z/z.nimble | 2 +- tests/tester.nim | 1 - 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/nimble.nim b/src/nimble.nim index 920196c..3f9abdc 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -298,11 +298,11 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[string] = for p in result: let pkgInfo = getPkgInfo(p, options) if pkgsInPath.hasKey(pkgInfo.name) and - pkgsInPath[pkgInfo.name] != pkgInfo.specialVersion: + pkgsInPath[pkgInfo.name] != pkgInfo.version: raise newException(NimbleError, "Cannot satisfy the dependency on $1 $2 and $1 $3" % - [pkgInfo.name, pkgInfo.specialVersion, pkgsInPath[pkgInfo.name]]) - pkgsInPath[pkgInfo.name] = pkgInfo.specialVersion + [pkgInfo.name, pkgInfo.version, pkgsInPath[pkgInfo.name]]) + pkgsInPath[pkgInfo.name] = pkgInfo.version # We add the reverse deps to the JSON file here because we don't want # them added if the above errorenous condition occurs @@ -409,7 +409,7 @@ proc installFromDir(dir: string, requestedVer: VersionRange, options: Options, pkgInfo.specialVersion = $requestedVer.spe # Dependencies need to be processed before the creation of the pkg dir. - result.paths = processDeps(pkginfo, depsOptions) + result.paths = processDeps(pkgInfo, depsOptions) if options.depsOnly: result.pkg = pkgInfo diff --git a/src/nimblepkg/packageparser.nim b/src/nimblepkg/packageparser.nim index 2f89c88..f3ead77 100644 --- a/src/nimblepkg/packageparser.nim +++ b/src/nimblepkg/packageparser.nim @@ -273,7 +273,6 @@ proc readPackageInfo(nf: NimbleFile, options: Options, if onlyMinimalInfo: result.name = minimalInfo.name result.version = minimalInfo.version - result.specialVersion = result.version result.isNimScript = true result.isMinimal = true else: @@ -288,6 +287,9 @@ proc readPackageInfo(nf: NimbleFile, options: Options, " " & getCurrentExceptionMsg() & "." raise newException(NimbleError, msg) + # By default specialVersion is the same as version. + result.specialVersion = result.version + # The package directory name may include a "special" version # (example #head). If so, it is given higher priority and therefore # overwrites the .nimble file's version. diff --git a/tests/issue289/issue289.nimble b/tests/issue289/issue289.nimble index ab9aec8..bd90b3b 100644 --- a/tests/issue289/issue289.nimble +++ b/tests/issue289/issue289.nimble @@ -9,6 +9,6 @@ bin = @["issue289"] # Dependencies -requires "nim >= 0.15.3", "https://github.com/nimble-test/packagea.git 0.6.0" +requires "nim >= 0.15.0", "https://github.com/nimble-test/packagea.git 0.6.0" requires "https://github.com/nimble-test/packagea.git#head" diff --git a/tests/packageStructure/a/a.nimble b/tests/packageStructure/a/a.nimble index d68102b..fd6878a 100644 --- a/tests/packageStructure/a/a.nimble +++ b/tests/packageStructure/a/a.nimble @@ -7,5 +7,5 @@ license = "MIT" # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/packageStructure/b/b.nimble b/tests/packageStructure/b/b.nimble index f9bdb47..ce659ef 100644 --- a/tests/packageStructure/b/b.nimble +++ b/tests/packageStructure/b/b.nimble @@ -7,5 +7,5 @@ license = "MIT" # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/packageStructure/c/c.nimble b/tests/packageStructure/c/c.nimble index 54b0d2f..88cfb84 100644 --- a/tests/packageStructure/c/c.nimble +++ b/tests/packageStructure/c/c.nimble @@ -9,5 +9,5 @@ bin = @["c"] # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/packageStructure/x/x.nimble b/tests/packageStructure/x/x.nimble index 68093e0..51ebde2 100644 --- a/tests/packageStructure/x/x.nimble +++ b/tests/packageStructure/x/x.nimble @@ -7,5 +7,5 @@ license = "MIT" # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/packageStructure/y/y.nimble b/tests/packageStructure/y/y.nimble index 0a0f954..0ce52f9 100644 --- a/tests/packageStructure/y/y.nimble +++ b/tests/packageStructure/y/y.nimble @@ -9,5 +9,5 @@ bin = @["y"] # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/packageStructure/z/z.nimble b/tests/packageStructure/z/z.nimble index 226bc7f..f872d3c 100644 --- a/tests/packageStructure/z/z.nimble +++ b/tests/packageStructure/z/z.nimble @@ -7,5 +7,5 @@ license = "MIT" # Dependencies -requires "nim >= 0.15.3" +requires "nim >= 0.15.0" diff --git a/tests/tester.nim b/tests/tester.nim index ce30768..266811b 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -33,7 +33,6 @@ proc execNimble(args: varargs[string]): tuple[output: string, exitCode: int] = quotedArgs = quoted_args.map((x: string) => ("\"" & x & "\"")) result = execCmdEx(quotedArgs.join(" ")) - echo(result.output) proc processOutput(output: string): seq[string] = output.strip.splitLines().filter((x: string) => (x.len > 0))