diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2008-07-26 11:26:15 +0200 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2008-07-26 11:26:15 +0200 |
commit | 7a90533a806fd76e89795fff427473e7264662f7 (patch) | |
tree | 7bcf5c2f4455887a9786bdb60708126ef936329b /src/nbblib/main.py | |
parent | 37ee99e8e72e2b8c50bec80f9b2bacc8dde04df7 (diff) | |
download | nbb-releases.tar.gz nbb-releases.tar.xz nbb-releases.zip |
nbb 0.2releases
* Switch to release tags including the package name
* Make automake's "nbb make" depend on configure etc.
Squashed commit of the following:
commit 9c4a035b71c7648b006b91a52e86edb2baea5138
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Sat Jul 26 10:36:31 2008 +0200
New version tag syntax: "make tag VER=1.2"
commit fefebc702664a683ceeafa800b0fe75178d63037
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Sat Jul 26 10:30:02 2008 +0200
Switch to release tags including the package name
This will reduce tag confusion when we fork into a
different project.
A tag like nbb-1.2 or foo-tools-1.2 is much more useful
than v1.2.
commit 330c382390ffbe3c361a763d5cee6febe1b30f5e
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Tue Jul 22 12:08:41 2008 +0200
Remove obsolete .htaccess file
commit b1d5fc06e235a45561bf53b4bfd07856cec4ea81
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Thu Jul 24 15:03:14 2008 +0200
Make automake's "make" command depend on configure
commit 958e81655ad143dfd54b099637db60db42f77fb0
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Thu Jul 24 15:00:33 2008 +0200
Adjust testcases for absolute builddirs
When configure is called as /path/to/configure instead of
../path/to/configure, the ".git/" test directories are reported
by "git init" using absolute pathnames, not must ".git/".
commit 72dac191283299c66356dc895eb6ba19982b16ab
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Thu Jul 24 14:59:19 2008 +0200
Fix typo in automake/distcheck test case
commit 7ca2e00188d8668b6b1f4116559ddae4e3cbb35c
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Thu Jul 24 13:32:49 2008 +0200
Open 0.1.x section in NEWS
commit e05a138e9e3099455fa23799550949512188b3c9
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Tue Jul 22 08:40:31 2008 +0200
Add license review to TODO
commit e2fd1f2e101486859899049147df7993c8042df7
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Sat Jul 19 00:25:12 2008 +0200
Ensure cmp/mv/rm rules are correct and silent
Make sure the "if cmp ... mv .. rm" in make rules are
correct and useful, and the cmp is silent.
commit b6e7a354ed1ab53aebdb775a800156629744a065
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Wed Jul 16 21:03:36 2008 +0200
Reflect code progress in TODO file, add plans
commit 9559ceb5def8ec5d2e5674e7bf25b484877b3e60
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Wed Jul 16 06:12:30 2008 +0200
Fix some issues found by pylint/pychecker
Includes real issues like wrong argument numbers and missing
ancestor __init__() calls, whitespace and comment cleanups.
Cannot "fix" everything because of a good amount of the warnings
raised by pylint/pychecker are false alarms.
commit c73487455e8d9a283fcb328eab8573c4c5bc73c7
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Wed Jul 16 06:11:57 2008 +0200
Add pylint and pychecker checks as "lint" target
Diffstat (limited to 'src/nbblib/main.py')
-rw-r--r-- | src/nbblib/main.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/nbblib/main.py b/src/nbblib/main.py index fe4b304..524936f 100644 --- a/src/nbblib/main.py +++ b/src/nbblib/main.py @@ -7,13 +7,13 @@ nbb (ndim's branch builder) %(PACKAGE_VERSION)s Build, install given branch of source code into a branch specific place Copyright (C) 2007, 2008 Hans Ulrich Niedermann <hun@n-dimensional.de> -TBA: License conditions +TODO: License conditions Usage: %(prog)s [general options] <command> [command specific options] Features: * supports git branches - * supports bzr branches (requires useful branch nick, TBD: bzr config ?) + * supports bzr branches (requires useful branch nick, TODO: bzr config ?) * does out-of-source-tree builds (in-source-tree-builds unsupported) * direct support for automake/autoconf based build systems @@ -40,7 +40,7 @@ Command line interface (implemeted): $ %(prog)s [general options] run [--builddir] <command> [<param>...] $ %(prog)s [general options] run --installdir <command> [<param>...] -TBD: Command line interface: +TODO: Command line interface: Run cleanup commands: $ %(prog)s [general options] purge [command specific options] @@ -49,7 +49,7 @@ TBD: Command line interface: --installdir-only $ %(prog)s [general options] purge-all # either this $ %(prog)s [general options] purge --all # or that - TBD: 'make clean', 'make distclean' and similar stuff? + TODO: 'make clean', 'make distclean' and similar stuff? Global options: @@ -76,19 +76,23 @@ from nbblib import progutils def print_version(context): + """print nbb version""" print "%(prog)s (ndim's branch builder) %(PACKAGE_VERSION)s" % context def print_help(context): + """print general nbb help text""" print __doc__ % context, class PropertySetAgainError(Exception): + """To be raised in case of setting a property for the second time""" def __str__(self): return "Property cannot be set more than once" class InvalidPropertyValue(Exception): + """To be raised when the value assigned to a property is invalid""" def __init__(self, value): super(InvalidPropertyValue, self).__init__() self.value = value @@ -97,6 +101,7 @@ class InvalidPropertyValue(Exception): class Property(object): + """Context property base class for command line context""" def __init__(self, *args, **kwargs): assert(len(args) == 0) if 'default' in kwargs: @@ -123,7 +128,8 @@ class Property(object): setattr(instance, self.name, self.convert(value)) def __str__(self): if hasattr(self, 'default'): - return '<property %s defaulting to %s>' % (self.__class__.__name, self.default) + return '<property %s defaulting to %s>' \ + % (self.__class__.__name__, self.default) else: return '<property %s>' % (self.__class__.__name__) def isvalid(self, value): @@ -187,10 +193,9 @@ class Context(object): def __str__(self): kk = [x for x in dir(self) if (x.find('__') < 0) and (x.find('--') < 0)] kk.sort() - lll = ( (k, getattr(self,k)) for k in kk ) - return "%s(%s)" % (self.__class__.__name__, - ", ".join(("%s=%s" % (a,repr(c)) - for a,c in lll))) + lll = ( (k, getattr(self, k)) for k in kk ) + it = ( "%s=%s" % (a, repr(c)) for a, c in lll ) + return "%s(%s)" % (self.__class__.__name__, ", ".join(it)) def main(argv): @@ -205,7 +210,7 @@ def main(argv): "%(prog)s requires some arguments" % context) i = 1 - while i<len(argv): + while i < len(argv): if argv[i][0] != '-': break elif argv[i] in ('-h', '--help'): @@ -218,13 +223,13 @@ def main(argv): context.dry_run = True elif argv[i] in ('-b', '--build-system'): i = i + 1 - assert(i<len(argv)) + assert(i < len(argv)) context.bs = argv[i] elif argv[i][:15] == '--build-system=': context.bs = argv[i][6:] elif argv[i] in ('-v', '--vcs'): i = i + 1 - assert(i<len(argv)) + assert(i < len(argv)) context.vcs = argv[i] elif argv[i][:6] == '--vcs=': context.vcs = argv[i][6:] |