This commit is contained in:
Dominik Picheta 2017-01-03 17:43:59 +00:00
commit 2f45eab060
2 changed files with 11 additions and 7 deletions

View file

@ -227,7 +227,7 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[string] =
"dependencies for $1@$2" % [pkginfo.name, pkginfo.specialVersion],
priority = HighPriority)
let pkglist = getInstalledPkgs(options.getPkgsDir(), options)
let pkglist = getInstalledPkgsMin(options.getPkgsDir(), options)
var reverseDeps: seq[tuple[name, version: string]] = @[]
for dep in pkginfo.requires:
if dep.name == "nimrod" or dep.name == "nim":
@ -260,7 +260,7 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[string] =
priority = HighPriority)
result.add(pkg.mypath.splitFile.dir)
# Process the dependencies of this dependency.
result.add(processDeps(pkg, options))
result.add(processDeps(pkg.toFullInfo(options), options))
reverseDeps.add((pkg.name, pkg.specialVersion))
# Check if two packages of the same name (but different version) are listed
@ -947,9 +947,9 @@ proc uninstall(options: Options) =
# removeRevDep needs the package dependency info, so we can't just pass
# a minimal pkg info.
let pkgFull = getPkgInfo(pkg.mypath.splitFile.dir, options) # TODO: Simplify
removeRevDep(options, pkgFull)
removePkgDir(options.getPkgsDir / (pkg.name & '-' & pkg.specialVersion), options)
removeRevDep(options, pkg.toFullInfo(options))
removePkgDir(options.getPkgsDir / (pkg.name & '-' & pkg.specialVersion),
options)
display("Removed", "$1 ($2)" % [pkg.name, $pkg.specialVersion], Success,
HighPriority)
@ -965,7 +965,7 @@ proc execHook(options: Options, before: bool): bool =
nimbleFile = findNimbleFile(getCurrentDir(), true)
except NimbleError: return true
# PackageInfos are cached so we can read them as many times as we want.
let pkgInfo = getPkgInfo(nimbleFile.splitFile.dir, options) # TODO: Simplify
let pkgInfo = getPkgInfoFromFile(nimbleFile, options)
let actionName =
if options.action.typ == actionCustom: options.action.command
else: ($options.action.typ)[6 .. ^1]

View file

@ -320,7 +320,7 @@ proc getPkgInfoFromFile*(file: NimbleFile, options: Options): PackageInfo =
proc getPkgInfo*(dir: string, options: Options): PackageInfo =
## Find the .nimble file in ``dir`` and parses it, returning a PackageInfo.
let nimbleFile = findNimbleFile(dir, true)
getPkgInfoFromFile(nimbleFile, options)
return getPkgInfoFromFile(nimbleFile, options)
proc getInstalledPkgs*(libsDir: string, options: Options):
seq[tuple[pkginfo: PackageInfo, meta: MetaData]] =
@ -371,6 +371,10 @@ proc getInstalledPkgs*(libsDir: string, options: Options):
proc isNimScript*(nf: string, options: Options): bool =
result = readPackageInfo(nf, options).isNimScript
proc toFullInfo*(pkg: PackageInfo, options: Options): PackageInfo =
assert(pkg.isMinimal, "Redundant call?")
return getPkgInfoFromFile(pkg.mypath, options)
when isMainModule:
validatePackageName("foo_bar")
validatePackageName("f_oo_b_a_r")