From b3b4c6343f5cf2f988d939d54797a3301dadcc81 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 23 Dec 2016 16:01:10 +0100 Subject: [PATCH] moved new feature to separate 'distros.nim' module --- src/nimble.nim | 4 ++ src/nimblepkg/common.nim | 1 + src/nimblepkg/distros.nim | 59 ++++++++++++++++++++++++++++++ src/nimblepkg/nimscriptapi.nim | 58 ++--------------------------- src/nimblepkg/nimscriptsupport.nim | 42 +++++++++++++++------ src/nimblepkg/packageinfo.nim | 1 + 6 files changed, 99 insertions(+), 66 deletions(-) create mode 100644 src/nimblepkg/distros.nim diff --git a/src/nimble.nim b/src/nimble.nim index a4d3bdb..e108070 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -939,6 +939,10 @@ proc doAction(options: Options) = let (_, pkgInfo) = install(options.action.packages, options) if options.action.packages.len == 0: nimScriptHint(pkgInfo) + if pkgInfo.foreignDeps.len > 0: + echo("To finish the installation, run: ") + for i in 0.. 0: raise newException(NimbleError, previousMsg) # Extract all the necessary fields populated by the nimscript file. - proc getSym(thisModule: PSym, ident: string): PSym = - result = thisModule.tab.strTableGet(getIdent(ident)) + proc getSym(apiModule: PSym, ident: string): PSym = + result = apiModule.tab.strTableGet(getIdent(ident)) if result.isNil: raise newException(NimbleError, "Ident not found: " & ident) template trivialField(field) = - result.field = getGlobal(getSym(thisModule, astToStr field)) + result.field = getGlobal(getSym(apiModule, astToStr field)) template trivialFieldSeq(field) = - result.field.add getGlobalAsSeq(getSym(thisModule, astToStr field)) + result.field.add getGlobalAsSeq(getSym(apiModule, astToStr field)) # keep reasonable default: - let name = getGlobal(thisModule.tab.strTableGet(getIdent"packageName")) + let name = getGlobal(apiModule.tab.strTableGet(getIdent"packageName")) if name.len > 0: result.name = name trivialField version @@ -333,14 +352,15 @@ proc readPackageInfoFromNims*(scriptName: string, options: Options, trivialFieldSeq installDirs trivialFieldSeq installFiles trivialFieldSeq installExt + trivialFieldSeq foreignDeps - extractRequires(getSym(thisModule, "requiresData"), result.requires) + extractRequires(getSym(apiModule, "requiresData"), result.requires) - let binSeq = getGlobalAsSeq(getSym(thisModule, "bin")) + let binSeq = getGlobalAsSeq(getSym(apiModule, "bin")) for i in binSeq: result.bin.add(i.addFileExt(ExeExt)) - let backend = getGlobal(getSym(thisModule, "backend")) + let backend = getGlobal(getSym(apiModule, "backend")) if backend.len == 0: result.backend = "c" elif cmpIgnoreStyle(backend, "javascript") == 0: diff --git a/src/nimblepkg/packageinfo.nim b/src/nimblepkg/packageinfo.nim index c4e5498..bf2802f 100644 --- a/src/nimblepkg/packageinfo.nim +++ b/src/nimblepkg/packageinfo.nim @@ -37,6 +37,7 @@ proc initPackageInfo*(path: string): PackageInfo = result.installFiles = @[] result.installExt = @[] result.requires = @[] + result.foreignDeps = @[] result.bin = @[] result.srcDir = "" result.binDir = ""