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
28e1b5ab
Commit
28e1b5ab
authored
Jul 13, 2020
by
Paul Ganssle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use .pth file to import distutils from setuptools
parent
37d81f4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
0 deletions
+43
-0
MANIFEST.in
MANIFEST.in
+1
-0
_distutils_importer/__init__.py
_distutils_importer/__init__.py
+6
-0
_distutils_importer/distutils-shim-package/distutils/__init__.py
...ils_importer/distutils-shim-package/distutils/__init__.py
+3
-0
distutils_precedence.pth
distutils_precedence.pth
+1
-0
setup.py
setup.py
+32
-0
No files found.
MANIFEST.in
View file @
28e1b5ab
...
...
@@ -13,4 +13,5 @@ include launcher.c
include msvc-build-launcher.cmd
include pytest.ini
include tox.ini
include distutils_precedence.pth
exclude pyproject.toml # Temporary workaround for #1644.
_distutils_importer/__init__.py
0 → 100644
View file @
28e1b5ab
import
sys
here
=
os
.
path
.
dirname
(
__file__
)
NEW_DISTUTILS_LOCATION
=
os
.
path
.
join
(
here
,
'distutils-shim-package'
)
sys
.
path
.
insert
(
0
,
NEW_DISTUTILS_LOCATION
)
_distutils_importer/distutils-shim-package/distutils/__init__.py
0 → 100644
View file @
28e1b5ab
import
setuptools.distutils_patch
from
distutils
import
*
distutils_precedence.pth
0 → 100644
View file @
28e1b5ab
import os; (os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') == 'local' and __import__('_distutils_importer'))
setup.py
View file @
28e1b5ab
...
...
@@ -7,6 +7,7 @@ import os
import
sys
import
setuptools
from
setuptools.command.install
import
install
here
=
os
.
path
.
dirname
(
__file__
)
...
...
@@ -49,6 +50,7 @@ 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
=
(
...
...
@@ -81,8 +83,38 @@ def pypi_link(pkg_filename):
return
'/'
.
join
(
parts
)
class
install_with_pth
(
install
):
"""
Custom install command to install a .pth file for distutils patching.
This is necessary because there's no standard way to install a `.pth` file
alongside your package (and there probably shouldn't be one), but we need
to do this in order to give precedence higher precedence to our version of
`distutils` than the standard library.
"""
def
initialize_options
(
self
):
install
.
initialize_options
(
self
)
name
=
'distutils_precedence'
with
open
(
os
.
path
.
join
(
here
,
name
+
'.pth'
),
'rt'
)
as
f
:
contents
=
f
.
read
()
self
.
extra_path
=
(
name
,
contents
)
def
finalize_options
(
self
):
install
.
finalize_options
(
self
)
install_suffix
=
os
.
path
.
relpath
(
self
.
install_lib
,
self
.
install_libbase
)
if
install_suffix
==
self
.
extra_path
[
1
]:
self
.
install_lib
=
self
.
install_libbase
setup_params
=
dict
(
src_root
=
None
,
cmdclass
=
{
'install'
:
install_with_pth
},
package_data
=
package_data
,
entry_points
=
{
"distutils.commands"
:
[
...
...
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