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
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``.
- Add support for ``Requires-Python`` metadata.
......
......@@ -1141,7 +1141,12 @@ def scripts(reqs, working_set, executable, dest=None,
):
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)
# order preserving unique
unique_path = []
......
......@@ -920,8 +920,8 @@ to pass a common base directory of the scripts and eggs:
<BLANKLINE>
import sys
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/demoneeded-1.1-pyN.N.egg'),
'/ba',
join(base, 'bar'),
base,
......@@ -954,8 +954,8 @@ We specified an interpreter and its paths are adjusted too:
import sys
<BLANKLINE>
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/demoneeded-1.1-pyN.N.egg'),
'/ba',
join(base, 'bar'),
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