Commit f2617ede authored by Jim Fulton's avatar Jim Fulton

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.
parent 44e839e9
...@@ -19,17 +19,17 @@ buildout egg itself is installed as a develop egg. ...@@ -19,17 +19,17 @@ buildout egg itself is installed as a develop egg.
$Id$ $Id$
""" """
import os, sys, urllib2 import os, shutil, sys, subprocess, urllib2
is_jython = sys.platform.startswith('java') is_jython = sys.platform.startswith('java')
if is_jython:
import subprocess
for d in 'eggs', 'develop-eggs', 'bin': for d in 'eggs', 'develop-eggs', 'bin':
if not os.path.exists(d): if not os.path.exists(d):
os.mkdir(d) os.mkdir(d)
if os.path.isdir('build'):
shutil.rmtree('build')
try: try:
import pkg_resources import pkg_resources
except ImportError: except ImportError:
...@@ -40,15 +40,10 @@ except ImportError: ...@@ -40,15 +40,10 @@ except ImportError:
import pkg_resources import pkg_resources
if is_jython: subprocess.Popen(
subprocess.Popen([sys.executable] + ['setup.py', '-q', 'develop', '-m', '-x', [sys.executable] +
'-d', 'develop-eggs'], ['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
env = {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)}).wait() 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__)},
)
pkg_resources.working_set.add_entry('src') pkg_resources.working_set.add_entry('src')
...@@ -61,6 +56,5 @@ bin_buildout = os.path.join('bin', 'buildout') ...@@ -61,6 +56,5 @@ bin_buildout = os.path.join('bin', 'buildout')
if is_jython: if is_jython:
# Jython needs the script to be called twice via sys.executable # Jython needs the script to be called twice via sys.executable
assert subprocess.Popen([sys.executable] + [bin_buildout]).wait() == 0 assert subprocess.Popen([sys.executable] + [bin_buildout]).wait() == 0
sys.exit(subprocess.Popen([sys.executable] + [bin_buildout]).wait())
else: sys.exit(subprocess.Popen([sys.executable] + [bin_buildout]).wait())
sys.exit(os.spawnl(os.P_WAIT, bin_buildout, bin_buildout))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment