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

returns the nim directory prioritising the one used by the project instead of the one in the installed pkg list dir #1250

Merged
merged 1 commit into from
Jul 27, 2024
Merged
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
19 changes: 11 additions & 8 deletions src/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1130,14 +1130,17 @@ proc getPackageByPattern(pattern: string, options: Options): PackageInfo =
result = getPkgInfoFromFile(skeletonInfo.myPath, options)

proc getNimDir(options: Options): string =
let pkgs =
getInstalledPkgsMin(options.getPkgsDir(), options)
.filterIt(it.basicInfo.name == "nim")
if pkgs.len > 0:
let nimBin = pkgs[0].getNimBin(options)
nimBin.parentDir
else:
options.nimBin.parentDir
## returns the nim directory prioritizing the one used by the project
let projectPkg = getPackageByPattern(options.action.projName, options)
var nimPkgTupl = projectPkg.requires.filterIt(it.name == "nim")
if nimPkgTupl.len > 0:
let nimPkgInfo =
getInstalledPkgsMin(options.getPkgsDir(), options)
.filterIt(it.basicInfo.name == "nim" and it.withinRange(nimPkgTupl[0].ver))
if nimPkgInfo.len > 0:
let nimBin = nimPkgInfo[0].getNimBin(options)
return nimBin.parentDir
options.nimBin.parentDir

proc getEntryPoints(pkgInfo: PackageInfo, options: Options): seq[string] =
## Returns the entry points for a package.
Expand Down