diff --git a/src/nimble.nim b/src/nimble.nim index 6b879ac..79f8768 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -205,7 +205,7 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[PackageInfo] = raise newException(NimbleError, "Cannot satisfy the dependency on $1 $2 and $1 $3" % [pkgInfo.name, pkgInfo.version, pkgsInPath[pkgInfo.name]]) - pkgsInPath[pkgInfo.name] = pkgInfo.version + pkgsInPath[pkgInfo.name] = pkgInfo.getConcreteVersion(options) # We add the reverse deps to the JSON file here because we don't want # them added if the above errorenous condition occurs diff --git a/src/nimblepkg/common.nim b/src/nimblepkg/common.nim index c40a82d..ab83175 100644 --- a/src/nimblepkg/common.nim +++ b/src/nimblepkg/common.nim @@ -22,7 +22,8 @@ when not defined(nimscript): preHooks*: HashSet[string] name*: string ## The version specified in the .nimble file.Assuming info is non-minimal, - ## it will always be a non-special version such as '0.1.4' + ## it will always be a non-special version such as '0.1.4'. + ## If in doubt, use `getConcreteVersion` instead. version*: string specialVersion*: string ## Either `myVersion` or a special version such as #head. author*: string diff --git a/src/nimblepkg/packageparser.nim b/src/nimblepkg/packageparser.nim index 59c2ca8..9458074 100644 --- a/src/nimblepkg/packageparser.nim +++ b/src/nimblepkg/packageparser.nim @@ -487,6 +487,15 @@ proc toFullInfo*(pkg: PackageInfo, options: Options): PackageInfo = else: return pkg +proc getConcreteVersion*(pkgInfo: PackageInfo, options: Options): string = + ## Returns a non-special version from the specified ``pkgInfo``. If the + ## ``pkgInfo`` is minimal it looks it up and retrieves the concrete version. + result = pkgInfo.version + if pkgInfo.isMinimal: + let pkgInfo = pkgInfo.toFullInfo(options) + result = pkgInfo.version + assert(not newVersion(result).isSpecial) + when isMainModule: validatePackageName("foo_bar") validatePackageName("f_oo_b_a_r") diff --git a/tests/issue432/issue432.nimble b/tests/issue432/issue432.nimble new file mode 100644 index 0000000..92937c5 --- /dev/null +++ b/tests/issue432/issue432.nimble @@ -0,0 +1,15 @@ +# Package + +version = "0.1.0" +author = "Dominik Picheta" +description = "A new awesome nimble package" +license = "MIT" +srcDir = "src" + + + +# Dependencies + +requires "nim >= 0.16.0" +requires "https://github.com/nimble-test/packagea#head", + "https://github.com/nimble-test/packagebin2" diff --git a/tests/issue432/src/issue432.nim b/tests/issue432/src/issue432.nim new file mode 100644 index 0000000..4b2a270 --- /dev/null +++ b/tests/issue432/src/issue432.nim @@ -0,0 +1,7 @@ +# This is just an example to get you started. A typical library package +# exports the main API in this file. Note that you cannot rename this file +# but you can remove it if you wish. + +proc add*(x, y: int): int = + ## Adds two files together. + return x + y diff --git a/tests/tester.nim b/tests/tester.nim index c2d2a59..1bf9caa 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -79,6 +79,11 @@ proc hasLineStartingWith(lines: seq[string], prefix: string): bool = return true return false +test "issue 432": + cd "issue432": + check execNimble("install", "-y", "--depsOnly").exitCode == QuitSuccess + check execNimble("install", "-y", "--depsOnly").exitCode == QuitSuccess + test "issue 708": cd "issue708": # TODO: We need a way to filter out compiler messages from the messages