Commit 16ea8e6a authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: site-packages in sys.path before eggs

Solution: sort packages to push site-packages at the end
parent 188827f9
...@@ -4,6 +4,8 @@ Change History ...@@ -4,6 +4,8 @@ Change History
3.0.0 (unreleased) 3.0.0 (unreleased)
================== ==================
- Scripts: ensure eggs are inserted before ``site-packages`` in ``sys.path``.
- Fix forever loop when changing ``zc.buildout`` version via ``buildout``. - Fix forever loop when changing ``zc.buildout`` version via ``buildout``.
- Add support for ``Requires-Python`` metadata. - Add support for ``Requires-Python`` metadata.
......
...@@ -1141,7 +1141,12 @@ def scripts(reqs, working_set, executable, dest=None, ...@@ -1141,7 +1141,12 @@ def scripts(reqs, working_set, executable, dest=None,
): ):
assert executable == sys.executable, (executable, sys.executable) assert executable == sys.executable, (executable, sys.executable)
path = [dist.location for dist in working_set] # ensure eggs are inserted before ``site-packages`` in ``sys.path``.
# TODO ensure develop-eggs are also inserted before ``site-packages``.
dists = [dist for dist in working_set]
dists.sort(key=lambda dist: (-dist.precedence, dist.project_name))
path = [dist.location for dist in dists]
path.extend(extra_paths) path.extend(extra_paths)
# order preserving unique # order preserving unique
unique_path = [] unique_path = []
......
...@@ -920,8 +920,8 @@ to pass a common base directory of the scripts and eggs: ...@@ -920,8 +920,8 @@ to pass a common base directory of the scripts and eggs:
<BLANKLINE> <BLANKLINE>
import sys import sys
sys.path[0:0] = [ sys.path[0:0] = [
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
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'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base, base,
...@@ -954,8 +954,8 @@ We specified an interpreter and its paths are adjusted too: ...@@ -954,8 +954,8 @@ We specified an interpreter and its paths are adjusted too:
import sys import sys
<BLANKLINE> <BLANKLINE>
sys.path[0:0] = [ sys.path[0:0] = [
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
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'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base, base,
......
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