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
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
e3ee34e8
Commit
e3ee34e8
authored
May 17, 2020
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: buildout script not sorted
Solution: sort accordingly
parent
86818e5b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
37 deletions
+48
-37
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+16
-2
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+27
-7
src/zc/buildout/easy_install.txt
src/zc/buildout/easy_install.txt
+2
-2
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+3
-26
No files found.
src/zc/buildout/buildout.py
View file @
e3ee34e8
...
...
@@ -608,9 +608,16 @@ class Buildout(DictMixin):
ws
=
pkg_resources
.
WorkingSet
(
entries
)
ws
.
require
(
'zc.buildout'
)
options
=
self
[
'buildout'
]
eggs_dir
=
options
[
'eggs-directory'
]
develop_eggs_dir
=
options
[
'develop-eggs-directory'
]
ws
=
zc
.
buildout
.
easy_install
.
sort_working_set
(
ws
,
eggs_dir
=
eggs_dir
,
develop_eggs_dir
=
develop_eggs_dir
)
zc
.
buildout
.
easy_install
.
scripts
(
[
'zc.buildout'
],
ws
,
sys
.
executable
,
self
[
'buildout'
]
[
'bin-directory'
],
options
[
'bin-directory'
],
relative_paths
=
(
bool_option
(
options
,
'relative-paths'
,
False
)
and
options
[
'directory'
]
...
...
@@ -1147,9 +1154,16 @@ class Buildout(DictMixin):
# the new dist is different, so we've upgraded.
# Update the scripts and return True
options
=
self
[
'buildout'
]
eggs_dir
=
options
[
'eggs-directory'
]
develop_eggs_dir
=
options
[
'develop-eggs-directory'
]
ws
=
zc
.
buildout
.
easy_install
.
sort_working_set
(
ws
,
eggs_dir
=
eggs_dir
,
develop_eggs_dir
=
develop_eggs_dir
)
zc
.
buildout
.
easy_install
.
scripts
(
[
'zc.buildout'
],
ws
,
sys
.
executable
,
self
[
'buildout'
]
[
'bin-directory'
],
options
[
'bin-directory'
],
relative_paths
=
(
bool_option
(
options
,
'relative-paths'
,
False
)
and
options
[
'directory'
]
...
...
src/zc/buildout/easy_install.py
View file @
e3ee34e8
...
...
@@ -1141,19 +1141,14 @@ def scripts(reqs, working_set, executable, dest=None,
):
assert
executable
==
sys
.
executable
,
(
executable
,
sys
.
executable
)
# 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
=
[
dist
.
location
for
dist
in
working_set
]
path
.
extend
(
extra_paths
)
# order preserving unique
unique_path
=
[]
for
p
in
path
:
if
p
not
in
unique_path
:
unique_path
.
append
(
p
)
path
=
list
(
map
(
realpath
,
unique_path
))
path
=
[
realpath
(
p
)
for
p
in
unique_path
]
generated
=
[]
...
...
@@ -1929,3 +1924,28 @@ def _move_to_eggs_dir_and_compile(dist, dest):
if
installed_with_pip
:
newdist
.
precedence
=
pkg_resources
.
EGG_DIST
return
newdist
def
sort_working_set
(
ws
,
eggs_dir
,
develop_eggs_dir
):
develop_paths
=
set
()
pattern
=
os
.
path
.
join
(
develop_eggs_dir
,
'*.egg-link'
)
for
egg_link
in
glob
.
glob
(
pattern
):
with
open
(
egg_link
,
'rt'
)
as
f
:
path
=
f
.
readline
().
strip
()
if
path
:
develop_paths
.
add
(
path
)
sorted_paths
=
[]
egg_paths
=
[]
other_paths
=
[]
for
dist
in
ws
:
path
=
dist
.
location
if
path
in
develop_paths
:
sorted_paths
.
append
(
path
)
elif
os
.
path
.
commonprefix
([
path
,
eggs_dir
])
==
eggs_dir
:
egg_paths
.
append
(
path
)
else
:
other_paths
.
append
(
path
)
sorted_paths
.
extend
(
egg_paths
)
sorted_paths
.
extend
(
other_paths
)
return
pkg_resources
.
WorkingSet
(
sorted_paths
)
src/zc/buildout/easy_install.txt
View file @
e3ee34e8
...
...
@@ -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/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
join(base, 'eggs/demo-0.3-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/demo-0.3-pyN.N.egg'),
join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
join(base, 'eggs/demo-0.3-pyN.N.egg'),
'/ba',
join(base, 'bar'),
base,
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
e3ee34e8
...
...
@@ -95,31 +95,6 @@ class Eggs(object):
update
=
install
def
_sort_working_set
(
self
,
ws
):
develop_paths
=
set
()
pattern
=
os
.
path
.
join
(
self
.
options
[
'develop-eggs-directory'
],
'*.egg-link'
)
for
egg_link
in
glob
.
glob
(
pattern
):
with
open
(
egg_link
,
'rt'
)
as
f
:
path
=
f
.
readline
().
strip
()
if
path
:
develop_paths
.
add
(
path
)
egg_directory
=
os
.
path
.
join
(
self
.
options
[
'eggs-directory'
],
''
)
sorted_paths
=
[]
egg_paths
=
[]
other_paths
=
[]
for
dist
in
ws
:
path
=
dist
.
location
if
path
in
develop_paths
:
sorted_paths
.
append
(
path
)
elif
os
.
path
.
commonprefix
([
path
,
egg_directory
])
==
egg_directory
:
egg_paths
.
append
(
path
)
else
:
other_paths
.
append
(
path
)
sorted_paths
.
extend
(
egg_paths
)
sorted_paths
.
extend
(
other_paths
)
return
pkg_resources
.
WorkingSet
(
sorted_paths
)
def
_working_set
(
self
,
distributions
,
...
...
@@ -166,7 +141,9 @@ class Eggs(object):
newest
=
newest
,
allow_hosts
=
allow_hosts
,
allow_unknown_extras
=
allow_unknown_extras
)
ws
=
self
.
_sort_working_set
(
ws
)
ws
=
zc
.
buildout
.
easy_install
.
sort_working_set
(
ws
,
eggs_dir
,
develop_eggs_dir
)
cache_storage
[
cache_key
]
=
ws
# `pkg_resources.WorkingSet` instances are mutable, so we need to return
...
...
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