Commit 37e2824b authored by paul's avatar paul

Correct a problem whereby system packages already in the working set

may conflict with new eggs buildout is trying to install.
parent a40305ee
...@@ -568,6 +568,9 @@ class Installer: ...@@ -568,6 +568,9 @@ class Installer:
"Couldn't download distribution %s." % avail) "Couldn't download distribution %s." % avail)
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)] dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
for _d in dists:
if _d not in ws:
ws.add(_d, replace=True)
finally: finally:
if tmp != self._download_cache: if tmp != self._download_cache:
...@@ -575,10 +578,14 @@ class Installer: ...@@ -575,10 +578,14 @@ class Installer:
self._env_rescan_dest() self._env_rescan_dest()
dist = self._env.best_match(requirement, ws) dist = self._env.best_match(requirement, ws)
logger.info("Got %s.", dist) logger.info("Got %s.", dist)
else: else:
dists = [dist] dists = [dist]
if dist not in ws:
ws.add(dist)
if not self._install_from_cache and self._use_dependency_links: if not self._install_from_cache and self._use_dependency_links:
self._add_dependency_links_from_dists(dists) self._add_dependency_links_from_dists(dists)
...@@ -635,8 +642,7 @@ class Installer: ...@@ -635,8 +642,7 @@ class Installer:
pkg_resources.Requirement.parse('setuptools') pkg_resources.Requirement.parse('setuptools')
) )
if ws.find(requirement) is None: if ws.find(requirement) is None:
for dist in self._get_dist(requirement, ws): self._get_dist(requirement, ws)
ws.add(dist)
def _constrain(self, requirement): def _constrain(self, requirement):
"""Return requirement with optional [versions] constraint added.""" """Return requirement with optional [versions] constraint added."""
...@@ -670,7 +676,6 @@ class Installer: ...@@ -670,7 +676,6 @@ class Installer:
for requirement in requirements: for requirement in requirements:
for dist in self._get_dist(requirement, ws): for dist in self._get_dist(requirement, ws):
ws.add(dist)
self._maybe_add_setuptools(ws, dist) self._maybe_add_setuptools(ws, dist)
# OK, we have the requested distributions and they're in the working # OK, we have the requested distributions and they're in the working
...@@ -719,7 +724,6 @@ class Installer: ...@@ -719,7 +724,6 @@ class Installer:
logger.debug('Adding required %r', str(req)) logger.debug('Adding required %r', str(req))
self._log_requirement(ws, req) self._log_requirement(ws, req)
for dist in self._get_dist(req, ws): for dist in self._get_dist(req, ws):
ws.add(dist)
self._maybe_add_setuptools(ws, dist) self._maybe_add_setuptools(ws, dist)
if dist not in req: if dist not in req:
# Oops, the "best" so far conflicts with a dependency. # Oops, the "best" so far conflicts with a dependency.
......
...@@ -125,8 +125,8 @@ The working set contains the distributions we retrieved. ...@@ -125,8 +125,8 @@ The working set contains the distributions we retrieved.
>>> for dist in ws: >>> for dist in ws:
... print_(dist) ... print_(dist)
demo 0.2
demoneeded 1.1 demoneeded 1.1
demo 0.2
We got demoneeded because it was a dependency of demo. We got demoneeded because it was a dependency of demo.
...@@ -169,8 +169,8 @@ The old setting is returned. ...@@ -169,8 +169,8 @@ The old setting is returned.
... ['demo'], dest, links=[link_server], index=link_server+'index/') ... ['demo'], dest, links=[link_server], index=link_server+'index/')
>>> for dist in ws: >>> for dist in ws:
... print_(dist) ... print_(dist)
demo 0.4rc1
demoneeded 1.2rc1 demoneeded 1.2rc1
demo 0.4rc1
>>> ls(dest) >>> ls(dest)
d demo-0.2-py2.4.egg d demo-0.2-py2.4.egg
...@@ -195,9 +195,9 @@ dependencies. We might do this to specify a specific version. ...@@ -195,9 +195,9 @@ dependencies. We might do this to specify a specific version.
>>> for dist in ws: >>> for dist in ws:
... print_(dist) ... print_(dist)
demo 0.3
other 1.0
demoneeded 1.0 demoneeded 1.0
other 1.0
demo 0.3
>>> ls(dest) >>> ls(dest)
d demo-0.2-py2.4.egg d demo-0.2-py2.4.egg
...@@ -231,8 +231,8 @@ Let's check that the uppercase dist is installed. ...@@ -231,8 +231,8 @@ Let's check that the uppercase dist is installed.
>>> for dist in ws: >>> for dist in ws:
... print_(dist) ... print_(dist)
MIXEDCASE 0.5
demoneeded 1.1 demoneeded 1.1
MIXEDCASE 0.5
>>> ls(dest) >>> ls(dest)
d MIXEDCASE-0.5-pyN.N.egg d MIXEDCASE-0.5-pyN.N.egg
d demoneeded-1.1-py2.4.egg d demoneeded-1.1-py2.4.egg
...@@ -256,7 +256,7 @@ then the versions numbers will be used. ...@@ -256,7 +256,7 @@ then the versions numbers will be used.
... ['demo'], dest, links=[link_server], index=link_server+'index/', ... ['demo'], dest, links=[link_server], index=link_server+'index/',
... versions = dict(demo='0.2', demoneeded='1.0')) ... versions = dict(demo='0.2', demoneeded='1.0'))
>>> [d.version for d in ws] >>> [d.version for d in ws]
['0.2', '1.0'] ['1.0', '0.2']
In this example, we specified a version for demoneeded, even though we In this example, we specified a version for demoneeded, even though we
didn't define a requirement for it. The versions specified apply to didn't define a requirement for it. The versions specified apply to
...@@ -890,8 +890,8 @@ to pass a common base directory of the scripts and eggs: ...@@ -890,8 +890,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/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'), join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
join(base, 'eggs/demo-0.3-pyN.N.egg'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base, base,
...@@ -924,13 +924,14 @@ We specified an interpreter and its paths are adjusted too: ...@@ -924,13 +924,14 @@ 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/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'), join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
join(base, 'eggs/demo-0.3-pyN.N.egg'),
'/ba', '/ba',
join(base, 'bar'), join(base, 'bar'),
base, base,
] ]
<BLANKLINE> <BLANKLINE>
<BLANKLINE>
_interactive = True _interactive = True
if len(sys.argv) > 1: if len(sys.argv) > 1:
_options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:') _options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:')
......
...@@ -2018,8 +2018,8 @@ def bug_61890_file_urls_dont_seem_to_work_in_find_dash_links(): ...@@ -2018,8 +2018,8 @@ def bug_61890_file_urls_dont_seem_to_work_in_find_dash_links():
>>> for dist in ws: >>> for dist in ws:
... print_(dist) ... print_(dist)
demo 0.2
demoneeded 1.1 demoneeded 1.1
demo 0.2
>>> ls(dest) >>> ls(dest)
d demo-0.2-py2.4.egg d demo-0.2-py2.4.egg
...@@ -3229,7 +3229,7 @@ def create_sample_eggs(test, executable=sys.executable): ...@@ -3229,7 +3229,7 @@ def create_sample_eggs(test, executable=sys.executable):
" zip_safe=True, version='0.5')\n" " zip_safe=True, version='0.5')\n"
) )
zc.buildout.testing.sdist(tmp, dest) zc.buildout.testing.sdist(tmp, dest)
# rename file to lower case # rename file to lower case
# to test issues between file and package name # to test issues between file and package name
curdir = os.getcwd() curdir = os.getcwd()
os.chdir(dest) os.chdir(dest)
......
...@@ -87,8 +87,8 @@ Our buildout script has been updated to use the new eggs: ...@@ -87,8 +87,8 @@ Our buildout script has been updated to use the new eggs:
<BLANKLINE> <BLANKLINE>
import sys import sys
sys.path[0:0] = [ sys.path[0:0] = [
'/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg',
'/sample-buildout/eggs/setuptools-99.99-py2.4.egg', '/sample-buildout/eggs/setuptools-99.99-py2.4.egg',
'/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg',
] ]
<BLANKLINE> <BLANKLINE>
import zc.buildout.buildout import zc.buildout.buildout
......
...@@ -89,9 +89,9 @@ of extra requirements to be included in the working set. ...@@ -89,9 +89,9 @@ of extra requirements to be included in the working set.
Egg requirements: Egg requirements:
demo<0.3 demo<0.3
Working set: Working set:
demo 0.2
other 1.0
demoneeded 1.1 demoneeded 1.1
other 1.0
demo 0.2
extra paths: [] extra paths: []
We can see that the options were augmented with additional data We can see that the options were augmented with additional data
......
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