Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.buildout
Commits
9e0efd8b
Commit
9e0efd8b
authored
Oct 30, 2014
by
Alex Clark ☺
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #194 from puittenbroek/193-performance
193 performance
parents
b208fe6f
cb0c8b49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
29 deletions
+44
-29
CHANGES.rst
CHANGES.rst
+3
-0
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+41
-29
No files found.
CHANGES.rst
View file @
9e0efd8b
...
...
@@ -13,6 +13,9 @@ Unreleased
- Close various files when finished writing to them. This avoids
ResourceWarnings on Python 3, and better supports doctests under PyPy.
- Introduce improved easy_install Install.install function. This is present
in 1.5.X and 1.7X but was never merged into 2.X somehow.
2.2.1 (2013-09-05)
==================
...
...
src/zc/buildout/easy_install.py
View file @
9e0efd8b
...
...
@@ -616,8 +616,6 @@ class Installer:
requirements
=
[
self
.
_constrain
(
pkg_resources
.
Requirement
.
parse
(
spec
))
for
spec
in
specs
]
if
working_set
is
None
:
ws
=
pkg_resources
.
WorkingSet
([])
else
:
...
...
@@ -629,35 +627,49 @@ class Installer:
self
.
_maybe_add_setuptools
(
ws
,
dist
)
# OK, we have the requested distributions and they're in the working
# set, but they may have unmet requirements. We'll simply keep
# trying to resolve requirements, adding missing requirements as they
# are reported.
#
# Note that we don't pass in the environment, because we want
# set, but they may have unmet requirements. We'll resolve these
# requirements. This is code modified from
# pkg_resources.WorkingSet.resolve. We can't reuse that code directly
# because we have to constrain our requirements (see
# versions_section_ignored_for_dependency_in_favor_of_site_packages in
# zc.buildout.tests).
requirements
.
reverse
()
# Set up the stack.
processed
=
{}
# This is a set of processed requirements.
best
=
{}
# This is a mapping of key -> dist.
# Note that we don't use the existing environment, because we want
# to look for new eggs unless what we have is the best that
# matches the requirement.
while
1
:
env
=
pkg_resources
.
Environment
(
ws
.
entries
)
while
requirements
:
# Process dependencies breadth-first.
req
=
self
.
_constrain
(
requirements
.
pop
(
0
))
if
req
in
processed
:
# Ignore cyclic or redundant dependencies.
continue
dist
=
best
.
get
(
req
.
key
)
if
dist
is
None
:
# Find the best distribution and add it to the map.
dist
=
ws
.
by_key
.
get
(
req
.
key
)
if
dist
is
None
:
try
:
ws
.
resolve
(
requirements
)
except
pkg_resources
.
DistributionNotFound
:
err
=
sys
.
exc_info
()[
1
]
[
requirement
]
=
err
.
args
requirement
=
self
.
_constrain
(
requirement
)
dist
=
best
[
req
.
key
]
=
env
.
best_match
(
req
,
ws
)
except
pkg_resources
.
VersionConflict
,
err
:
raise
VersionConflict
(
err
,
ws
)
if
dist
is
None
:
if
dest
:
logger
.
debug
(
'Getting required %r'
,
str
(
requirement
))
logger
.
debug
(
'Getting required %r'
,
str
(
req
))
else
:
logger
.
debug
(
'Adding required %r'
,
str
(
requirement
))
_log_requirement
(
ws
,
requirement
)
for
dist
in
self
.
_get_dist
(
requirement
,
ws
):
logger
.
debug
(
'Adding required %r'
,
str
(
req
))
_log_requirement
(
ws
,
req
)
for
dist
in
self
.
_get_dist
(
req
,
ws
,):
ws
.
add
(
dist
)
self
.
_maybe_add_setuptools
(
ws
,
dist
)
except
pkg_resources
.
VersionConflict
:
err
=
sys
.
exc_info
()[
1
]
raise
VersionConflict
(
err
,
ws
)
else
:
break
if
dist
not
in
req
:
# Oops, the "best" so far conflicts with a dependency.
raise
VersionConflict
(
pkg_resources
.
VersionConflict
(
dist
,
req
),
ws
)
requirements
.
extend
(
dist
.
requires
(
req
.
extras
)[::
-
1
])
processed
[
req
]
=
True
return
ws
def
build
(
self
,
spec
,
build_ext
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment