r7333 - dumbhippo/trunk/super/lib/super



Author: otaylor
Date: 2008-02-22 13:18:02 -0600 (Fri, 22 Feb 2008)
New Revision: 7333

Modified:
   dumbhippo/trunk/super/lib/super/deployer.py
Log:
Revert 7330 : subprocess module isn't there in Python-2.3. Do the same thing
  the easy way (I don't see a point in writing a pipeline in many lines of
  Python to save a single execution of /bin/sh)


Modified: dumbhippo/trunk/super/lib/super/deployer.py
===================================================================
--- dumbhippo/trunk/super/lib/super/deployer.py	2008-02-22 18:29:48 UTC (rev 7332)
+++ dumbhippo/trunk/super/lib/super/deployer.py	2008-02-22 19:18:02 UTC (rev 7333)
@@ -6,8 +6,6 @@
 import stat
 import tempfile
 import time
-import subprocess
-import shutil
 
 class Deployer:
     """A class that handles writing out an archive file containing super
@@ -61,14 +59,9 @@
         """Finish writing out the deployement archive"""
         topfiles = self.topfiles.keys()
         topfiles.sort()
-        outf = open(self.darfile, 'w')
-        tarargs = ['tar', 'cf', '-']
-        tarargs.extend(topfiles)
-        tar = subprocess.Popen(tarargs, stdout=subprocess.PIPE, cwd=self.outdir)
-        gzip = subprocess.Popen(['gzip', '-c', '--rsyncable'], stdin=tar.stdout, stdout=outf, cwd=self.outdir)
-        gzip.wait()
-        outf.close()
-        shutil.rmtree(self.outdir, ignore_errors=True)
+        filestr = " ".join(topfiles)
+        os.spawnl(os.P_WAIT, "/bin/sh", "sh", "-c", "(cd %s && tar cf - %s) | gzip -c --rsyncable > %s" % (self.outdir, filestr, self.darfile))
+        os.spawnl(os.P_WAIT, "/bin/rm", "rm", "-rf", self.outdir)
 
     def _add_directory(self, directory):
         """Make the directory (and parents) in the temporary output dir if we haven't already"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]