From 9f60514c40c14b1a94a5ff258bbad12bee6ae1d6 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 26 Jun 2013 14:59:04 +0100 Subject: [PATCH] Changed package install dir to $babelDir/pkgs. --- babel.nim | 16 ++++++---------- readme.markdown | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/babel.nim b/babel.nim index 5130a97..150fa69 100644 --- a/babel.nim +++ b/babel.nim @@ -94,7 +94,7 @@ proc prompt(question: string): bool = return false let babelDir = getHomeDir() / ".babel" -let libsDir = babelDir / "libs" +let pkgsDir = babelDir / "pkgs" let binDir = babelDir / "bin" let nimVer = getNimrodVersion() @@ -166,7 +166,7 @@ proc processDeps(pkginfo: TPackageInfo): seq[string] = ## ## Returns the list of paths to pass to the compiler during build phase. result = @[] - let pkglist = getInstalledPkgs(libsDir) + let pkglist = getInstalledPkgs(pkgsDir) for dep in pkginfo.requires: if dep.name == "nimrod": if not withinRange(nimVer, dep.ver): @@ -196,7 +196,7 @@ proc installFromDir(dir: string, latest: bool): string = ## The return value of this function is used by ## ``processDeps`` to gather a list of paths to pass to the nimrod compiler. var pkgInfo = getPkgInfo(dir) - let pkgDestDir = libsDir / (pkgInfo.name & + let pkgDestDir = pkgsDir / (pkgInfo.name & (if latest: "" else: '-' & pkgInfo.version)) if existsDir(pkgDestDir): if not prompt(pkgInfo.name & " already exists. Overwrite?"): @@ -243,10 +243,6 @@ proc installFromDir(dir: string, latest: bool): string = echo(pkgInfo.name & " installed successfully.") - ## remove old unversioned directory - if not latest: - removeDir libsDir / pkgInfo.name - proc getTagsList(dir: string): seq[string] = cd dir: let output = execProcess("git tag") @@ -280,7 +276,7 @@ proc downloadPkg(pkg: TPackage, verRange: PVersionRange): string = doCmd("git clone --depth 1 " & pkg.url & " " & downloadDir) # TODO: Determine if version is a commit hash, if it is. Move the - # git repo to ``babelDir/libs``, then babel can simply checkout + # git repo to ``babelDir/pkgs``, then babel can simply checkout # the correct hash instead of constantly cloning and copying. # N.B. This may still partly be requires, as one lib may require hash A # whereas another lib requires hash B and they are both required by the @@ -379,8 +375,8 @@ proc doAction(action: TAction) = when isMainModule: if not existsDir(babelDir): createDir(babelDir) - if not existsDir(libsDir): - createDir(libsDir) + if not existsDir(pkgsDir): + createDir(pkgsDir) when defined(release): try: diff --git a/readme.markdown b/readme.markdown index 27dbf4e..2801033 100644 --- a/readme.markdown +++ b/readme.markdown @@ -8,7 +8,7 @@ Compiling it is as simple as ``nimrod c -d:release babel``. ## Babel's folder structure Babel stores everything that has been installed in ~/.babel on Unix systems and -in your $home/.babel on Windows. Libraries are stored in $babelDir/libs, and +in your $home/.babel on Windows. Libraries are stored in $babelDir/pkgs, and binaries are stored in $babelDir/bin. ## Packages @@ -24,7 +24,7 @@ the package's name. ### Libraries When babel installs a library it will copy all the files that it downloaded -into ``$babelDir/libs/pkgname-ver``. It's up to the package creator to make sure +into ``$babelDir/pkgs/pkgname-ver``. It's up to the package creator to make sure that the package directory layout is correct, this is so that users of the package can correctly import the package. @@ -86,7 +86,7 @@ bin = "main" ``` In this case when ``babel install`` is invoked, babel will build the ``main.nim`` -file, copy it into ``$babelDir/libs/pkgname-ver/`` and subsequently create a +file, copy it into ``$babelDir/pkgs/pkgname-ver/`` and subsequently create a symlink to the binary in ``$babelDir/bin/``. On Windows a stub .bat file is created instead.