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

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:28:47 EDT 2009


Log message for revision 98572:
  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/branches/help-api/dev.py

-=-
Modified: zc.buildout/branches/help-api/dev.py
===================================================================
--- zc.buildout/branches/help-api/dev.py	2009-03-29 21:28:40 UTC (rev 98571)
+++ zc.buildout/branches/help-api/dev.py	2009-03-29 21:28:47 UTC (rev 98572)
@@ -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