Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider given version range in nimble path #979

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ proc listPaths(options: Options) =
var installed: seq[VersionAndPath] = @[]
# There may be several, list all available ones and sort by version.
for pkg in pkgs:
if name == pkg.basicInfo.name:
if name == pkg.basicInfo.name and withinRange(pkg.basicInfo.version, version):
installed.add((pkg.basicInfo.version, pkg.getRealDir))

if installed.len > 0:
Expand Down
7 changes: 7 additions & 0 deletions tests/tpathcommand.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ suite "path command":
let (output, _) = execNimble("path", "srcdirtest")
let packageDir = getPackageDir(pkgsDir, "srcdirtest-1.0")
check output.strip() == packageDir

test "respects version constraint":
cd "develop/srcdirtest":
let (_, exitCode) = execNimbleYes("install")
check exitCode == QuitSuccess
check execNimble("path", "srcdirtest@1.0").exitCode == QuitSuccess
check execNimble("path", "srcdirtest@2.0").exitCode != QuitSuccess