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
370839b4
Commit
370839b4
authored
Jul 13, 2020
by
Paul Ganssle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use import hook instead of sys.path manipulation
parent
642604f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
_distutils_importer/__init__.py
_distutils_importer/__init__.py
+27
-5
_distutils_importer/distutils-shim-package/distutils/__init__.py
...ils_importer/distutils-shim-package/distutils/__init__.py
+0
-3
setup.py
setup.py
+0
-1
No files found.
_distutils_importer/__init__.py
View file @
370839b4
import
sys
_HERE
=
os
.
path
.
dirname
(
__file__
)
NEW_DISTUTILS_LOCATION
=
os
.
path
.
join
(
_HERE
,
'distutils-shim-package'
)
class
DistutilsMetaFinder
:
def
find_spec
(
self
,
fullname
,
path
,
target
=
None
):
if
path
is
not
None
or
fullname
!=
"distutils"
:
return
None
return
self
.
get_distutils_spec
()
def
get_distutils_spec
(
self
):
import
importlib
class
DistutilsLoader
(
importlib
.
util
.
abc
.
Loader
):
def
create_module
(
self
,
spec
):
return
importlib
.
import_module
(
'._distutils'
,
'setuptools'
)
def
exec_module
(
self
,
module
):
pass
return
importlib
.
util
.
spec_from_loader
(
'distutils'
,
DistutilsLoader
())
DISTUTILS_FINDER
=
DistutilsMetaFinder
()
def
add_shim
():
if
NEW_DISTUTILS_LOCATION
not
in
sys
.
path
:
sys
.
path
.
insert
(
0
,
NEW_DISTUTILS_LOCATION
)
sys
.
meta_path
.
insert
(
0
,
DISTUTILS_FINDER
)
def
remove_shim
():
try
:
sys
.
path
.
remove
(
NEW_DISTUTILS_LOCATION
)
sys
.
path
.
remove
(
DISTUTILS_FINDER
)
except
ValueError
:
pass
...
...
_distutils_importer/distutils-shim-package/distutils/__init__.py
deleted
100644 → 0
View file @
642604f8
import
setuptools.distutils_patch
from
distutils
import
*
setup.py
View file @
370839b4
...
...
@@ -50,7 +50,6 @@ def _gen_console_scripts():
package_data
=
dict
(
setuptools
=
[
'script (dev).tmpl'
,
'script.tmpl'
,
'site-patch.py'
],
_distutils_importer
=
[
'distutils-shim-package/distutils/__init__.py'
],
)
force_windows_specific_files
=
(
...
...
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