Commit 522d9598 authored by Andreas Jung's avatar Andreas Jung

fixed usage of 'relative_paths' keyword parameter on Windows

parent 2be90f32
......@@ -14,6 +14,8 @@ Change History
tear down as it might disturb other packages reusing buildout's
testing infrastructure.
- fixed usage of 'relative_paths' keyword parameter on Windows
1.2.1 (2009-03-18)
==================
......
......@@ -967,9 +967,10 @@ def scripts(reqs, working_set, executable, dest,
def _relative_path_and_setup(sname, path, relative_paths):
if relative_paths:
sname = os.path.abspath(sname)
relative_paths = os.path.normcase(relative_paths)
sname = os.path.normcase(os.path.abspath(sname))
spath = ',\n '.join(
[_relativitize(path_item, sname, relative_paths)
[_relativitize(os.path.normcase(path_item), sname, relative_paths)
for path_item in path]
)
rpsetup = relative_paths_setup
......
......@@ -717,9 +717,10 @@ Including extra paths in scripts
We can pass a keyword argument, extra paths, to cause additional paths
to be included in the a generated script:
>>> foo = tmpdir('foo')
>>> scripts = zc.buildout.easy_install.scripts(
... ['demo'], ws, sys.executable, bin, dict(demo='run'),
... extra_paths=['/foo/bar'])
... extra_paths=[foo])
>>> cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.4
......@@ -728,7 +729,7 @@ to be included in the a generated script:
sys.path[0:0] = [
'/sample-install/demo-0.3-py2.4.egg',
'/sample-install/demoneeded-1.1-py2.4.egg',
'/foo/bar',
'/foo',
]
<BLANKLINE>
import eggrecipedemo
......@@ -795,6 +796,7 @@ control this using the relative_paths option to install. You need
to pass a common base directory of the scripts and eggs:
>>> bo = tmpdir('bo')
>>> ba = tmpdir('ba')
>>> mkdir(bo, 'eggs')
>>> mkdir(bo, 'bin')
>>> mkdir(bo, 'other')
......@@ -805,7 +807,7 @@ to pass a common base directory of the scripts and eggs:
>>> scripts = zc.buildout.easy_install.scripts(
... ['demo'], ws, sys.executable, join(bo, 'bin'), dict(demo='run'),
... extra_paths=[os.path.sep+'foo', join(bo, 'bar')],
... extra_paths=[ba, join(bo, 'bar')],
... interpreter='py',
... relative_paths=bo)
......@@ -822,7 +824,7 @@ to pass a common base directory of the scripts and eggs:
sys.path[0:0] = [
join(base, 'eggs/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
'/foo',
'/ba',
join(base, 'bar'),
]
<BLANKLINE>
......@@ -855,7 +857,7 @@ We specified an interpreter and its paths are adjusted too:
sys.path[0:0] = [
join(base, 'eggs/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
'/foo',
'/ba',
join(base, 'bar'),
]
<BLANKLINE>
......
......@@ -86,6 +86,8 @@ def write(dir, *args):
fsync(f.fileno())
f.close()
## FIXME - check for other platforms
MUST_CLOSE_FDS = not sys.platform.startswith('win')
def system(command, input=''):
p = subprocess.Popen(command,
......@@ -93,7 +95,7 @@ def system(command, input=''):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=not is_win32)
close_fds=MUST_CLOSE_FDS)
i, o, e = (p.stdin, p.stdout, p.stderr)
if input:
i.write(input)
......@@ -146,7 +148,7 @@ def find_python(version):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True)
close_fds=MUST_CLOSE_FDS)
i, o = (p.stdin, p.stdout)
i.close()
e = o.read().strip()
......@@ -159,7 +161,7 @@ def find_python(version):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True)
close_fds=MUST_CLOSE_FDS)
i, o = (p.stdin, p.stdout)
i.close()
e = o.read().strip()
......@@ -171,7 +173,7 @@ def find_python(version):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True)
close_fds=MUST_CLOSE_FDS)
i, o = (p.stdin, p.stdout)
i.close()
e = o.read().strip()
......
......@@ -2808,6 +2808,7 @@ def test_suite():
normalize_bang,
(re.compile('extdemo[.]pyd'), 'extdemo.so'),
(re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'),
(re.compile(r'\\[\\]?'), '/'),
]),
),
doctest.DocTestSuite(
......
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