Commit e079b796 authored by Reinout van Rees's avatar Reinout van Rees

Merge pull request #278 from buildout/reinout-relative-test

Same as #277, but with test and changelog entry
parents 039ac65d 833924d7
...@@ -4,7 +4,9 @@ Change History ...@@ -4,7 +4,9 @@ Change History
2.4.6 (unreleased) 2.4.6 (unreleased)
================== ==================
- Nothing changed yet. - Relative paths are now also correctly generated for the current directory
("develop = .").
[youngking]
2.4.5 (2015-10-14) 2.4.5 (2015-10-14)
......
...@@ -1152,6 +1152,8 @@ def _relative_path(common, path): ...@@ -1152,6 +1152,8 @@ def _relative_path(common, path):
def _relativitize(path, script, relative_paths): def _relativitize(path, script, relative_paths):
if path == script: if path == script:
raise AssertionError("path == script") raise AssertionError("path == script")
if path == relative_paths:
return "base"
common = os.path.dirname(os.path.commonprefix([path, script])) common = os.path.dirname(os.path.commonprefix([path, script]))
if (common == relative_paths or if (common == relative_paths or
common.startswith(os.path.join(relative_paths, '')) common.startswith(os.path.join(relative_paths, ''))
......
...@@ -835,7 +835,7 @@ to pass a common base directory of the scripts and eggs: ...@@ -835,7 +835,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=[ba, join(bo, 'bar')], ... extra_paths=[ba, join(bo, 'bar'), bo],
... interpreter='py', ... interpreter='py',
... relative_paths=bo) ... relative_paths=bo)
...@@ -854,6 +854,7 @@ to pass a common base directory of the scripts and eggs: ...@@ -854,6 +854,7 @@ to pass a common base directory of the scripts and eggs:
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'), join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base,
] ]
<BLANKLINE> <BLANKLINE>
import eggrecipedemo import eggrecipedemo
...@@ -887,6 +888,7 @@ We specified an interpreter and its paths are adjusted too: ...@@ -887,6 +888,7 @@ We specified an interpreter and its paths are adjusted too:
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'), join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base,
] ]
<BLANKLINE> <BLANKLINE>
_interactive = True _interactive = True
......
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