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
Xavier Thompson
slapos.buildout
Commits
b0859c20
Commit
b0859c20
authored
Sep 21, 2023
by
Xavier Thompson
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP attempt to do --respect-pinned
parent
449f1618
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
42 deletions
+57
-42
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+41
-35
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+16
-7
No files found.
src/zc/buildout/buildout.py
View file @
b0859c20
...
...
@@ -607,18 +607,21 @@ class Buildout(DictMixin):
def
bootstrap
(
self
,
args
):
__doing__
=
'Bootstrapping.'
if
os
.
path
.
exists
(
self
[
'buildout'
][
'develop-eggs-directory'
]):
if
os
.
path
.
isdir
(
self
[
'buildout'
][
'develop-eggs-directory'
]):
rmtree
(
self
[
'buildout'
][
'develop-eggs-directory'
])
self
.
_logger
.
debug
(
"Removed existing develop-eggs directory"
)
options
=
self
[
'buildout'
]
eggs_dir
=
options
[
'eggs-directory'
]
develop_eggs_dir
=
options
[
'develop-eggs-directory'
]
if
os
.
path
.
exists
(
develop_eggs_dir
):
if
os
.
path
.
isdir
(
develop_eggs_dir
):
rmtree
(
develop_eggs_dir
)
self
.
_logger
.
debug
(
"Removed existing develop-eggs directory"
)
self
.
_setup_directories
()
if
'--
all-local
'
in
args
:
# Now install buildout and dependent eggs
, and record destination eggs:
dest
=
self
[
'buildout'
][
'eggs-directory'
]
path
=
[
self
[
'buildout'
][
'develop-eggs-directory'
]
]
if
'--
respect-pinned
'
in
args
:
# Now install buildout and dependent eggs
dest
=
eggs_dir
path
=
[
develop_eggs_dir
]
if
self
.
offline
:
# Cannot install: just check requirements are already met
path
.
append
(
dest
)
...
...
@@ -627,43 +630,46 @@ class Buildout(DictMixin):
[
'zc.buildout'
],
dest
,
links
=
self
.
_links
,
index
=
self
[
'buildout'
]
.
get
(
'index'
),
index
=
options
.
get
(
'index'
),
path
=
path
,
newest
=
self
.
newest
,
allow_hosts
=
self
.
_allow_hosts
,
)
else
:
# Now copy buildout and setuptools eggs, and record destination eggs:
entries
=
[]
for
dist
in
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
:
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'develop-eggs-directory'
],
dist
.
key
+
'.egg-link'
)
with
open
(
dest
,
'w'
)
as
fh
:
fh
.
write
(
dist
.
location
)
entries
.
append
(
dist
.
location
)
else
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'eggs-directory'
],
os
.
path
.
basename
(
dist
.
location
))
entries
.
append
(
dest
)
if
not
os
.
path
.
exists
(
dest
):
if
os
.
path
.
isdir
(
dist
.
location
):
shutil
.
copytree
(
dist
.
location
,
dest
)
else
:
shutil
.
copy2
(
dist
.
location
,
dest
)
ws
=
pkg_resources
.
WorkingSet
(
entries
)
ws
=
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
# Now copy buildout and setuptools eggs, and record destination eggs:
entries
=
[]
for
dist
in
ws
.
require
(
'zc.buildout'
):
print
(
dist
)
if
os
.
path
.
dirname
(
dist
.
location
)
in
(
eggs_dir
,
develop_eggs_dir
):
print
(
"ok "
,
dist
.
location
)
entries
.
append
(
dist
.
location
)
elif
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'develop-eggs-directory'
],
dist
.
key
+
'.egg-link'
)
with
open
(
dest
,
'w'
)
as
fh
:
fh
.
write
(
dist
.
location
)
print
(
"dev"
,
dist
.
location
)
entries
.
append
(
dist
.
location
)
else
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'eggs-directory'
],
os
.
path
.
basename
(
dist
.
location
))
print
(
"cpy"
,
dest
)
entries
.
append
(
dest
)
if
not
os
.
path
.
exists
(
dest
):
if
os
.
path
.
isdir
(
dist
.
location
):
shutil
.
copytree
(
dist
.
location
,
dest
)
else
:
shutil
.
copy2
(
dist
.
location
,
dest
)
# Ensure all the requirements are met
ws
.
require
(
'zc.buildout'
)
ws
=
pkg_resources
.
WorkingSet
(
entries
)
# Create buildout script
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
develop_eggs_dir
=
None
)
zc
.
buildout
.
easy_install
.
scripts
(
[
'zc.buildout'
],
ws
,
sys
.
executable
,
...
...
src/zc/buildout/easy_install.py
View file @
b0859c20
...
...
@@ -69,6 +69,10 @@ default_index_url = os.environ.get(
)
logger
=
logging
.
getLogger
(
'zc.buildout.easy_install'
)
def
info
(
fmt
,
*
args
):
print
(
fmt
%
args
)
logger
.
info
=
info
logger
.
debug
=
info
url_match
=
re
.
compile
(
'[a-z0-9+.-]+://'
).
match
is_source_encoding_line
=
re
.
compile
(
r'coding[:=]\
s*([-
\w.]+)'
).
search
...
...
@@ -1954,15 +1958,20 @@ def _move_to_eggs_dir_and_compile(dist, dest):
return
newdist
def
sort_working_set
(
ws
,
eggs_dir
,
develop_eggs_dir
):
def
sort_working_set
(
ws
,
eggs_dir
,
develop_eggs_dir
=
None
):
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
)
if
develop_eggs_dir
:
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
)
print
(
develop_paths
)
print
(
ws
.
entries
)
print
([
dist
for
dist
in
ws
])
sorted_paths
=
[]
egg_paths
=
[]
other_paths
=
[]
...
...
Xavier Thompson
@xavier_thompson
mentioned in commit
5c99921b
·
Sep 22, 2023
mentioned in commit
5c99921b
mentioned in commit 5c99921b6313ca17a4f3428e0e2f9e927906155f
Toggle commit list
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