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
Show 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):
...
@@ -607,18 +607,21 @@ class Buildout(DictMixin):
def
bootstrap
(
self
,
args
):
def
bootstrap
(
self
,
args
):
__doing__
=
'Bootstrapping.'
__doing__
=
'Bootstrapping.'
if
os
.
path
.
exists
(
self
[
'buildout'
][
'develop-eggs-directory'
]):
options
=
self
[
'buildout'
]
if
os
.
path
.
isdir
(
self
[
'buildout'
][
'develop-eggs-directory'
]):
eggs_dir
=
options
[
'eggs-directory'
]
rmtree
(
self
[
'buildout'
][
'develop-eggs-directory'
])
develop_eggs_dir
=
options
[
'develop-eggs-directory'
]
self
.
_logger
.
debug
(
"Removed existing 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
()
self
.
_setup_directories
()
if
'--
all-local
'
in
args
:
if
'--
respect-pinned
'
in
args
:
# Now install buildout and dependent eggs
, and record destination eggs:
# Now install buildout and dependent eggs
dest
=
self
[
'buildout'
][
'eggs-directory'
]
dest
=
eggs_dir
path
=
[
self
[
'buildout'
][
'develop-eggs-directory'
]
]
path
=
[
develop_eggs_dir
]
if
self
.
offline
:
if
self
.
offline
:
# Cannot install: just check requirements are already met
# Cannot install: just check requirements are already met
path
.
append
(
dest
)
path
.
append
(
dest
)
...
@@ -627,43 +630,46 @@ class Buildout(DictMixin):
...
@@ -627,43 +630,46 @@ class Buildout(DictMixin):
[
'zc.buildout'
],
[
'zc.buildout'
],
dest
,
dest
,
links
=
self
.
_links
,
links
=
self
.
_links
,
index
=
self
[
'buildout'
]
.
get
(
'index'
),
index
=
options
.
get
(
'index'
),
path
=
path
,
path
=
path
,
newest
=
self
.
newest
,
newest
=
self
.
newest
,
allow_hosts
=
self
.
_allow_hosts
,
allow_hosts
=
self
.
_allow_hosts
,
)
)
else
:
else
:
ws
=
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
# Now copy buildout and setuptools eggs, and record destination eggs:
# Now copy buildout and setuptools eggs, and record destination eggs:
entries
=
[]
entries
=
[]
for
dist
in
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
:
for
dist
in
ws
.
require
(
'zc.buildout'
):
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
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'
],
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'develop-eggs-directory'
],
dist
.
key
+
'.egg-link'
)
dist
.
key
+
'.egg-link'
)
with
open
(
dest
,
'w'
)
as
fh
:
with
open
(
dest
,
'w'
)
as
fh
:
fh
.
write
(
dist
.
location
)
fh
.
write
(
dist
.
location
)
print
(
"dev"
,
dist
.
location
)
entries
.
append
(
dist
.
location
)
entries
.
append
(
dist
.
location
)
else
:
else
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'eggs-directory'
],
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'eggs-directory'
],
os
.
path
.
basename
(
dist
.
location
))
os
.
path
.
basename
(
dist
.
location
))
print
(
"cpy"
,
dest
)
entries
.
append
(
dest
)
entries
.
append
(
dest
)
if
not
os
.
path
.
exists
(
dest
):
if
not
os
.
path
.
exists
(
dest
):
if
os
.
path
.
isdir
(
dist
.
location
):
if
os
.
path
.
isdir
(
dist
.
location
):
shutil
.
copytree
(
dist
.
location
,
dest
)
shutil
.
copytree
(
dist
.
location
,
dest
)
else
:
else
:
shutil
.
copy2
(
dist
.
location
,
dest
)
shutil
.
copy2
(
dist
.
location
,
dest
)
ws
=
pkg_resources
.
WorkingSet
(
entries
)
# Ensure all the requirements are met
ws
=
pkg_resources
.
WorkingSet
(
entries
)
ws
.
require
(
'zc.buildout'
)
# Create buildout script
# 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
=
zc
.
buildout
.
easy_install
.
sort_working_set
(
ws
,
ws
,
eggs_dir
=
eggs_dir
,
eggs_dir
=
eggs_dir
,
develop_eggs_dir
=
develop_eggs_dir
develop_eggs_dir
=
None
)
)
zc
.
buildout
.
easy_install
.
scripts
(
zc
.
buildout
.
easy_install
.
scripts
(
[
'zc.buildout'
],
ws
,
sys
.
executable
,
[
'zc.buildout'
],
ws
,
sys
.
executable
,
...
...
src/zc/buildout/easy_install.py
View file @
b0859c20
...
@@ -69,6 +69,10 @@ default_index_url = os.environ.get(
...
@@ -69,6 +69,10 @@ default_index_url = os.environ.get(
)
)
logger
=
logging
.
getLogger
(
'zc.buildout.easy_install'
)
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
url_match
=
re
.
compile
(
'[a-z0-9+.-]+://'
).
match
is_source_encoding_line
=
re
.
compile
(
r'coding[:=]\
s*([-
\w.]+)'
).
search
is_source_encoding_line
=
re
.
compile
(
r'coding[:=]\
s*([-
\w.]+)'
).
search
...
@@ -1954,8 +1958,10 @@ def _move_to_eggs_dir_and_compile(dist, dest):
...
@@ -1954,8 +1958,10 @@ def _move_to_eggs_dir_and_compile(dist, dest):
return
newdist
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
()
develop_paths
=
set
()
if
develop_eggs_dir
:
pattern
=
os
.
path
.
join
(
develop_eggs_dir
,
'*.egg-link'
)
pattern
=
os
.
path
.
join
(
develop_eggs_dir
,
'*.egg-link'
)
for
egg_link
in
glob
.
glob
(
pattern
):
for
egg_link
in
glob
.
glob
(
pattern
):
with
open
(
egg_link
,
'rt'
)
as
f
:
with
open
(
egg_link
,
'rt'
)
as
f
:
...
@@ -1963,6 +1969,9 @@ def sort_working_set(ws, eggs_dir, develop_eggs_dir):
...
@@ -1963,6 +1969,9 @@ def sort_working_set(ws, eggs_dir, develop_eggs_dir):
if
path
:
if
path
:
develop_paths
.
add
(
path
)
develop_paths
.
add
(
path
)
print
(
develop_paths
)
print
(
ws
.
entries
)
print
([
dist
for
dist
in
ws
])
sorted_paths
=
[]
sorted_paths
=
[]
egg_paths
=
[]
egg_paths
=
[]
other_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