Skip to content

Commit

Permalink
Fix the tests on Windows
Browse files Browse the repository at this point in the history
Related to #127
  • Loading branch information
bobeff committed Apr 23, 2021
1 parent 605df60 commit a3b7ed0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
11 changes: 6 additions & 5 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ installed and added to your environment ``PATH``. Same goes for
[Bitbucket](https://bitbucket.org). Nimble packages are typically hosted in Git
repositories so you may be able to get away without installing Mercurial.

**Warning:** Ensure that you have a fairly recent version of Git installed.
Cloning of a specific Git commit described in the lock file uses a method
(described [here](https://stackoverflow.com/a/3489576/853791)) requiring at
least Git version **2.5** from year **2015** and enabled on server side with
the configuration variable `uploadpack.allowReachableSHA1InWant`. Currently the
**Warning:** Ensure that you have a fairly recent version of **Git** installed.
Current minimal supported version is **Git** `2.22` from `2019-06-07`.
Cloning of a specific **Git** commit described in the lock file uses a method
described [here](https://stackoverflow.com/a/3489576/853791) and requiring an
option enabled on server side with the configuration variable
`uploadpack.allowReachableSHA1InWant`. Currently the
feature is supported by both **GitHub** and **BitBucket**.

## Installation
Expand Down
10 changes: 6 additions & 4 deletions src/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ proc reinstallSymlinksForOlderVersion(pkgDir: string, options: Options) =
var newPkgInfo = initPackageInfo()
if pkgList.findPkg((pkgName, newVRAny()), newPkgInfo):
newPkgInfo = newPkgInfo.toFullInfo(options)
for bin in newPkgInfo.binaries:
for bin, _ in newPkgInfo.bin:
let symlinkDest = newPkgInfo.getOutputDir(bin)
let symlinkFilename = options.getBinDir() / bin.extractFilename
discard setupBinSymlink(symlinkDest, symlinkFilename, options)
Expand Down Expand Up @@ -1117,7 +1117,7 @@ proc updatePathsFile(pkgInfo: PackageInfo, options: Options) =
let paths = pkgInfo.getDependenciesPaths(options)
var pathsFileContent: string
for path in paths:
pathsFileContent &= &"--path:\"{path}\"\n"
pathsFileContent &= &"--path:{path.escape}\n"
var action = if fileExists(nimblePathsFileName): "updated" else: "generated"
writeFile(nimblePathsFileName, pathsFileContent)
displayInfo(&"\"{nimblePathsFileName}\" is {action}.")
Expand Down Expand Up @@ -1570,8 +1570,10 @@ proc setupVcsIgnoreFile =
vcsIgnoreFileName = case currentDir.getVcsType
of vcsTypeGit: gitIgnoreFileName
of vcsTypeHg: hgIgnoreFileName
of vcsTypeNone: raise nimbleError(
&"The directory {currentDir} is not under version control.")
of vcsTypeNone: ""

if vcsIgnoreFileName.len == 0:
return

var
writeFile = false
Expand Down
Binary file removed src/nimblepkg/pkgnameversionchecksum
Binary file not shown.
11 changes: 9 additions & 2 deletions tests/tdevelopfeature.nim
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,16 @@ suite "develop feature":
var lines = output.processOutput
check lines.inLinesOrdered(failedToLoadFileMsg(
getCurrentDir() / developFileName))

let
pkg3Path = (".." / "pkg3").Path
pkg32Path = (".." / "pkg3.2").Path
freeDevFile1Path = (".." / freeDevFile1Name).Path
freeDevFile2Path = (".." / freeDevFile2Name).Path

check lines.inLinesOrdered(pkgFoundMoreThanOnceMsg("pkg3",
[("../pkg3".Path, (&"../{freeDevFile1Name}").Path),
("../pkg3.2".Path, (&"../{freeDevFile2Name}").Path)].toHashSet))
[(pkg3Path, freeDevFile1Path),
(pkg32Path, freeDevFile2Path)].toHashSet))

test "create an empty develop file with default name in the current dir":
cd dependentPkgPath:
Expand Down
4 changes: 3 additions & 1 deletion tests/tlockfile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ from nimblepkg/lockfile import lockFileName, LockFileJsonKeys
from nimblepkg/sha1hashes import initSha1Hash
from nimblepkg/developfile import ValidationError, ValidationErrorKind,
developFileName, getValidationErrorMessage
from nimblepkg/vcstools import VcsType, getVcsDefaultBranchName

suite "lock file":
type
Expand Down Expand Up @@ -111,7 +112,8 @@ requires "nim >= 1.5.1"
tryDoCmdEx("git commit -m " & msg.quoteShell)

proc push(remote: string) =
tryDoCmdEx("git push " & remote)
tryDoCmdEx(
&"git push --set-upstream {remote} {vcsTypeGit.getVcsDefaultBranchName}")

proc pull(remote: string) =
tryDoCmdEx("git pull " & remote)
Expand Down
5 changes: 3 additions & 2 deletions tests/tsetupcommand.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ suite "setup command":
check fileExists(nimbleConfigFileName)
# Check that develop mode dependency path is written in the
# "nimble.paths" file.
let developDepDir = (getCurrentDir() / "../dependency").normalizedPath
check nimblePathsFileName.readFile.contains(developDepDir)
let developDepDir =
(getCurrentDir() / ".." / "dependency").normalizedPath
check nimblePathsFileName.readFile.contains(developDepDir.escape)
# Check that Nim can use "nimble.paths" file to find dependencies and
# build the project.
let (_, nimExitCode) = execCmdEx("nim c -r dependent")
Expand Down

0 comments on commit a3b7ed0

Please sign in to comment.