Moves nimbleVersion to common.nim and uses it in .nimble file.

This commit is contained in:
Dominik Picheta 2016-10-09 15:19:42 +02:00
commit 65dbd97269
11 changed files with 49 additions and 48 deletions

View file

@ -7,7 +7,7 @@ import httpclient, parseopt, os, strutils, osproc, pegs, tables, parseutils,
from sequtils import toSeq from sequtils import toSeq
import nimblepkg/packageinfo, nimblepkg/version, nimblepkg/tools, 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 nimblepkg/publish, nimblepkg/options, nimblepkg/packageparser
import nimblepkg/nimscriptsupport import nimblepkg/nimscriptsupport
@ -30,9 +30,6 @@ else:
proc GetVersionExA*(VersionInformation: var OSVERSIONINFO): WINBOOL{.stdcall, proc GetVersionExA*(VersionInformation: var OSVERSIONINFO): WINBOOL{.stdcall,
dynlib: "kernel32", importc: "GetVersionExA".} dynlib: "kernel32", importc: "GetVersionExA".}
const
nimbleVersion = "0.7.8"
proc writeVersion() = proc writeVersion() =
echo("nimble v$# compiled at $# $#" % echo("nimble v$# compiled at $# $#" %
[nimbleVersion, CompileDate, CompileTime]) [nimbleVersion, CompileDate, CompileTime])

40
src/nimblepkg/common.nim Normal file
View file

@ -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"

View file

@ -2,7 +2,7 @@
# BSD License. Look at license.txt for more info. # BSD License. Look at license.txt for more info.
import parsecfg, streams, strutils, os, tables, Uri import parsecfg, streams, strutils, os, tables, Uri
import tools, version, nimbletypes import tools, version, common
type type
Config* = object Config* = object

View file

@ -3,7 +3,7 @@
import parseutils, os, osproc, strutils, tables, pegs import parseutils, os, osproc, strutils, tables, pegs
import packageinfo, packageparser, version, tools, nimbletypes, options import packageinfo, packageparser, version, tools, common, options
type type
DownloadMethod* {.pure.} = enum DownloadMethod* {.pure.} = enum

View file

@ -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

View file

@ -15,7 +15,7 @@ from compiler/idents import getIdent
from compiler/astalgo import strTableGet from compiler/astalgo import strTableGet
import compiler/options as compiler_options import compiler/options as compiler_options
import nimbletypes, version, options, packageinfo import common, version, options, packageinfo
import os, strutils, strtabs, times, osproc, sets import os, strutils, strtabs, times, osproc, sets
type type

View file

@ -4,7 +4,7 @@
import json, strutils, os, parseopt, strtabs, uri, tables import json, strutils, os, parseopt, strtabs, uri, tables
from httpclient import Proxy, newProxy from httpclient import Proxy, newProxy
import config, version, tools, nimbletypes import config, version, tools, common
type type
Options* = object Options* = object

View file

@ -1,7 +1,7 @@
# Copyright (C) Dominik Picheta. All rights reserved. # Copyright (C) Dominik Picheta. All rights reserved.
# BSD License. Look at license.txt for more info. # BSD License. Look at license.txt for more info.
import parsecfg, json, streams, strutils, parseutils, os, sets, tables import parsecfg, json, streams, strutils, parseutils, os, sets, tables
import version, tools, nimbletypes, options import version, tools, common, options
type type
Package* = object Package* = object

View file

@ -1,7 +1,7 @@
# Copyright (C) Dominik Picheta. All rights reserved. # Copyright (C) Dominik Picheta. All rights reserved.
# BSD License. Look at license.txt for more info. # BSD License. Look at license.txt for more info.
import parsecfg, json, streams, strutils, parseutils, os, tables 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`` ## Contains procedures for parsing .nimble files. Moved here from ``packageinfo``
## because it depends on ``nimscriptsupport`` (``nimscriptsupport`` also ## because it depends on ``nimscriptsupport`` (``nimscriptsupport`` also

View file

@ -5,7 +5,7 @@
## nim-lang/packages automatically. ## nim-lang/packages automatically.
import httpclient, base64, strutils, rdstdin, json, os, browsers, times, uri import httpclient, base64, strutils, rdstdin, json, os, browsers, times, uri
import tools, nimbletypes import tools, common
type type
Auth = object Auth = object

View file

@ -3,7 +3,7 @@
# #
# Various miscellaneous utility functions reside here. # Various miscellaneous utility functions reside here.
import osproc, pegs, strutils, os, uri, sets, json, parseutils import osproc, pegs, strutils, os, uri, sets, json, parseutils
import version, packageinfo, nimbletypes import version, packageinfo, common
proc extractBin(cmd: string): string = proc extractBin(cmd: string): string =
if cmd[0] == '"': if cmd[0] == '"':