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
b2607926
Commit
b2607926
authored
Apr 26, 2024
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wkrd] Warn when bootstrap finds dists in site-packages
And avoid creating a .egg-link pointing to site-packages.
parent
a9f7e496
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+26
-7
No files found.
src/zc/buildout/buildout.py
View file @
b2607926
...
@@ -762,10 +762,15 @@ class Buildout(DictMixin):
...
@@ -762,10 +762,15 @@ class Buildout(DictMixin):
# nothing will be installed, but then we'll copy them to
# nothing will be installed, but then we'll copy them to
# the local eggs or develop-eggs folder just after this.
# the local eggs or develop-eggs folder just after this.
# XXX Note: except if the current modules are not eggs, in which case
# XXX Note: except if the current modules are not eggs. In particular,
# we'll create .egg-link to them. This applies to packages installed
# this concerns .dist-info packages installed by pip in site-packages
# in site-packages by pip (.dist-info, not .egg), which in turn would
# or elsewhere: setuptools does not distinguish dists installed by pip
# cause site-packages to be in the sys.path of the generated script.
# from actual develop dists. This may lead to the creation of .egg-link
# files in ./develop-eggs linking to the original location.
# A special-case exception is made when the location is site-packages
# to avoid putting links to site-packages in ./develop-eggs. This is
# merely a mitigation and does not preclude other shared locations
# being linked in ./develop-eggs.
# Sort the working set to keep entries with single dists first.
# Sort the working set to keep entries with single dists first.
options
=
self
[
'buildout'
]
options
=
self
[
'buildout'
]
...
@@ -783,14 +788,28 @@ class Buildout(DictMixin):
...
@@ -783,14 +788,28 @@ class Buildout(DictMixin):
# XXX Note: dists using .dist-info format - e.g. packages installed by
# XXX Note: dists using .dist-info format - e.g. packages installed by
# pip in site-packages - will be seen as develop dists and not copied.
# pip in site-packages - will be seen as develop dists and not copied.
egg_entries
=
[]
egg_entries
=
[]
link
_dists
=
[]
develop
_dists
=
[]
for
dist
in
ws
:
for
dist
in
ws
:
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
develop_dists
.
append
(
dist
)
if
dist
.
location
==
zc
.
buildout
.
easy_install
.
python_lib
:
# Special-case exception for site-packages
self
.
_logger
.
warning
(
"Distribution %s was found in sites-packages (%s). "
"Avoiding creating a link in develop-eggs-directory.
\
n
"
"Consider using 'buildout:extra-paths=' to install it "
"from scratch in isolation directly in eggs-directory."
%
(
dist
,
dist
.
location
))
# XXX: TODO: Ideally we should be able to distinguish
# .dist-info dists from develop dists, and support bundling
# .dist-info packages into individual '.dist' bundles that
# could be put in ./eggs, with support in buildout for
# using such distribution.
continue
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
)
link_dists
.
append
(
dist
)
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
))
...
@@ -807,7 +826,7 @@ class Buildout(DictMixin):
...
@@ -807,7 +826,7 @@ class Buildout(DictMixin):
# unneded dists at the same location, and we can because these are the
# unneded dists at the same location, and we can because these are the
# same dists as before as they were not copied.
# same dists as before as they were not copied.
ws
=
pkg_resources
.
WorkingSet
(
egg_entries
)
ws
=
pkg_resources
.
WorkingSet
(
egg_entries
)
for
dist
in
link
_dists
:
for
dist
in
develop
_dists
:
ws
.
add
(
dist
)
ws
.
add
(
dist
)
ws
.
require
(
'zc.buildout'
)
ws
.
require
(
'zc.buildout'
)
...
...
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