Commit d5e1b178 authored by Gary Poster's avatar Gary Poster

make tests pass in Windows.

parent ffa0a7f9
......@@ -40,10 +40,12 @@ except ImportError:
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(
[sys.executable] +
['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')
......
......@@ -197,7 +197,7 @@ clear_index_cache = _indexes.clear
if is_win32:
# 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):
return '"%s"' % arg
else:
......
......@@ -998,7 +998,7 @@ The ``sitepackage_safe_scripts`` function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
interpreter. The following are the differences from a user's
perspective.
......
......@@ -374,6 +374,19 @@ def buildoutSetUp(test):
return (
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(
sample_buildout = sample,
ls = ls,
......@@ -384,6 +397,7 @@ def buildoutSetUp(test):
tmpdir = tmpdir,
write = write,
system = system,
do_build=do_build,
call_py = call_py,
get = get,
cd = (lambda *path: os.chdir(os.path.join(*path))),
......@@ -391,7 +405,7 @@ def buildoutSetUp(test):
sdist = sdist,
bdist_egg = bdist_egg,
start_server = start_server,
buildout = os.path.join(sample, 'bin', 'buildout'),
buildout = buildout,
wait_until = wait_until,
make_py = make_py
))
......
......@@ -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
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'.
We have a develop egg: zc.buildout V
We have the best distribution that satisfies 'setuptools'.
......@@ -3367,7 +3367,8 @@ def updateSetup(test):
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.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,
......
......@@ -325,7 +325,7 @@ document do not affect this example.)
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling py.
Installing eggs.
......@@ -354,7 +354,7 @@ is not allowed to come from site-packages, and the buildout fails.
... allowed-eggs-from-site-packages =
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling eggs.
Installing eggs.
......
......@@ -267,7 +267,7 @@ The eggs are not found.
... python = primed_python
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Installing eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?)
Getting distribution for 'demoneeded'.
......@@ -297,7 +297,7 @@ they are in the executable's path.
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Installing eggs.
<BLANKLINE>
......@@ -315,7 +315,7 @@ We get an error if we specify anything but true or false:
... eggs = other
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
While:
Installing.
Getting section eggs.
......@@ -357,7 +357,7 @@ correctly parse a single-line value.
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Installing eggs.
<BLANKLINE>
......@@ -383,7 +383,7 @@ parse a multi-line value.
... eggs = demoneeded
... ''' % globals())
>>> print system(py_path+" "+buildout)
>>> print do_build(python=py_path)
Uninstalling eggs.
Installing eggs.
<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