parent
a3a60eca51
commit
fe21329f3d
3 changed files with 35 additions and 25 deletions
|
|
@ -190,11 +190,6 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[PackageInfo] =
|
|||
else:
|
||||
display("Info:", "Dependency on $1 already satisfied" % $dep,
|
||||
priority = HighPriority)
|
||||
if pkg.isLinked:
|
||||
# TODO (#393): This can be optimised since the .nimble-link files have
|
||||
# a secondary line that specifies the srcDir.
|
||||
pkg = pkg.toFullInfo(options)
|
||||
|
||||
result.add(pkg)
|
||||
# Process the dependencies of this dependency.
|
||||
result.add(processDeps(pkg.toFullInfo(options), options))
|
||||
|
|
@ -627,23 +622,19 @@ proc listPaths(options: Options) =
|
|||
raise newException(NimbleError, "A package name needs to be specified")
|
||||
|
||||
var errors = 0
|
||||
let pkgs = getInstalledPkgsMin(options.getPkgsDir(), options)
|
||||
for name, version in options.action.packages.items:
|
||||
var installed: seq[VersionAndPath] = @[]
|
||||
# There may be several, list all available ones and sort by version.
|
||||
for kind, path in walkDir(options.getPkgsDir):
|
||||
if kind != pcDir or not path.startsWith(options.getPkgsDir / name & "-"):
|
||||
continue
|
||||
|
||||
var nimbleFile = findNimbleFile(path, false)
|
||||
if nimbleFile.existsFile:
|
||||
var pkgInfo = getPkgInfo(path, options)
|
||||
for x in pkgs.items():
|
||||
let
|
||||
pName = x.pkginfo.name
|
||||
pVer = x.pkginfo.specialVersion
|
||||
if name == pName:
|
||||
var v: VersionAndPath
|
||||
v.version = newVersion(pkgInfo.specialVersion)
|
||||
v.path = pkgInfo.getRealDir()
|
||||
v.version = newVersion(pVer)
|
||||
v.path = x.pkginfo.getRealDir()
|
||||
installed.add(v)
|
||||
else:
|
||||
display("Warning:", "No .nimble file found for " & path, Warning,
|
||||
MediumPriority)
|
||||
|
||||
if installed.len > 0:
|
||||
sort(installed, cmp[VersionAndPath], Descending)
|
||||
|
|
|
|||
|
|
@ -336,8 +336,17 @@ proc getInstalledPkgsMin*(libsDir: string, options: Options):
|
|||
pkg.specialVersion = version
|
||||
pkg.isMinimal = true
|
||||
pkg.isInstalled = true
|
||||
pkg.isLinked =
|
||||
cmpPaths(nimbleFile.splitFile().dir, path) != 0
|
||||
let nimbleFileDir = nimbleFile.splitFile().dir
|
||||
pkg.isLinked = cmpPaths(nimbleFileDir, path) != 0
|
||||
|
||||
# Read the package's 'srcDir' (this is stored in the .nimble-link so
|
||||
# we can easily grab it)
|
||||
if pkg.isLinked:
|
||||
let nimbleLinkPath = path / name.addFileExt("nimble-link")
|
||||
let realSrcPath = readNimbleLink(nimbleLinkPath).packageDir
|
||||
assert realSrcPath.startsWith(nimbleFileDir)
|
||||
pkg.srcDir = realSrcPath.replace(nimbleFileDir)
|
||||
pkg.srcDir.removePrefix(DirSep)
|
||||
result.add((pkg, meta))
|
||||
|
||||
proc withinRange*(pkgInfo: PackageInfo, verRange: VersionRange): bool =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue