Add update-copyright as a submodule and update release.py accordingly.
authorW. Trevor King <wking@drexel.edu>
Thu, 16 Feb 2012 21:15:24 +0000 (16:15 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 16 Feb 2012 21:43:50 +0000 (16:43 -0500)
Also add `**kwargs` to `invoke` so we can specify the environment.

.gitmodules [new file with mode: 0644]
libbe/util/subproc.py
release.py
update-copyright [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..5bbe5ed
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "update-copyright"]
+       path = update-copyright
+       url = git://gitorious.org/update-copyright/wtk.git
index 2c45f0c7899f68ec041dac5545e0f713deeba0c8..3a66f49d99849cbc3e5ef2bfa5e8a06ca1d4836a 100644 (file)
@@ -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)
index 74648714428d932698f9e0766645866f11cd61cf..90812fd3d736a888bd811cbfb9d5293cb4bc0670 100755 (executable)
@@ -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 (submodule)
index 0000000..1e0bb15
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 1e0bb15fbf0be2d440e5d1dbbaa82562c9f918b0