From 36a61739b15a9ade8e4d48aad1d878562cd8c38a Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 8 Oct 2016 12:07:24 +0200 Subject: [PATCH 01/12] up to date readme.markdown --- readme.markdown | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/readme.markdown b/readme.markdown index 343219b..9dbec1d 100644 --- a/readme.markdown +++ b/readme.markdown @@ -86,36 +86,7 @@ you also need to create a symlink for ``nimble``. ### Windows -You can install Nimble via a pre-built installation archive which is -available on the [releases](https://github.com/nim-lang/nimble/releases) page. -Alternatively, you can also install Nimble from source. - -#### Using the pre-built archives - -Download the latest release archive from the -[releases](https://github.com/nim-lang/nimble/releases) page. These archives -will have a filename of the form ``nimble-x_win32`` where ``x`` is the -current version. - -Once you download that archive unzip it and execute the ``install.bat`` file. -One important thing to note is that this installation requires you have -the Nim compiler in your PATH. Once the installation completes you should -add ``C:\Users\YourName\.nimble\bin`` to your PATH. - -#### From source - -On Windows installing Nimble from source is slightly more complex: - - git clone https://github.com/nim-lang/nimble.git - cd nimble - nim -d:release c src/nimble - cp src/nimble.exe src/nimble1.exe - src/nimble1.exe install - -This is required because Windows will lock the process which is being run, but -during installation Nimble recompiles itself causing an error. -Once the installation completes you should -add ``C:\Users\YourName\.nimble\bin`` to your PATH. +The Windows installer ships with ``nimble.exe`` out of the box. ## Nimble's folder structure and packages From 75dbfe9d0e6c70e85792dbeb458ad5c9e690f79a Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 8 Oct 2016 18:04:36 +0200 Subject: [PATCH 02/12] Improves readme installation instructions. Fixes #260. --- readme.markdown | 55 ++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/readme.markdown b/readme.markdown index 9dbec1d..e897314 100644 --- a/readme.markdown +++ b/readme.markdown @@ -8,11 +8,8 @@ Interested in learning **how to create a package**? Skip directly to that sectio ## Contents +- [Requirements](#requirements) - [Installation](#installation) - - [Unix](#unix) - - [Windows](#windows) - - [Using the pre-built archives](#using-the-pre-built-archives) - - [From source](#from-source) - [Nimble's folder structure and packages](#nimbles-folder-structure-and-packages) - [Nimble usage](#nimble-usage) - [nimble refresh](#nimble-refresh) @@ -47,15 +44,7 @@ Interested in learning **how to create a package**? Skip directly to that sectio - [Contribution](#contribution) - [About](#about) -## Installation - -The latest version of Nimble (in the master branch) is primarily tested with -the latest version of the Nim compiler (in the devel branch). You can be sure -that Nimble will compile with that version of the compiler (a green travis -build status is also a good sign that this is the case). - -The latest version of Nimble (0.7.4) requires a version of Nim greater than -or equal to 0.13.0. That being said, the latest version of Nim is recommended. +## Requirements Nimble has some runtime dependencies on external tools, these tools are used to download Nimble packages. @@ -71,22 +60,42 @@ If the version is less recent than 1.9.0 then Nimble may have trouble using it. See [this issue](https://github.com/nim-lang/nimble/issues/105) for more info. -The following sections give platform-specific instructions on how to -compile and install Nimble. +## Installation -### Source based installation +Nimble is now bundled with [Nim](http://nim-lang.org) +(since Nim version 0.15.0). +This means that you should have Nimble installed already, as long as you have +the latest version of Nim installed as well. Because of this **you likely do +not need to install Nimble manually**. -Run this command in your **Nim** directory:: +But in case you still want to install Nimble manually, you can follow the +following instructions. - nim e install_nimble.nims +There are two ways to install Nimble manually. The first is using the +``install_nimble.nims`` script included in the Nim distribution and +[repository](https://github.com/nim-lang/Nim/blob/devel/install_nimble.nims). +Simply execute this to install Nimble. -This assumes that you also used the source based installation and added -``$nim/bin`` to your ``PATH``. If you create a symlink to ``nim`` instead, -you also need to create a symlink for ``nimble``. +``` +nim e install_nimble.nims +``` -### Windows +This will clone the Nimble repository, compile Nimble and copy it into +Nim's bin directory. -The Windows installer ships with ``nimble.exe`` out of the box. +The second approach is to install Nimble as a Nimble package. You can do this +by compiling Nimble, then running ``nimble install`` in Nimble's directory. + +``` +git clone https://github.com/nim-lang/nimble.git +cd nimble +nim c src/nimble +src/nimble install +``` + +**Note for Windows users**: You will need to rename ``nimble.exe`` after +compilation to something else like ``nimble1.exe``, then run +``src\nimble1.exe install``. ## Nimble's folder structure and packages From 138a5a2ae9650713c9cba9b2af231f07af4117ee Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 8 Oct 2016 20:27:47 +0200 Subject: [PATCH 03/12] Statically read nimscriptapi.nim into the executable. Fixes #238. --- src/nimblepkg/nimscriptsupport.nim | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index c528c8b..092d021 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -28,6 +28,7 @@ type const internalCmd = "NimbleInternal" + nimscriptApi = staticRead("nimscriptapi.nim") proc raiseVariableError(ident, typ: string) {.noinline.} = raise newException(NimbleError, @@ -173,24 +174,20 @@ proc setupVM(module: PSym; scriptName: string, flags[a.getString 0] = a.getString 1 proc findNimscriptApi(options: Options): string = - ## Returns the directory containing ``nimscriptapi.nim`` - var inPath = false + ## Returns the directory containing ``nimscriptapi.nim`` or an empty string + ## if it cannot be found. + result = "" # Try finding it in exe's path if fileExists(getAppDir() / "nimblepkg" / "nimscriptapi.nim"): result = getAppDir() - inPath = true - if not inPath: + if result.len == 0: let pkgs = getInstalledPkgsMin(options.getPkgsDir(), options) var pkg: PackageInfo if pkgs.findPkg(("nimble", newVRAny()), pkg): let pkgDir = pkg.getRealDir() if fileExists(pkgDir / "nimblepkg" / "nimscriptapi.nim"): result = pkgDir - inPath = true - - if not inPath: - raise newException(NimbleError, "Cannot find nimscriptapi.nim") proc getNimPrefixDir(): string = splitPath(findExe("nim")).head.parentDir @@ -208,7 +205,16 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) = # Ensure that "nimblepkg/nimscriptapi" is in the PATH. let nimscriptApiPath = findNimscriptApi(options) - appendStr(searchPaths, nimscriptApiPath) + if nimscriptApiPath.len > 0: + echo("Using custom nimscriptapi.nim defined in ", + nimscriptApiPath / "nimblepkg") + appendStr(searchPaths, nimscriptApiPath) + else: + let tmpNimscriptApiPath = getTempDir() / "nimblepkg" / "nimscriptapi.nim" + createDir(tmpNimscriptApiPath.splitFile.dir) + if not existsFile(tmpNimscriptApiPath): + writeFile(tmpNimscriptApiPath, nimscriptApi) + appendStr(searchPaths, getTempDir()) setDefaultLibpath() passes.gIncludeFile = includeModule From 0564cb238a902506d0d14aa3f4fd3ef74ba0521c Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 8 Oct 2016 20:51:19 +0200 Subject: [PATCH 04/12] Fixes #129. --- src/nimblepkg/download.nim | 11 ++++------- tests/tester.nim | 4 ++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/nimblepkg/download.nim b/src/nimblepkg/download.nim index 1310886..5e6506f 100644 --- a/src/nimblepkg/download.nim +++ b/src/nimblepkg/download.nim @@ -174,13 +174,10 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange, if verRange.spe == newSpecial(getHeadName(downMethod)): doClone(downMethod, url, downloadDir) # Grab HEAD. else: - # Mercurial requies a clone and checkout. The git clone operation is - # already fragmented into multiple steps so we just call doClone(). - if downMethod == DownloadMethod.git: - doClone(downMethod, url, downloadDir, $verRange.spe) - else: - doClone(downMethod, url, downloadDir, tip = false) - doCheckout(downMethod, downloadDir, $verRange.spe) + # Grab the full repo. + doClone(downMethod, url, downloadDir, tip = false) + # Then perform a checkout operation to get the specified branch/commit. + doCheckout(downMethod, downloadDir, $verRange.spe) result = verRange else: case downMethod diff --git a/tests/tester.nim b/tests/tester.nim index 3f5a51d..3aa669d 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -22,6 +22,10 @@ proc inLines(lines: seq[string], line: string): bool = for i in lines: if line.normalize in i.normalize: return true +test "issue 129 (installing commit hash)": + check execCmdEx(path & " install -y \"https://github.com/nimble-test/packagea.git@#1f9cb289c89\""). + exitCode == QuitSuccess + test "issue 113 (uninstallation problems)": cd "issue113/c": check execCmdEx("../../" & path & " install -y").exitCode == QuitSuccess From ec5b00318cde86e41048f856d130da472c54906e Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 8 Oct 2016 20:54:08 +0200 Subject: [PATCH 05/12] Revert "Fixed cygwin stub" This reverts commit 5aa4752b153ab3b74934a49ada424dd16bcb8c6a. Refs #235. --- src/nimble.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nimble.nim b/src/nimble.nim index f8d971c..e584839 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -471,7 +471,7 @@ proc installFromDir(dir: string, latest: bool, options: Options, # For bash on Windows (Cygwin/Git bash). let bashDest = dest.changeFileExt("") echo("Creating Cygwin stub: ", pkgDestDir / bin, " -> ", bashDest) - writeFile(bashDest, "\"$(cygpath '" & pkgDestDir / bin & "')\" \"$@\"\l") + writeFile(bashDest, "\"" & pkgDestDir / bin & "\" \"$@\"\n") else: {.error: "Sorry, your platform is not supported.".} else: From b0737ada9bfad90a49975dcd7c71d60fd3674d4c Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 8 Oct 2016 21:13:49 +0200 Subject: [PATCH 06/12] Fixes #186. --- src/nimblepkg/nimscriptsupport.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index 092d021..7f5e699 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -8,7 +8,7 @@ import compiler/ast, compiler/modules, compiler/passes, compiler/passaux, compiler/condsyms, compiler/sem, compiler/semdata, compiler/llstream, compiler/vm, compiler/vmdef, compiler/commands, - compiler/msgs, compiler/magicsys, compiler/lists + compiler/msgs, compiler/magicsys, compiler/lists, compiler/nimconf from compiler/scriptconfig import setupVM from compiler/idents import getIdent @@ -216,10 +216,10 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) = writeFile(tmpNimscriptApiPath, nimscriptApi) appendStr(searchPaths, getTempDir()) - setDefaultLibpath() + initDefines() + loadConfigs(DefaultConfig) passes.gIncludeFile = includeModule passes.gImportModule = importModule - initDefines() defineSymbol("nimscript") defineSymbol("nimconfig") From df5b9b8c78d66d8386902bf209b3711d969677dc Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 9 Oct 2016 14:55:21 +0200 Subject: [PATCH 07/12] Small improvements to readme. --- readme.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.markdown b/readme.markdown index e897314..12c6cd3 100644 --- a/readme.markdown +++ b/readme.markdown @@ -97,6 +97,10 @@ src/nimble install compilation to something else like ``nimble1.exe``, then run ``src\nimble1.exe install``. +This will install Nimble to the default Nimble packages location: +``~/.nimble/pkgs``. The binary will be installed to ``~/.nimble/bin``, so you +will need to add this directory to your PATH. + ## Nimble's folder structure and packages Nimble stores everything that has been installed in ``~/.nimble`` on Unix systems From 65dbd97269f1a058f41551880415f28dfdbb3aaa Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 9 Oct 2016 15:19:42 +0200 Subject: [PATCH 08/12] Moves nimbleVersion to common.nim and uses it in .nimble file. --- src/nimble.nim | 5 +--- src/nimblepkg/common.nim | 40 ++++++++++++++++++++++++++++++ src/nimblepkg/config.nim | 2 +- src/nimblepkg/download.nim | 2 +- src/nimblepkg/nimbletypes.nim | 36 --------------------------- src/nimblepkg/nimscriptsupport.nim | 2 +- src/nimblepkg/options.nim | 2 +- src/nimblepkg/packageinfo.nim | 2 +- src/nimblepkg/packageparser.nim | 2 +- src/nimblepkg/publish.nim | 2 +- src/nimblepkg/tools.nim | 2 +- 11 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 src/nimblepkg/common.nim delete mode 100644 src/nimblepkg/nimbletypes.nim diff --git a/src/nimble.nim b/src/nimble.nim index e584839..2a7c04f 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -7,7 +7,7 @@ import httpclient, parseopt, os, strutils, osproc, pegs, tables, parseutils, from sequtils import toSeq import nimblepkg/packageinfo, nimblepkg/version, nimblepkg/tools, - nimblepkg/download, nimblepkg/config, nimblepkg/nimbletypes, + nimblepkg/download, nimblepkg/config, nimblepkg/common, nimblepkg/publish, nimblepkg/options, nimblepkg/packageparser import nimblepkg/nimscriptsupport @@ -30,9 +30,6 @@ else: proc GetVersionExA*(VersionInformation: var OSVERSIONINFO): WINBOOL{.stdcall, dynlib: "kernel32", importc: "GetVersionExA".} -const - nimbleVersion = "0.7.8" - proc writeVersion() = echo("nimble v$# compiled at $# $#" % [nimbleVersion, CompileDate, CompileTime]) diff --git a/src/nimblepkg/common.nim b/src/nimblepkg/common.nim new file mode 100644 index 0000000..1348d58 --- /dev/null +++ b/src/nimblepkg/common.nim @@ -0,0 +1,40 @@ +# BSD License. Look at license.txt for more info. +# +# Various miscellaneous common types reside here, to avoid problems with +# recursive imports + +when not defined(nimscript): + import sets + + import version + export version.NimbleError + + type + BuildFailed* = object of NimbleError + + PackageInfo* = object + mypath*: string ## The path of this .nimble file + isNimScript*: bool ## Determines if this pkg info was read from a nims file + isMinimal*: bool + isInstalled*: bool ## Determines if the pkg this info belongs to is installed + postHooks*: HashSet[string] ## Useful to know so that Nimble doesn't execHook unnecessarily + preHooks*: HashSet[string] + name*: string + version*: string + author*: string + description*: string + license*: string + skipDirs*: seq[string] + skipFiles*: seq[string] + skipExt*: seq[string] + installDirs*: seq[string] + installFiles*: seq[string] + installExt*: seq[string] + requires*: seq[PkgTuple] + bin*: seq[string] + binDir*: string + srcDir*: string + backend*: string + +const + nimbleVersion* = "0.7.8" diff --git a/src/nimblepkg/config.nim b/src/nimblepkg/config.nim index d9852fd..dbd1513 100644 --- a/src/nimblepkg/config.nim +++ b/src/nimblepkg/config.nim @@ -2,7 +2,7 @@ # BSD License. Look at license.txt for more info. import parsecfg, streams, strutils, os, tables, Uri -import tools, version, nimbletypes +import tools, version, common type Config* = object diff --git a/src/nimblepkg/download.nim b/src/nimblepkg/download.nim index 5e6506f..5ce58b4 100644 --- a/src/nimblepkg/download.nim +++ b/src/nimblepkg/download.nim @@ -3,7 +3,7 @@ import parseutils, os, osproc, strutils, tables, pegs -import packageinfo, packageparser, version, tools, nimbletypes, options +import packageinfo, packageparser, version, tools, common, options type DownloadMethod* {.pure.} = enum diff --git a/src/nimblepkg/nimbletypes.nim b/src/nimblepkg/nimbletypes.nim deleted file mode 100644 index ae6ec47..0000000 --- a/src/nimblepkg/nimbletypes.nim +++ /dev/null @@ -1,36 +0,0 @@ -# BSD License. Look at license.txt for more info. -# -# Various miscellaneous common types reside here, to avoid problems with -# recursive imports - -import sets - -import version -export version.NimbleError - -type - BuildFailed* = object of NimbleError - - PackageInfo* = object - mypath*: string ## The path of this .nimble file - isNimScript*: bool ## Determines if this pkg info was read from a nims file - isMinimal*: bool - isInstalled*: bool ## Determines if the pkg this info belongs to is installed - postHooks*: HashSet[string] ## Useful to know so that Nimble doesn't execHook unnecessarily - preHooks*: HashSet[string] - name*: string - version*: string - author*: string - description*: string - license*: string - skipDirs*: seq[string] - skipFiles*: seq[string] - skipExt*: seq[string] - installDirs*: seq[string] - installFiles*: seq[string] - installExt*: seq[string] - requires*: seq[PkgTuple] - bin*: seq[string] - binDir*: string - srcDir*: string - backend*: string diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index 7f5e699..c5e7b4a 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -15,7 +15,7 @@ from compiler/idents import getIdent from compiler/astalgo import strTableGet import compiler/options as compiler_options -import nimbletypes, version, options, packageinfo +import common, version, options, packageinfo import os, strutils, strtabs, times, osproc, sets type diff --git a/src/nimblepkg/options.nim b/src/nimblepkg/options.nim index e67815c..f1e9805 100644 --- a/src/nimblepkg/options.nim +++ b/src/nimblepkg/options.nim @@ -4,7 +4,7 @@ import json, strutils, os, parseopt, strtabs, uri, tables from httpclient import Proxy, newProxy -import config, version, tools, nimbletypes +import config, version, tools, common type Options* = object diff --git a/src/nimblepkg/packageinfo.nim b/src/nimblepkg/packageinfo.nim index 5c07957..4fe5cca 100644 --- a/src/nimblepkg/packageinfo.nim +++ b/src/nimblepkg/packageinfo.nim @@ -1,7 +1,7 @@ # Copyright (C) Dominik Picheta. All rights reserved. # BSD License. Look at license.txt for more info. import parsecfg, json, streams, strutils, parseutils, os, sets, tables -import version, tools, nimbletypes, options +import version, tools, common, options type Package* = object diff --git a/src/nimblepkg/packageparser.nim b/src/nimblepkg/packageparser.nim index cf641a9..c6259d4 100644 --- a/src/nimblepkg/packageparser.nim +++ b/src/nimblepkg/packageparser.nim @@ -1,7 +1,7 @@ # Copyright (C) Dominik Picheta. All rights reserved. # BSD License. Look at license.txt for more info. import parsecfg, json, streams, strutils, parseutils, os, tables -import version, tools, nimbletypes, nimscriptsupport, options, packageinfo +import version, tools, common, nimscriptsupport, options, packageinfo ## Contains procedures for parsing .nimble files. Moved here from ``packageinfo`` ## because it depends on ``nimscriptsupport`` (``nimscriptsupport`` also diff --git a/src/nimblepkg/publish.nim b/src/nimblepkg/publish.nim index e831c9d..e7fa836 100644 --- a/src/nimblepkg/publish.nim +++ b/src/nimblepkg/publish.nim @@ -5,7 +5,7 @@ ## nim-lang/packages automatically. import httpclient, base64, strutils, rdstdin, json, os, browsers, times, uri -import tools, nimbletypes +import tools, common type Auth = object diff --git a/src/nimblepkg/tools.nim b/src/nimblepkg/tools.nim index 7e2989f..65c6f8d 100644 --- a/src/nimblepkg/tools.nim +++ b/src/nimblepkg/tools.nim @@ -3,7 +3,7 @@ # # Various miscellaneous utility functions reside here. import osproc, pegs, strutils, os, uri, sets, json, parseutils -import version, packageinfo, nimbletypes +import version, packageinfo, common proc extractBin(cmd: string): string = if cmd[0] == '"': From 1be5c052ae3e95ef8fdc745617e1f23b88ad839a Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 9 Oct 2016 15:20:31 +0200 Subject: [PATCH 09/12] Version 0.7.10. --- changelog.markdown | 22 ++++++++++++++++++++++ nimble.nimble | 3 ++- src/nimblepkg/common.nim | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/changelog.markdown b/changelog.markdown index f40f584..f038524 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,5 +1,27 @@ + +[comment]: # (Before releasing, make sure to follow the steps in https://github.com/nim-lang/nimble/wiki/Releasing-a-new-version) + # Nimble changelog +## 0.7.10 - 09/10/2016 + +This release includes multiple bug fixes. + +* Reverted patch that breaks binary stubs in Git Bash on Windows. +* The ``nimscriptapi.nim`` file is now statically compiled into the binary. + This should fix the "could not find nimscriptapi.nim" errors. The file can + still be overriden by placing a file named ``nimscriptapi.nim`` inside a + ``nimblepkg`` directory that is placed alongside the Nimble binary, or + by a ``nimscriptapi.nim`` file inside ``~/.nimble/pkgs/nimble-ver/nimblepkg/``. + For more information see the + [code that looks for this file](https://github.com/nim-lang/nimble/blob/v0.7.10/src/nimblepkg/nimscriptsupport.nim#L176). +* Nim files can now be imported in .nimble nimscript files. (Issue [#186](https://github.com/nim-lang/nimble/issues/186)) +* Requiring a specific git commit hash no longer fails. (Issue [#129](https://github.com/nim-lang/nimble/issues/129)) + +---- + +Full changelog: https://github.com/nim-lang/nimble/compare/v0.7.8...v0.7.10 + ## 0.7.8 - 28/09/2016 This is a hotfix release which fixes crashes when Nimble (or Nim) is installed diff --git a/nimble.nimble b/nimble.nimble index 973b86a..99431ac 100644 --- a/nimble.nimble +++ b/nimble.nimble @@ -1,6 +1,7 @@ +import src/nimblepkg/common # Package -version = "0.7.8" +version = nimbleVersion author = "Dominik Picheta" description = "Nim package manager." license = "BSD" diff --git a/src/nimblepkg/common.nim b/src/nimblepkg/common.nim index 1348d58..417ff29 100644 --- a/src/nimblepkg/common.nim +++ b/src/nimblepkg/common.nim @@ -37,4 +37,4 @@ when not defined(nimscript): backend*: string const - nimbleVersion* = "0.7.8" + nimbleVersion* = "0.7.10" From 2eec3917324dcf464527ab477a72a0a2a85ea9e7 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 26 Oct 2016 20:10:17 +0200 Subject: [PATCH 10/12] Fixes getInstalledPkgs returning minimal package information. This was introduced in commit https://github.com/nim-lang/nimble/commit/2cf03313fdd38121f6d3f406ad76d3c03cd9b6a5. --- src/nimble.nim | 1 + src/nimblepkg/packageparser.nim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nimble.nim b/src/nimble.nim index 2a7c04f..fbe605f 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -255,6 +255,7 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[string] = ## ## Returns the list of paths to pass to the compiler during build phase. result = @[] + assert(not pkginfo.isMinimal, "processDeps needs pkginfo.requires") let pkglist = getInstalledPkgs(options.getPkgsDir(), options) var reverseDeps: seq[tuple[name, version: string]] = @[] for dep in pkginfo.requires: diff --git a/src/nimblepkg/packageparser.nim b/src/nimblepkg/packageparser.nim index c6259d4..fbe8cfc 100644 --- a/src/nimblepkg/packageparser.nim +++ b/src/nimblepkg/packageparser.nim @@ -250,7 +250,7 @@ proc getInstalledPkgs*(libsDir: string, options: Options): if nimbleFile != "": let meta = readMetaData(path) try: - var pkg = readPackageInfo(nimbleFile, options, true) + var pkg = readPackageInfo(nimbleFile, options, onlyMinimalInfo=false) pkg.isInstalled = true result.add((pkg, meta)) except ValidationError: From d854bc64c85645f38e0133663c06c996df96f7dc Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 26 Oct 2016 20:16:35 +0200 Subject: [PATCH 11/12] Fix import inside nimble.nimble when Nimble is installed. --- nimble.nimble | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nimble.nimble b/nimble.nimble index 99431ac..7b3917a 100644 --- a/nimble.nimble +++ b/nimble.nimble @@ -1,4 +1,10 @@ -import src/nimblepkg/common +when dirExists("src"): + # In the git repository the Nimble sources are in a ``src`` directory. + import src/nimblepkg/common +else: + # When the package is installed, the ``src`` directory disappears. + import nimblepkg/common + # Package version = nimbleVersion From 06b942680b5c335b8f3487fe5d152441a92cbfb2 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 26 Oct 2016 21:14:18 +0200 Subject: [PATCH 12/12] Remove spammy message about nimscriptapi.nim. --- src/nimblepkg/nimscriptsupport.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index c5e7b4a..129e06a 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -206,8 +206,7 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) = # Ensure that "nimblepkg/nimscriptapi" is in the PATH. let nimscriptApiPath = findNimscriptApi(options) if nimscriptApiPath.len > 0: - echo("Using custom nimscriptapi.nim defined in ", - nimscriptApiPath / "nimblepkg") + # TODO: Once better output is implemented show a message here. appendStr(searchPaths, nimscriptApiPath) else: let tmpNimscriptApiPath = getTempDir() / "nimblepkg" / "nimscriptapi.nim"