From 21286ccdbbf4c8853545392df087244fc8510293 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 16 Feb 2012 16:15:24 -0500 Subject: [PATCH] Add update-copyright as a submodule and update release.py accordingly. Also add `**kwargs` to `invoke` so we can specify the environment. --- .gitmodules | 3 +++ libbe/util/subproc.py | 6 +++--- release.py | 10 +++++++++- update-copyright | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 160000 update-copyright diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5bbe5ed --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "update-copyright"] + path = update-copyright + url = git://gitorious.org/update-copyright/wtk.git diff --git a/libbe/util/subproc.py b/libbe/util/subproc.py index 2c45f0c..3a66f49 100644 --- a/libbe/util/subproc.py +++ b/libbe/util/subproc.py @@ -48,7 +48,7 @@ class CommandError(Exception): def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,), cwd=None, shell=None, unicode_output=True, verbose=False, - encoding=None): + encoding=None, **kwargs): """ expect should be a tuple of allowed exit codes. cwd should be the directory from which the command will be executed. When @@ -70,14 +70,14 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,), if shell is None: shell = False q = Popen(args, stdin=PIPE, stdout=stdout, stderr=stderr, - shell=shell, cwd=cwd) + shell=shell, cwd=cwd, **kwargs) else: assert _MSWINDOWS==True, 'invalid platform' if shell is None: shell = True # win32 don't have os.execvp() so have to run command in a shell q = Popen(args, stdin=PIPE, stdout=stdout, stderr=stderr, - shell=shell, cwd=cwd) + shell=shell, cwd=cwd, **kwargs) except OSError, e: raise CommandError(list_args, status=e.args[0], stderr=e) stdout,stderr = q.communicate(input=stdin) diff --git a/release.py b/release.py index 7464871..90812fd 100755 --- a/release.py +++ b/release.py @@ -180,7 +180,15 @@ If you don't like what got committed, you can undo the release with sys.exit(1) set_release_version(_tag) print "Update copyright information..." - status,stdout,stderr = invoke(['update-copyright.py']) + env = dict(os.environ) + pythonpath = os.path.abspath('update-copyright') + if 'PYTHONPATH' in env: + env['PYTHONPATH'] = '{}:{}'.format(pythonpath, env['PYTHONPATH']) + else: + env['PYTHONPATH'] = pythonpath + status,stdout,stderr = invoke([ + os.path.join('update-copyright', 'bin', 'update-copyright.py')], + env=env) commit("Bumped to version %s" % _tag) tag(_tag) create_tarball(_tag) diff --git a/update-copyright b/update-copyright new file mode 160000 index 0000000..1e0bb15 --- /dev/null +++ b/update-copyright @@ -0,0 +1 @@ +Subproject commit 1e0bb15fbf0be2d440e5d1dbbaa82562c9f918b0 -- 2.26.2