Fixes #432. Fixes #672.

This commit is contained in:
Dominik Picheta 2019-09-22 16:37:47 +01:00
commit fe252c6ed6
6 changed files with 39 additions and 2 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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