diff carton.py @ 24:bb19d3dac4c5

fix tests
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 10 Jul 2011 18:17:54 -0700
parents 987086aad234
children e6ee0410ceef
line wrap: on
line diff
--- a/carton.py	Fri Jul 08 18:25:31 2011 -0700
+++ b/carton.py	Sun Jul 10 18:17:54 2011 -0700
@@ -186,12 +186,16 @@
 
             # package up the source if applicable
             if options.package and os.path.exists(os.path.join(source, 'setup.py')):
-                call([sys.executable, 'setup.py', 'sdist'], cwd=source)
+
+                # create a .tar.gz package
+                call([sys.executable, 'setup.py', 'sdist'], cwd=source, stdout=subprocess.PIPE)
                 dist_dir = os.path.join(source, 'dist')
                 assert os.path.isdir(dist_dir), "dist directory not created in %s" % source
                 tarfiles = [i for i in os.listdir(dist_dir)
                             if i.endswith('.tar.gz')]
                 assert tarfiles, "no .tar.gz files found in %s" % dist_dir
+
+                # use the last modified tarball
                 def last_modified(filename):
                     return os.path.getmtime(os.path.join(dist_dir, filename))
                 tarfiles.sort(key=last_modified)
@@ -201,6 +205,7 @@
                 # check for a tarball
                 buffer = file(source).read()
             else:
+                # add other sources (files and directories) to the archive
                 source_buffer = StringIO()
                 source_tar = tarfile.open(mode="w:gz", fileobj=source_buffer)
                 source_tar.add(source, arcname=os.path.basename(source))