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
b59076e9
Commit
b59076e9
authored
May 21, 2017
by
xoviat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep517: add module
Add a module that implements the PEP 517 specification.
parent
1b192005
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
setuptools/dist.py
setuptools/dist.py
+12
-1
setuptools/pep517.py
setuptools/pep517.py
+70
-0
No files found.
setuptools/dist.py
View file @
b59076e9
...
...
@@ -30,6 +30,14 @@ __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
)
...
...
@@ -332,6 +340,9 @@ 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
'])
else:
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
0 → 100644
View file @
b59076e9
import
os
import
sys
import
subprocess
import
tokenize
import
shutil
import
tempfile
from
setuptools
import
dist
from
setuptools.dist
import
SetupRequirementsError
SETUPTOOLS_IMPLEMENTATION_REVISION
=
0.1
def
_run_setup
(
setup_script
=
'setup.py'
):
#
# Note that we can reuse our build directory between calls
# Correctness comes first, then optimization later
__file__
=
setup_script
f
=
getattr
(
tokenize
,
'open'
,
open
)(
__file__
)
code
=
f
.
read
().
replace
(
'
\
\
r
\
\
n'
,
'
\
\
n'
)
f
.
close
()
exec
(
compile
(
code
,
__file__
,
'exec'
))
def
get_build_requires
(
config_settings
):
requirements
=
[
'setuptools'
,
'wheel'
]
dist
.
skip_install_eggs
=
True
sys
.
argv
=
sys
.
argv
[:
1
]
+
[
'egg_info'
]
+
\
config_settings
[
"--global-option"
]
try
:
_run_setup
()
except
SetupRequirementsError
as
e
:
requirements
+=
e
.
specifiers
dist
.
skip_install_eggs
=
False
return
requirements
def
get_requires_for_build_wheel
(
config_settings
=
None
):
return
get_build_requires
(
config_settings
)
def
get_requires_for_build_sdist
(
config_settings
=
None
):
return
get_build_requires
(
config_settings
)
def
prepare_metadata_for_build_wheel
(
metadata_directory
,
config_settings
=
None
):
sys
.
argv
=
sys
.
argv
[:
1
]
+
[
'dist_info'
,
'--egg-base'
,
metadata_directory
]
_run_setup
()
def
build_wheel
(
wheel_directory
,
config_settings
=
None
,
metadata_directory
=
None
):
wheel_directory
=
os
.
path
.
abspath
(
wheel_directory
)
sys
.
argv
=
sys
.
argv
[:
1
]
+
[
'bdist_wheel'
]
+
\
config_settings
[
"--global-option"
]
_run_setup
()
if
wheel_directory
!=
'dist'
:
shutil
.
rmtree
(
wheel_directory
)
shutil
.
copytree
(
'dist'
,
wheel_directory
)
def
build_sdist
(
sdist_directory
,
config_settings
=
None
):
sdist_directory
=
os
.
path
.
abspath
(
sdist_directory
)
sys
.
argv
=
sys
.
argv
[:
1
]
+
[
'sdist'
]
+
\
config_settings
[
"--global-option"
]
_run_setup
()
if
sdist_directory
!=
'dist'
:
shutil
.
rmtree
(
sdist_directory
)
shutil
.
copytree
(
'dist'
,
sdist_directory
)
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