Skip to content

Commit

Permalink
stop usinf os.spawn (and _safe_arg where not needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Apr 14, 2012
1 parent 340dcab commit 4d14d8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
15 changes: 5 additions & 10 deletions src/zc/buildout/testing.py
Expand Up @@ -111,19 +111,14 @@ def get(url):
def _runsetup(setup, executable, *args):
if os.path.isdir(setup):
setup = os.path.join(setup, 'setup.py')
d = os.path.dirname(setup)

args = [zc.buildout.easy_install._safe_arg(arg)
for arg in args]
args = list(args)
args.insert(0, '-q')
args.append(dict(os.environ, PYTHONPATH=setuptools_location))

here = os.getcwd()
try:
os.chdir(d)
os.spawnle(os.P_WAIT, executable,
zc.buildout.easy_install._safe_arg(executable),
setup, *args)
os.chdir(os.path.dirname(setup))
zc.buildout.easy_install.call_subprocess(
[executable, setup] + args,
env=dict(os.environ, PYTHONPATH=setuptools_location))
if os.path.exists('build'):
rmtree('build')
finally:
Expand Down
21 changes: 10 additions & 11 deletions src/zc/buildout/tests.py
Expand Up @@ -2813,17 +2813,16 @@ def getWorkingSetWithBuildoutEgg(test):
# We have a develop egg, create a real egg for it:
here = os.getcwd()
os.chdir(os.path.dirname(dist.location))
assert os.spawnle(
os.P_WAIT, sys.executable,
zc.buildout.easy_install._safe_arg(sys.executable),
os.path.join(os.path.dirname(dist.location), 'setup.py'),
'-q', 'bdist_egg', '-d', eggs,
dict(os.environ,
PYTHONPATH=pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')
).location,
),
) == 0
zc.buildout.easy_install.call_subprocess(
[sys.executable,
os.path.join(os.path.dirname(dist.location), 'setup.py'),
'-q', 'bdist_egg', '-d', eggs],
env=dict(os.environ,
PYTHONPATH=pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')
).location,
),
)
os.chdir(here)
os.remove(os.path.join(eggs, 'zc.buildout.egg-link'))

Expand Down

0 comments on commit 4d14d8f

Please sign in to comment.