Commit ea56fd86 authored by andreasjung's avatar andreasjung

fixed usage of 'relative_paths' keyword parameter on Windows


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