Commit d5e1b178 authored by Gary Poster's avatar Gary Poster

make tests pass in Windows.

parent ffa0a7f9
...@@ -40,10 +40,12 @@ except ImportError: ...@@ -40,10 +40,12 @@ except ImportError:
import pkg_resources import pkg_resources
env = os.environ.copy() # Windows needs yet-to-be-determined values from this.
env['PYTHONPATH'] = os.path.dirname(pkg_resources.__file__)
subprocess.Popen( subprocess.Popen(
[sys.executable] + [sys.executable] +
['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'], ['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
env = {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)}).wait() env=env).wait()
pkg_resources.working_set.add_entry('src') pkg_resources.working_set.add_entry('src')
......
...@@ -197,7 +197,7 @@ clear_index_cache = _indexes.clear ...@@ -197,7 +197,7 @@ clear_index_cache = _indexes.clear
if is_win32: if is_win32:
# work around spawn lamosity on windows # work around spawn lamosity on windows
# XXX need safe quoting (see the subproces.list2cmdline) and test # XXX need safe quoting (see the subprocess.list2cmdline) and test
def _safe_arg(arg): def _safe_arg(arg):
return '"%s"' % arg return '"%s"' % arg
else: else:
......
...@@ -998,7 +998,7 @@ The ``sitepackage_safe_scripts`` function ...@@ -998,7 +998,7 @@ The ``sitepackage_safe_scripts`` function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The newer function for creating scripts is ``sitepackage_safe_scripts``. The newer function for creating scripts is ``sitepackage_safe_scripts``.
It has the same basic functionality as the ``scripts`` function: it can It has the same basic functionality as the ``scripts`` function: it can
create scripts to run arbitrary entry points, and to run a Python create scripts to run arbitrary entry points, and to run a Python
interpreter. The following are the differences from a user's interpreter. The following are the differences from a user's
perspective. perspective.
......
...@@ -374,6 +374,19 @@ def buildoutSetUp(test): ...@@ -374,6 +374,19 @@ def buildoutSetUp(test):
return ( return (
os.path.join(buildout, 'bin', 'py'), site_packages_dir) os.path.join(buildout, 'bin', 'py'), site_packages_dir)
buildout = os.path.join(sample, 'bin', 'buildout')
def do_build(buildout=buildout, python=None, args=()):
if python is None:
return system(buildout)
if sys.platform == 'win32':
# We need to find the "real" script.
buildout += '-script.py'
cmd = [python, buildout]
cmd.extend(args)
return system(zc.buildout.easy_install._safe_arg(
' '.join(zc.buildout.easy_install._safe_arg(arg) for arg in cmd)))
test.globs.update(dict( test.globs.update(dict(
sample_buildout = sample, sample_buildout = sample,
ls = ls, ls = ls,
...@@ -384,6 +397,7 @@ def buildoutSetUp(test): ...@@ -384,6 +397,7 @@ def buildoutSetUp(test):
tmpdir = tmpdir, tmpdir = tmpdir,
write = write, write = write,
system = system, system = system,
do_build=do_build,
call_py = call_py, call_py = call_py,
get = get, get = get,
cd = (lambda *path: os.chdir(os.path.join(*path))), cd = (lambda *path: os.chdir(os.path.join(*path))),
...@@ -391,7 +405,7 @@ def buildoutSetUp(test): ...@@ -391,7 +405,7 @@ def buildoutSetUp(test):
sdist = sdist, sdist = sdist,
bdist_egg = bdist_egg, bdist_egg = bdist_egg,
start_server = start_server, start_server = start_server,
buildout = os.path.join(sample, 'bin', 'buildout'), buildout = buildout,
wait_until = wait_until, wait_until = wait_until,
make_py = make_py make_py = make_py
)) ))
......
...@@ -420,7 +420,7 @@ Now here is the output. The lines that begin with "Egg from site-packages:" ...@@ -420,7 +420,7 @@ Now here is the output. The lines that begin with "Egg from site-packages:"
indicate the eggs from site-packages that have been selected. You'll see indicate the eggs from site-packages that have been selected. You'll see
we have two: demo 0.3 and demoneeded 1.1. we have two: demo 0.3 and demoneeded 1.1.
>>> print system(py_path+" "+buildout+" -v") >>> print do_build(python=py_path, args=['-v'])
Installing 'zc.buildout', 'setuptools'. Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout V We have a develop egg: zc.buildout V
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
...@@ -3367,7 +3367,8 @@ def updateSetup(test): ...@@ -3367,7 +3367,8 @@ def updateSetup(test):
here = os.getcwd() here = os.getcwd()
os.chdir(os.path.dirname(dist.location)) os.chdir(os.path.dirname(dist.location))
assert os.spawnle( assert os.spawnle(
os.P_WAIT, sys.executable, zc.buildout.easy_install._safe_arg (sys.executable), os.P_WAIT, sys.executable,
zc.buildout.easy_install._safe_arg(sys.executable),
os.path.join(os.path.dirname(dist.location), 'setup.py'), os.path.join(os.path.dirname(dist.location), 'setup.py'),
'-q', 'bdist_egg', '-d', eggs, '-q', 'bdist_egg', '-d', eggs,
dict(os.environ, dict(os.environ,
......
...@@ -325,7 +325,7 @@ document do not affect this example.) ...@@ -325,7 +325,7 @@ document do not affect this example.)
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Creating directory '/sample-buildout/tmpeggs'. Creating directory '/sample-buildout/tmpeggs'.
Uninstalling py. Uninstalling py.
Installing eggs. Installing eggs.
...@@ -354,7 +354,7 @@ is not allowed to come from site-packages, and the buildout fails. ...@@ -354,7 +354,7 @@ is not allowed to come from site-packages, and the buildout fails.
... allowed-eggs-from-site-packages = ... allowed-eggs-from-site-packages =
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Creating directory '/sample-buildout/tmpeggs'. Creating directory '/sample-buildout/tmpeggs'.
Uninstalling eggs. Uninstalling eggs.
Installing eggs. Installing eggs.
......
...@@ -267,7 +267,7 @@ The eggs are not found. ...@@ -267,7 +267,7 @@ The eggs are not found.
... python = primed_python ... python = primed_python
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Installing eggs. Installing eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?) Couldn't find index page for 'demoneeded' (maybe misspelled?)
Getting distribution for 'demoneeded'. Getting distribution for 'demoneeded'.
...@@ -297,7 +297,7 @@ they are in the executable's path. ...@@ -297,7 +297,7 @@ they are in the executable's path.
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Installing eggs. Installing eggs.
<BLANKLINE> <BLANKLINE>
...@@ -315,7 +315,7 @@ We get an error if we specify anything but true or false: ...@@ -315,7 +315,7 @@ We get an error if we specify anything but true or false:
... eggs = other ... eggs = other
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
While: While:
Installing. Installing.
Getting section eggs. Getting section eggs.
...@@ -357,7 +357,7 @@ correctly parse a single-line value. ...@@ -357,7 +357,7 @@ correctly parse a single-line value.
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Installing eggs. Installing eggs.
<BLANKLINE> <BLANKLINE>
...@@ -383,7 +383,7 @@ parse a multi-line value. ...@@ -383,7 +383,7 @@ parse a multi-line value.
... eggs = demoneeded ... eggs = demoneeded
... ''' % globals()) ... ''' % globals())
>>> print system(py_path+" "+buildout) >>> print do_build(python=py_path)
Uninstalling eggs. Uninstalling eggs.
Installing eggs. Installing eggs.
<BLANKLINE> <BLANKLINE>
......
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