Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
e4aa9070
Commit
e4aa9070
authored
May 29, 2020
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setuptools no longer installs a site.py file during easy_install or develop installs. Ref #2165.
parent
74de4e98
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
129 deletions
+2
-129
setuptools/command/develop.py
setuptools/command/develop.py
+0
-1
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+2
-42
setuptools/site-patch.py
setuptools/site-patch.py
+0
-76
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+0
-8
tox.ini
tox.ini
+0
-2
No files found.
setuptools/command/develop.py
View file @
e4aa9070
...
...
@@ -139,7 +139,6 @@ class develop(namespaces.DevelopInstaller, easy_install):
self
.
reinitialize_command
(
'build_ext'
,
inplace
=
1
)
self
.
run_command
(
'build_ext'
)
self
.
install_site_py
()
# ensure that target dir is site-safe
if
setuptools
.
bootstrap_install_from
:
self
.
easy_install
(
setuptools
.
bootstrap_install_from
)
setuptools
.
bootstrap_install_from
=
None
...
...
setuptools/command/easy_install.py
View file @
e4aa9070
...
...
@@ -205,7 +205,6 @@ class easy_install(Command):
self
.
pth_file
=
self
.
always_copy_from
=
None
self
.
site_dirs
=
None
self
.
installed_projects
=
{}
self
.
sitepy_installed
=
False
# Always read easy_install options, even if we are subclassed, or have
# an independent instance created. This ensures that defaults will
# always come from the standard configuration file(s)' "easy_install"
...
...
@@ -494,12 +493,8 @@ class easy_install(Command):
else
:
self
.
pth_file
=
None
if
instdir
not
in
map
(
normalize_path
,
_pythonpath
()):
# only PYTHONPATH dirs need a site.py, so pretend it's there
self
.
sitepy_installed
=
True
elif
self
.
multi_version
and
not
os
.
path
.
exists
(
pth_file
):
self
.
sitepy_installed
=
True
# don't need site.py in this case
self
.
pth_file
=
None
# and don't create a .pth file
if
self
.
multi_version
and
not
os
.
path
.
exists
(
pth_file
):
self
.
pth_file
=
None
# don't create a .pth file
self
.
install_dir
=
instdir
__cant_write_msg
=
textwrap
.
dedent
(
"""
...
...
@@ -656,9 +651,6 @@ class easy_install(Command):
os
.
path
.
exists
(
tmpdir
)
and
rmtree
(
rmtree_safe
(
tmpdir
))
def
easy_install
(
self
,
spec
,
deps
=
False
):
if
not
self
.
editable
:
self
.
install_site_py
()
with
self
.
_tmpdir
()
as
tmpdir
:
if
not
isinstance
(
spec
,
Requirement
):
if
URL_SCHEME
(
spec
):
...
...
@@ -1317,38 +1309,6 @@ class easy_install(Command):
Please make the appropriate changes for your system and try again.
"""
).
strip
()
def
install_site_py
(
self
):
"""Make sure there's a site.py in the target dir, if needed"""
if
self
.
sitepy_installed
:
return
# already did it, or don't need to
sitepy
=
os
.
path
.
join
(
self
.
install_dir
,
"site.py"
)
source
=
resource_string
(
"setuptools"
,
"site-patch.py"
)
source
=
source
.
decode
(
'utf-8'
)
current
=
""
if
os
.
path
.
exists
(
sitepy
):
log
.
debug
(
"Checking existing site.py in %s"
,
self
.
install_dir
)
with
io
.
open
(
sitepy
)
as
strm
:
current
=
strm
.
read
()
if
not
current
.
startswith
(
'def __boot():'
):
raise
DistutilsError
(
"%s is not a setuptools-generated site.py; please"
" remove it."
%
sitepy
)
if
current
!=
source
:
log
.
info
(
"Creating %s"
,
sitepy
)
if
not
self
.
dry_run
:
ensure_directory
(
sitepy
)
with
io
.
open
(
sitepy
,
'w'
,
encoding
=
'utf-8'
)
as
strm
:
strm
.
write
(
source
)
self
.
byte_compile
([
sitepy
])
self
.
sitepy_installed
=
True
def
create_home_path
(
self
):
"""Create directories under ~."""
if
not
self
.
user
:
...
...
setuptools/site-patch.py
deleted
100644 → 0
View file @
74de4e98
def
__boot
():
import
sys
import
os
PYTHONPATH
=
os
.
environ
.
get
(
'PYTHONPATH'
)
if
PYTHONPATH
is
None
or
(
sys
.
platform
==
'win32'
and
not
PYTHONPATH
):
PYTHONPATH
=
[]
else
:
PYTHONPATH
=
PYTHONPATH
.
split
(
os
.
pathsep
)
pic
=
getattr
(
sys
,
'path_importer_cache'
,
{})
stdpath
=
sys
.
path
[
len
(
PYTHONPATH
):]
mydir
=
os
.
path
.
dirname
(
__file__
)
for
item
in
stdpath
:
if
item
==
mydir
or
not
item
:
continue
# skip if current dir. on Windows, or my own directory
importer
=
pic
.
get
(
item
)
if
importer
is
not
None
:
loader
=
importer
.
find_module
(
'site'
)
if
loader
is
not
None
:
# This should actually reload the current module
loader
.
load_module
(
'site'
)
break
else
:
try
:
import
imp
# Avoid import loop in Python 3
stream
,
path
,
descr
=
imp
.
find_module
(
'site'
,
[
item
])
except
ImportError
:
continue
if
stream
is
None
:
continue
try
:
# This should actually reload the current module
imp
.
load_module
(
'site'
,
stream
,
path
,
descr
)
finally
:
stream
.
close
()
break
else
:
raise
ImportError
(
"Couldn't find the real 'site' module"
)
# 2.2 comp
known_paths
=
dict
([(
makepath
(
item
)[
1
],
1
)
for
item
in
sys
.
path
])
# noqa
oldpos
=
getattr
(
sys
,
'__egginsert'
,
0
)
# save old insertion position
sys
.
__egginsert
=
0
# and reset the current one
for
item
in
PYTHONPATH
:
addsitedir
(
item
)
# noqa
sys
.
__egginsert
+=
oldpos
# restore effective old position
d
,
nd
=
makepath
(
stdpath
[
0
])
# noqa
insert_at
=
None
new_path
=
[]
for
item
in
sys
.
path
:
p
,
np
=
makepath
(
item
)
# noqa
if
np
==
nd
and
insert_at
is
None
:
# We've hit the first 'system' path entry, so added entries go here
insert_at
=
len
(
new_path
)
if
np
in
known_paths
or
insert_at
is
None
:
new_path
.
append
(
item
)
else
:
# new path after the insert point, back-insert it
new_path
.
insert
(
insert_at
,
item
)
insert_at
+=
1
sys
.
path
[:]
=
new_path
if
__name__
==
'site'
:
__boot
()
del
__boot
setuptools/tests/test_easy_install.py
View file @
e4aa9070
...
...
@@ -61,14 +61,6 @@ SETUP_PY = DALS("""
class
TestEasyInstallTest
:
def
test_install_site_py
(
self
,
tmpdir
):
dist
=
Distribution
()
cmd
=
ei
.
easy_install
(
dist
)
cmd
.
sitepy_installed
=
False
cmd
.
install_dir
=
str
(
tmpdir
)
cmd
.
install_site_py
()
assert
(
tmpdir
/
'site.py'
).
exists
()
def
test_get_script_args
(
self
):
header
=
ei
.
CommandSpec
.
best
().
from_environment
().
as_header
()
expected
=
header
+
DALS
(
r"""
...
...
tox.ini
View file @
e4aa9070
...
...
@@ -7,8 +7,6 @@ envlist=python
minversion
=
3.2
requires
=
tox-pip-version
>=
0.0.6
# workaround for #1998
virtualenv
<
20
; python_version=="2.7"
[helpers]
# Custom pip behavior
...
...
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