Simplify implementation of path for Nimble links.
This commit is contained in:
parent
596d17804f
commit
a02a1431e2
2 changed files with 10 additions and 22 deletions
|
|
@ -615,28 +615,13 @@ proc listPaths(options: Options) =
|
||||||
if kind != pcDir or not path.startsWith(options.getPkgsDir / name):
|
if kind != pcDir or not path.startsWith(options.getPkgsDir / name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
var nimbleFile = path / name.addFileExt("nimble")
|
var nimbleFile = findNimbleFile(path, false)
|
||||||
var nimbleLinkTargetPath: string
|
|
||||||
if not nimbleFile.existsFile:
|
|
||||||
let nimbleLinkFile = path / name.addFileExt("nimble-link")
|
|
||||||
if fileExists(nimbleLinkFile):
|
|
||||||
let lnk = readNimbleLink(nimbleLinkFile)
|
|
||||||
nimbleFile = lnk.nimbleFilePath
|
|
||||||
nimbleLinkTargetPath = lnk.packageDir
|
|
||||||
|
|
||||||
if nimbleFile.existsFile:
|
if nimbleFile.existsFile:
|
||||||
var pkgInfo = getPkgInfo(path, options)
|
var pkgInfo = getPkgInfo(path, options)
|
||||||
var v: VersionAndPath
|
var v: VersionAndPath
|
||||||
v.version = newVersion(pkgInfo.specialVersion)
|
v.version = newVersion(pkgInfo.specialVersion)
|
||||||
if nimbleLinkTargetPath.len == 0:
|
v.path = pkgInfo.getRealDir()
|
||||||
v.path = options.getPkgsDir / (pkgInfo.name & '-' & pkgInfo.specialVersion)
|
installed = @[v]
|
||||||
installed.add(v)
|
|
||||||
else:
|
|
||||||
# If we have a nimble-developed package, this is really the path we're
|
|
||||||
# looking for.
|
|
||||||
v.path = nimbleLinkTargetPath
|
|
||||||
installed = @[v]
|
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
display("Warning:", "No .nimble file found for " & path, Warning,
|
display("Warning:", "No .nimble file found for " & path, Warning,
|
||||||
MediumPriority)
|
MediumPriority)
|
||||||
|
|
@ -878,8 +863,11 @@ proc developFromDir(dir: string, options: Options) =
|
||||||
# `nimble develop` if they change their `srcDir` but I think it's a worthy
|
# `nimble develop` if they change their `srcDir` but I think it's a worthy
|
||||||
# compromise.
|
# compromise.
|
||||||
let nimbleLinkPath = pkgDestDir / pkgInfo.name.addFileExt("nimble-link")
|
let nimbleLinkPath = pkgDestDir / pkgInfo.name.addFileExt("nimble-link")
|
||||||
writeNimbleLink(nimbleLinkPath,
|
let nimbleLink = NimbleLink(
|
||||||
NimbleLink(nimbleFilePath: pkgInfo.myPath, packageDir: pkgInfo.getRealDir()))
|
nimbleFilePath: pkgInfo.myPath,
|
||||||
|
packageDir: pkgInfo.getRealDir()
|
||||||
|
)
|
||||||
|
writeNimbleLink(nimbleLinkPath, nimbleLink)
|
||||||
|
|
||||||
# Save a nimblemeta.json file.
|
# Save a nimblemeta.json file.
|
||||||
saveNimbleMeta(pkgDestDir, "file://" & dir, vcsRevisionInDir(dir),
|
saveNimbleMeta(pkgDestDir, "file://" & dir, vcsRevisionInDir(dir),
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ const path = "../src/nimble"
|
||||||
removeDir(installDir)
|
removeDir(installDir)
|
||||||
createDir(installDir)
|
createDir(installDir)
|
||||||
|
|
||||||
test "can compile nimble":
|
# Always recompile.
|
||||||
check execCmdEx("nim c " & path).exitCode == QuitSuccess
|
doAssert execCmdEx("nim c " & path).exitCode == QuitSuccess
|
||||||
|
|
||||||
test "can compile with --os:windows":
|
test "can compile with --os:windows":
|
||||||
check execCmdEx("nim check --os:windows " & path).exitCode == QuitSuccess
|
check execCmdEx("nim check --os:windows " & path).exitCode == QuitSuccess
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue