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
d92bc63d
Commit
d92bc63d
authored
Mar 18, 2018
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delint
parent
ad2d7e48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
setuptools/dist.py
setuptools/dist.py
+3
-2
setuptools/tests/test_dist.py
setuptools/tests/test_dist.py
+21
-10
No files found.
setuptools/dist.py
View file @
d92bc63d
...
@@ -36,6 +36,7 @@ def _get_unpatched(cls):
...
@@ -36,6 +36,7 @@ def _get_unpatched(cls):
warnings
.
warn
(
"Do not call this function"
,
DeprecationWarning
)
warnings
.
warn
(
"Do not call this function"
,
DeprecationWarning
)
return
get_unpatched
(
cls
)
return
get_unpatched
(
cls
)
def
get_metadata_version
(
dist_md
):
def
get_metadata_version
(
dist_md
):
if
dist_md
.
long_description_content_type
or
dist_md
.
provides_extras
:
if
dist_md
.
long_description_content_type
or
dist_md
.
provides_extras
:
return
StrictVersion
(
'2.1'
)
return
StrictVersion
(
'2.1'
)
...
@@ -76,7 +77,7 @@ def write_pkg_file(self, file):
...
@@ -76,7 +77,7 @@ def write_pkg_file(self, file):
for
field
,
attr
in
optional_fields
:
for
field
,
attr
in
optional_fields
:
attr_val
=
getattr
(
self
,
attr
)
attr_val
=
getattr
(
self
,
attr
)
if
six
.
PY2
:
if
six
.
PY2
:
attr_val
=
self
.
_encode_field
(
attr_val
)
attr_val
=
self
.
_encode_field
(
attr_val
)
if
attr_val
is
not
None
:
if
attr_val
is
not
None
:
file
.
write
(
'%s: %s
\
n
'
%
(
field
,
attr_val
))
file
.
write
(
'%s: %s
\
n
'
%
(
field
,
attr_val
))
...
@@ -562,7 +563,7 @@ class Distribution(Distribution_parse_config_files, _Distribution):
...
@@ -562,7 +563,7 @@ class Distribution(Distribution_parse_config_files, _Distribution):
# don't use any other settings
# don't use any other settings
'find_links'
,
'site_dirs'
,
'index_url'
,
'find_links'
,
'site_dirs'
,
'index_url'
,
'optimize'
,
'site_dirs'
,
'allow_hosts'
,
'optimize'
,
'site_dirs'
,
'allow_hosts'
,
))
))
if
self
.
dependency_links
:
if
self
.
dependency_links
:
links
=
self
.
dependency_links
[:]
links
=
self
.
dependency_links
[:]
if
'find_links'
in
opts
:
if
'find_links'
in
opts
:
...
...
setuptools/tests/test_dist.py
View file @
d92bc63d
...
@@ -11,12 +11,14 @@ from .test_easy_install import make_nspkg_sdist
...
@@ -11,12 +11,14 @@ from .test_easy_install import make_nspkg_sdist
import
pytest
import
pytest
def
test_dist_fetch_build_egg
(
tmpdir
):
def
test_dist_fetch_build_egg
(
tmpdir
):
"""
"""
Check multiple calls to `Distribution.fetch_build_egg` work as expected.
Check multiple calls to `Distribution.fetch_build_egg` work as expected.
"""
"""
index
=
tmpdir
.
mkdir
(
'index'
)
index
=
tmpdir
.
mkdir
(
'index'
)
index_url
=
urljoin
(
'file://'
,
pathname2url
(
str
(
index
)))
index_url
=
urljoin
(
'file://'
,
pathname2url
(
str
(
index
)))
def
sdist_with_index
(
distname
,
version
):
def
sdist_with_index
(
distname
,
version
):
dist_dir
=
index
.
mkdir
(
distname
)
dist_dir
=
index
.
mkdir
(
distname
)
dist_sdist
=
'%s-%s.tar.gz'
%
(
distname
,
version
)
dist_sdist
=
'%s-%s.tar.gz'
%
(
distname
,
version
)
...
@@ -65,35 +67,45 @@ def __maintainer_test_cases():
...
@@ -65,35 +67,45 @@ def __maintainer_test_cases():
test_cases
=
[
test_cases
=
[
(
'No author, no maintainer'
,
attrs
.
copy
()),
(
'No author, no maintainer'
,
attrs
.
copy
()),
(
'Author (no e-mail), no maintainer'
,
merge_dicts
(
attrs
,
(
'Author (no e-mail), no maintainer'
,
merge_dicts
(
attrs
,
{
'author'
:
'Author Name'
})),
{
'author'
:
'Author Name'
})),
(
'Author (e-mail), no maintainer'
,
merge_dicts
(
attrs
,
(
'Author (e-mail), no maintainer'
,
merge_dicts
(
attrs
,
{
'author'
:
'Author Name'
,
{
'author'
:
'Author Name'
,
'author_email'
:
'author@name.com'
})),
'author_email'
:
'author@name.com'
})),
(
'No author, maintainer (no e-mail)'
,
merge_dicts
(
attrs
,
(
'No author, maintainer (no e-mail)'
,
merge_dicts
(
attrs
,
{
'maintainer'
:
'Maintainer Name'
})),
{
'maintainer'
:
'Maintainer Name'
})),
(
'No author, maintainer (e-mail)'
,
merge_dicts
(
attrs
,
(
'No author, maintainer (e-mail)'
,
merge_dicts
(
attrs
,
{
'maintainer'
:
'Maintainer Name'
,
{
'maintainer'
:
'Maintainer Name'
,
'maintainer_email'
:
'maintainer@name.com'
})),
'maintainer_email'
:
'maintainer@name.com'
})),
(
'Author (no e-mail), Maintainer (no-email)'
,
merge_dicts
(
attrs
,
(
'Author (no e-mail), Maintainer (no-email)'
,
merge_dicts
(
attrs
,
{
'author'
:
'Author Name'
,
{
'author'
:
'Author Name'
,
'maintainer'
:
'Maintainer Name'
})),
'maintainer'
:
'Maintainer Name'
})),
(
'Author (e-mail), Maintainer (e-mail)'
,
merge_dicts
(
attrs
,
(
'Author (e-mail), Maintainer (e-mail)'
,
merge_dicts
(
attrs
,
{
'author'
:
'Author Name'
,
{
'author'
:
'Author Name'
,
'author_email'
:
'author@name.com'
,
'author_email'
:
'author@name.com'
,
'maintainer'
:
'Maintainer Name'
,
'maintainer'
:
'Maintainer Name'
,
'maintainer_email'
:
'maintainer@name.com'
})),
'maintainer_email'
:
'maintainer@name.com'
})),
(
'No author (e-mail), no maintainer (e-mail)'
,
merge_dicts
(
attrs
,
(
'No author (e-mail), no maintainer (e-mail)'
,
merge_dicts
(
attrs
,
{
'author_email'
:
'author@name.com'
,
{
'author_email'
:
'author@name.com'
,
'maintainer_email'
:
'maintainer@name.com'
})),
'maintainer_email'
:
'maintainer@name.com'
})),
(
'Author unicode'
,
merge_dicts
(
attrs
,
(
'Author unicode'
,
merge_dicts
(
attrs
,
{
'author'
:
'鉄沢寛'
})),
{
'author'
:
'鉄沢寛'
})),
(
'Maintainer unicode'
,
merge_dicts
(
attrs
,
(
'Maintainer unicode'
,
merge_dicts
(
attrs
,
{
'maintainer'
:
'Jan Łukasiewicz'
})),
{
'maintainer'
:
'Jan Łukasiewicz'
})),
]
]
return
test_cases
return
test_cases
@
pytest
.
mark
.
parametrize
(
'name,attrs'
,
__maintainer_test_cases
())
@
pytest
.
mark
.
parametrize
(
'name,attrs'
,
__maintainer_test_cases
())
def
test_maintainer_author
(
name
,
attrs
,
tmpdir
):
def
test_maintainer_author
(
name
,
attrs
,
tmpdir
):
tested_keys
=
{
tested_keys
=
{
...
@@ -127,4 +139,3 @@ def test_maintainer_author(name, attrs, tmpdir):
...
@@ -127,4 +139,3 @@ def test_maintainer_author(name, attrs, tmpdir):
else
:
else
:
line
=
'%s: %s'
%
(
fkey
,
val
)
line
=
'%s: %s'
%
(
fkey
,
val
)
assert
line
in
pkg_lines_set
assert
line
in
pkg_lines_set
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