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
4e5c1640
Commit
4e5c1640
authored
Oct 12, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move customized behavior for fetch_build_eggs into a specialized subclass of Distribution.
parent
84a97be0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
setuptools/dist.py
setuptools/dist.py
+0
-10
setuptools/pep517.py
setuptools/pep517.py
+30
-6
No files found.
setuptools/dist.py
View file @
4e5c1640
...
...
@@ -30,14 +30,6 @@ __import__('pkg_resources.extern.packaging.specifiers')
__import__
(
'pkg_resources.extern.packaging.version'
)
_skip_install_eggs
=
False
class
SetupRequirementsError
(
BaseException
):
def
__init__
(
self
,
specifiers
):
self
.
specifiers
=
specifiers
def
_get_unpatched
(
cls
):
warnings
.
warn
(
"Do not call this function"
,
DeprecationWarning
)
return
get_unpatched
(
cls
)
...
...
@@ -340,8 +332,6 @@ class Distribution(Distribution_parse_config_files, _Distribution):
self.dependency_links = attrs.pop('
dependency_links
', [])
assert_string_list(self, '
dependency_links
', self.dependency_links)
if attrs and '
setup_requires
' in attrs:
if _skip_install_eggs:
raise SetupRequirementsError(attrs['
setup_requires
'])
self.fetch_build_eggs(attrs['
setup_requires
'])
for ep in pkg_resources.iter_entry_points('
distutils
.
setup_keywords
'):
vars(self).setdefault(ep.name, None)
...
...
setuptools/pep517.py
View file @
4e5c1640
...
...
@@ -30,9 +30,35 @@ import os
import
sys
import
tokenize
import
shutil
import
contextlib
from
setuptools
import
dist
from
setuptools.dist
import
SetupRequirementsError
import
setuptools
import
distutils
class
SetupRequirementsError
(
BaseException
):
def
__init__
(
self
,
specifiers
):
self
.
specifiers
=
specifiers
class
Distribution
(
setuptools
.
dist
.
Distribution
):
def
fetch_build_eggs
(
self
,
specifiers
):
raise
SetupRequirementsError
(
specifiers
)
@
classmethod
@
contextlib
.
contextmanager
def
patch
(
cls
):
"""
Replace
distutils.dist.Distribution with this class
for the duration of this context.
"""
orig
=
distutils
.
core
.
Distribution
distutils
.
core
.
Distribution
=
cls
try
:
yield
finally
:
distutils
.
core
.
Distribution
=
orig
def
_run_setup
(
setup_script
=
'setup.py'
):
...
...
@@ -54,17 +80,15 @@ def _fix_config(config_settings):
def
_get_build_requires
(
config_settings
):
config_settings
=
_fix_config
(
config_settings
)
requirements
=
[
'setuptools'
,
'wheel'
]
dist
.
_skip_install_eggs
=
True
sys
.
argv
=
sys
.
argv
[:
1
]
+
[
'egg_info'
]
+
\
config_settings
[
"--global-option"
]
try
:
_run_setup
()
with
Distribution
.
patch
():
_run_setup
()
except
SetupRequirementsError
as
e
:
requirements
+=
e
.
specifiers
dist
.
_skip_install_eggs
=
False
return
requirements
...
...
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