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
15fe9c1b
Commit
15fe9c1b
authored
Mar 15, 2018
by
Jason R. Coombs
Committed by
GitHub
Mar 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1286 from di/pep-566-updates
Updates for Metadata 2.1 (PEP 566)
parents
4176ab56
fe97cb54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
4 deletions
+48
-4
CHANGES.rst
CHANGES.rst
+5
-0
setuptools/dist.py
setuptools/dist.py
+23
-4
setuptools/tests/test_config.py
setuptools/tests/test_config.py
+1
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+19
-0
No files found.
CHANGES.rst
View file @
15fe9c1b
v38
.6.0
-------
*
#
1286
:
Add
support
for
Metadata
2.1
(
PEP
566
).
v38
.5.2
-------
...
...
setuptools/dist.py
View file @
15fe9c1b
...
...
@@ -46,6 +46,8 @@ def write_pkg_file(self, file):
# Setuptools specific for PEP 345
if
hasattr
(
self
,
'python_requires'
)
or
self
.
project_urls
:
version
=
'1.2'
if
self
.
long_description_content_type
or
self
.
provides_extras
:
version
=
'2.1'
file
.
write
(
'Metadata-Version: %s
\
n
'
%
version
)
file
.
write
(
'Name: %s
\
n
'
%
self
.
get_name
())
...
...
@@ -60,10 +62,6 @@ def write_pkg_file(self, file):
for
project_url
in
self
.
project_urls
.
items
():
file
.
write
(
'Project-URL: %s, %s
\
n
'
%
project_url
)
long_desc_content_type
=
\
self
.
long_description_content_type
or
'UNKNOWN'
file
.
write
(
'Description-Content-Type: %s
\
n
'
%
long_desc_content_type
)
long_desc
=
rfc822_escape
(
self
.
get_long_description
())
file
.
write
(
'Description: %s
\
n
'
%
long_desc
)
...
...
@@ -83,6 +81,16 @@ def write_pkg_file(self, file):
if
hasattr
(
self
,
'python_requires'
):
file
.
write
(
'Requires-Python: %s
\
n
'
%
self
.
python_requires
)
# PEP 566
if
self
.
long_description_content_type
:
file
.
write
(
'Description-Content-Type: %s
\
n
'
%
self
.
long_description_content_type
)
if
self
.
provides_extras
:
for
extra
in
self
.
provides_extras
:
file
.
write
(
'Provides-Extra: %s
\
n
'
%
extra
)
# from Python 3.4
def
write_pkg_info
(
self
,
base_dir
):
...
...
@@ -339,6 +347,9 @@ class Distribution(Distribution_parse_config_files, _Distribution):
self.metadata.long_description_content_type = attrs.get(
'
long_description_content_type
'
)
self.metadata.provides_extras = getattr(
self.metadata, '
provides_extras
', set()
)
if isinstance(self.metadata.version, numbers.Number):
# Some people apparently take "version number" too literally :)
...
...
@@ -372,6 +383,14 @@ class Distribution(Distribution_parse_config_files, _Distribution):
"""
if getattr(self, '
python_requires
', None):
self.metadata.python_requires = self.python_requires
if getattr(self, '
extras_require
', None):
for extra in self.extras_require.keys():
# Since this gets called multiple times at points where the
# keys have become '
converted
' extras, ensure that we are only
# truly adding extras we haven'
t
seen
before
here
.
self
.
metadata
.
provides_extras
.
add
(
extra
.
split
(
':'
)[
0
])
self
.
_convert_extras_requirements
()
self
.
_move_install_requirements_markers
()
...
...
setuptools/tests/test_config.py
View file @
15fe9c1b
...
...
@@ -546,6 +546,7 @@ class TestOptions:
'pdf'
:
[
'ReportLab>=1.2'
,
'RXP'
],
'rest'
:
[
'docutils>=0.3'
,
'pack==1.1,==1.3'
]
}
assert
dist
.
metadata
.
provides_extras
==
set
([
'pdf'
,
'rest'
])
def
test_entry_points
(
self
,
tmpdir
):
_
,
config
=
fake_env
(
...
...
setuptools/tests/test_egg_info.py
View file @
15fe9c1b
...
...
@@ -420,6 +420,24 @@ class TestEggInfo(object):
self
.
_run_install_command
(
tmpdir_cwd
,
env
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_provides_extra
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
'extras_require={"foobar": ["barbazquux"]},'
)
environ
=
os
.
environ
.
copy
().
update
(
HOME
=
env
.
paths
[
'home'
],
)
code
,
data
=
environment
.
run_setup_py
(
cmd
=
[
'egg_info'
],
pypath
=
os
.
pathsep
.
join
([
env
.
paths
[
'lib'
],
str
(
tmpdir_cwd
)]),
data_stream
=
1
,
env
=
environ
,
)
egg_info_dir
=
os
.
path
.
join
(
'.'
,
'foo.egg-info'
)
with
open
(
os
.
path
.
join
(
egg_info_dir
,
'PKG-INFO'
))
as
pkginfo_file
:
pkg_info_lines
=
pkginfo_file
.
read
().
split
(
'
\
n
'
)
assert
'Provides-Extra: foobar'
in
pkg_info_lines
assert
'Metadata-Version: 2.1'
in
pkg_info_lines
def
test_long_description_content_type
(
self
,
tmpdir_cwd
,
env
):
# Test that specifying a `long_description_content_type` keyword arg to
# the `setup` function results in writing a `Description-Content-Type`
...
...
@@ -444,6 +462,7 @@ class TestEggInfo(object):
pkg_info_lines
=
pkginfo_file
.
read
().
split
(
'
\
n
'
)
expected_line
=
'Description-Content-Type: text/markdown'
assert
expected_line
in
pkg_info_lines
assert
'Metadata-Version: 2.1'
in
pkg_info_lines
def
test_project_urls
(
self
,
tmpdir_cwd
,
env
):
# Test that specifying a `project_urls` dict to the `setup`
...
...
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