changeset 49:85374a69cf89

call in foreground to avoid hang :(
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 10 May 2012 15:24:51 -0700
parents abfb267e8332
children daa35ff485c2
files paint/package.py
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/paint/package.py	Tue May 08 10:45:16 2012 -0700
+++ b/paint/package.py	Thu May 10 15:24:51 2012 -0700
@@ -30,6 +30,7 @@
 
     def __init__(self, src):
         self.src = src
+        self.verbose = True
 
         # ephemeral data
         self._tmppath = None
@@ -39,10 +40,14 @@
 
         # TODO: list of temporary files/directories to be deleted
 
+    def _log(self, message):
+        if self.verbose:
+            print '>>> %s' % message
+
     def _path(self):
         """filesystem path to package directory"""
 
-        print ">>> Getting path to package"
+        print ">>> _path:Getting path to package"
 
         # return cached copy if it exists
         if self._tmppath:
@@ -229,7 +234,9 @@
     def extension(self):
         """filename extension of the package"""
 
+        print ">>> extension:Getting package"
         package = self.package()
+        print ">>> extension:package=%s" % package
 
         # determine the extension (XXX hacky)
         extensions = ('.tar.gz', '.zip', '.tar.bz2')
@@ -243,10 +250,13 @@
         """
         repackage the package to ensure its actually in the right form
         and return the path to the destination
-        - destination: if given, path to put the build in [TODO]
+        - destination: if given, path to put the build in
         """
 
+        self._log("package: Getting package directory, destination=%s" % repr(destination))
+
         if self._build_path:
+            self._log("package: build_path already set: %s" % self._build_path)
             if destination:
                 shutil.copy(self._build_path, destination)
                 return os.path.abspath(destination)
@@ -256,10 +266,14 @@
 
         path = self._path()
         dist = os.path.join(path, 'dist')
+        self._log("package: dist directory: %s; (path=%s)" % (dist, path))
         if os.path.exists(dist):
             shutil.rmtree(dist)
 
-        call([sys.executable, 'setup.py', 'sdist'], cwd=path, stdout=subprocess.PIPE)
+        command = [sys.executable, 'setup.py', 'sdist']
+        self._log("package: running: %s" % ' '.join(command))
+        call(command, cwd=path)
+        self._log("package: done running setup.py dist")
 
         assert os.path.exists(dist)
         contents = os.listdir(dist)