[Checkins] SVN: zc.buildout/trunk/dev.py Simplified code to always use the subprocess module, since buildout

Jim Fulton jim at zope.com
Tue Mar 17 09:09:23 EDT 2009


Log message for revision 98176:
  Simplified code to always use the subprocess module, since buildout
  itself always uses it.
  
  Remive the build directiory before building to make sure we're clean
  when we witch Python versions.
  

Changed:
  U   zc.buildout/trunk/dev.py

-=-
Modified: zc.buildout/trunk/dev.py
===================================================================
--- zc.buildout/trunk/dev.py	2009-03-17 13:09:21 UTC (rev 98175)
+++ zc.buildout/trunk/dev.py	2009-03-17 13:09:23 UTC (rev 98176)
@@ -19,17 +19,17 @@
 $Id$
 """
 
-import os, sys, urllib2
+import os, shutil, sys, subprocess, urllib2
 
 is_jython = sys.platform.startswith('java')
 
-if is_jython:
-    import subprocess
-
 for d in 'eggs', 'develop-eggs', 'bin':
     if not os.path.exists(d):
         os.mkdir(d)
 
+if os.path.isdir('build'):
+    shutil.rmtree('build')
+
 try:
     import pkg_resources
 except ImportError:
@@ -40,15 +40,10 @@
 
     import pkg_resources
 
-if is_jython:
-    subprocess.Popen([sys.executable] + ['setup.py', '-q', 'develop', '-m', '-x',
-                        '-d', 'develop-eggs'], 
-                        env = {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)}).wait()
-else:
-    os.spawnle(os.P_WAIT, sys.executable, sys.executable, 'setup.py',
-               '-q', 'develop', '-m', '-x', '-d', 'develop-eggs',
-               {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)},
-               )
+subprocess.Popen(
+    [sys.executable] +
+    ['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
+    env = {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)}).wait()
 
 pkg_resources.working_set.add_entry('src')
 
@@ -61,6 +56,5 @@
 if is_jython:
     # Jython needs the script to be called twice via sys.executable
     assert subprocess.Popen([sys.executable] + [bin_buildout]).wait() == 0
-    sys.exit(subprocess.Popen([sys.executable] + [bin_buildout]).wait())
-else:
-    sys.exit(os.spawnl(os.P_WAIT, bin_buildout, bin_buildout))
+
+sys.exit(subprocess.Popen([sys.executable] + [bin_buildout]).wait())



More information about the Checkins mailing list