Skip to content

Commit

Permalink
Update Nim to search for Nimble packages in "pkg2"
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeff committed Sep 29, 2021
1 parent b74b914 commit cfffaa1
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
var path = processPath(conf, arg, info, notRelativeToProj=true)
let nimbleDir = AbsoluteDir getEnv("NIMBLE_DIR")
if not nimbleDir.isEmpty and pass == passPP:
path = nimbleDir / RelativeDir"pkgs"
path = nimbleDir / RelativeDir"pkgs2"
nimblePath(conf, path, info)
of "nonimblepath", "nobabelpath":
if switch.normalize == "nobabelpath": deprecatedAlias(switch, "nonimblepath")
Expand Down
4 changes: 2 additions & 2 deletions compiler/modulepaths.nim
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ when false:
if not options.gNoNimblePath:
var nimbleDir = getEnv("NIMBLE_DIR")
if nimbleDir.len == 0: nimbleDir = getHomeDir() / ".nimble"
result = findInNimbleDir(pkg, subdir, nimbleDir / "pkgs")
result = findInNimbleDir(pkg, subdir, nimbleDir / "pkgs2")
if result.len > 0: return result
when not defined(windows):
result = findInNimbleDir(pkg, subdir, "/opt/nimble/pkgs")
result = findInNimbleDir(pkg, subdir, "/opt/nimble/pkgs2")
if result.len > 0: return result

proc scriptableImport(pkg, sub: string; info: TLineInfo): string =
Expand Down
4 changes: 2 additions & 2 deletions compiler/nimblecmd.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ proc `<`*(ver: Version, ver2: Version): bool =

proc getPathVersionChecksum*(p: string): tuple[name, version, checksum: string] =
## Splits path ``p`` in the format
## ``/home/user/.nimble/pkgs/package-0.1-febadeaea2345e777f0f6f8433f7f0a52edd5d1b`` into
## ``("/home/user/.nimble/pkgs/package", "0.1", "febadeaea2345e777f0f6f8433f7f0a52edd5d1b")``
## ``/home/user/.nimble/pkgs2/package-0.1-febadeaea2345e777f0f6f8433f7f0a52edd5d1b`` into
## ``("/home/user/.nimble/pkgs2/package", "0.1", "febadeaea2345e777f0f6f8433f7f0a52edd5d1b")``

const checksumSeparator = '-'
const versionSeparator = '-'
Expand Down
4 changes: 2 additions & 2 deletions config/nim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ path="$lib/core"
path="$lib/pure"

@if not windows:
nimblepath="/opt/nimble/pkgs/"
nimblepath="/opt/nimble/pkgs2/"
@else:
# TODO:
@end
nimblepath="$home/.nimble/pkgs/"
nimblepath="$home/.nimble/pkgs2/"

# Syncronize with compiler/commands.specialDefine
@if danger or quick:
Expand Down
2 changes: 1 addition & 1 deletion doc/testament.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Example "template" **to edit** and write a Testament unittest:
# Command the test should use to run. If left out or an empty string is
# provided, the command is taken to be:
# "nim $target --hints:on -d:testing --nimblePath:build/deps/pkgs $options $file"
# "nim $target --hints:on -d:testing --nimblePath:build/deps/pkgs2 $options $file"
# You can use the $target, $options, and $file placeholders in your own
# command, too.
cmd: "nim c -r $file"
Expand Down
2 changes: 1 addition & 1 deletion koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

const
NimbleStableCommit = "d13f3b8ce288b4dc8c34c219a4e050aaeaf43fc9" # master
NimbleStableCommit = "c866966161c2ea0cdf122d8cb22cef4cd3cc04ae" # master
# examples of possible values: #head, #ea82b54, 1.2.3
FusionStableHash = "#372ee4313827ef9f2ea388840f7d6b46c2b1b014"
HeadHash = "#head"
Expand Down
2 changes: 1 addition & 1 deletion testament/specs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type

proc getCmd*(s: TSpec): string =
if s.cmd.len == 0:
result = compilerPrefix & " $target --hints:on -d:testing --clearNimblePath --nimblePath:build/deps/pkgs $options $file"
result = compilerPrefix & " $target --hints:on -d:testing --clearNimblePath --nimblePath:build/deps/pkgs2 $options $file"
else:
result = s.cmd

Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/tasync_cpp.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
discard """
targets: "cpp"
output: "hello"
cmd: "nim cpp --clearNimblePath --nimblePath:build/deps/pkgs $file"
cmd: "nim cpp --clearNimblePath --nimblePath:build/deps/pkgs2 $file"
"""

# bug #3299
Expand Down
6 changes: 3 additions & 3 deletions tools/niminst/deinstall.nimf
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ if [ $# -eq 1 ] ; then
libdir=/usr/lib/?proj
docdir=/usr/share/?proj/doc
datadir=/usr/share/?proj/data
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
;;
"/usr/local/bin")
bindir=/usr/local/bin
configdir=/etc/?proj
libdir=/usr/local/lib/?proj
docdir=/usr/local/share/?proj/doc
datadir=/usr/local/share/?proj/data
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
;;
"/opt")
bindir="/opt/?proj/bin"
configdir="/opt/?proj/config"
libdir="/opt/?proj/lib"
docdir="/opt/?proj/doc"
datadir="/opt/?proj/data"
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
;;
*)
bindir="$1/?proj/bin"
Expand Down
6 changes: 3 additions & 3 deletions tools/niminst/install.nimf
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ if [ $# -eq 1 ] ; then
libdir=/usr/lib/?proj
docdir=/usr/share/?proj/doc
datadir=/usr/share/?proj/data
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
;;
"/usr/local/bin")
bindir=/usr/local/bin
configdir=/etc/?proj
libdir=/usr/local/lib/?proj
docdir=/usr/local/share/?proj/doc
datadir=/usr/local/share/?proj/data
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
;;
"/opt")
bindir="/opt/?proj/bin"
configdir="/opt/?proj/config"
libdir="/opt/?proj/lib"
docdir="/opt/?proj/doc"
datadir="/opt/?proj/data"
nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum"
mkdir -p /opt/?proj
mkdir -p $bindir
mkdir -p $configdir
Expand Down
3 changes: 2 additions & 1 deletion tools/niminst/niminst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type
fcUnix, # files only for Unix; must be after ``fcWindows``
fcUnixBin, # binaries for Unix
fcDocStart, # links to documentation for Windows installer
fcNimble # nimble package files to copy to /opt/nimble/pkgs/pkg-ver
fcNimble # nimble package files to copy to /opt/nimble/pkgs2/pkg-ver-checksum

ConfigData = object of RootObj
actions: set[Action]
Expand All @@ -63,6 +63,7 @@ type
nimArgs: string
debOpts: TDebOptions
nimblePkgName: string
checksum: string

const
unixDirVars: array[fcConfig..fcLib, string] = [
Expand Down

0 comments on commit cfffaa1

Please sign in to comment.