Binary packages no longer install .nim files implicitly. Refs #469.

This commit is contained in:
Dominik Picheta 2018-09-09 23:24:53 +01:00
commit fb879efb72
6 changed files with 28 additions and 1 deletions

View file

@ -277,6 +277,15 @@ proc readPackageInfoFromNimble(path: string; result: var PackageInfo) =
else:
raise newException(ValueError, "Cannot open package info: " & path)
proc inferInstallRules(pkgInfo: var PackageInfo, options: Options) =
# Binary packages shouldn't install .nim files by default.
# (As long as the package info doesn't explicitly specify what should be
# installed.)
let installInstructions =
pkgInfo.installDirs.len + pkgInfo.installExt.len + pkgInfo.installFiles.len
if installInstructions == 0 and pkgInfo.bin.len > 0:
pkgInfo.skipExt.add("nim")
proc readPackageInfo(nf: NimbleFile, options: Options,
onlyMinimalInfo=false): PackageInfo =
## Reads package info from the specified Nimble file.
@ -354,6 +363,9 @@ proc readPackageInfo(nf: NimbleFile, options: Options,
if not result.isMinimal:
options.pkgInfoCache[nf] = result
# Apply rules to infer which files should/shouldn't be installed. See #469.
inferInstallRules(result, options)
# Validate the rest of the package info last.
if not options.disableValidation:
validateVersion(result.version)