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
b639cf0f
Commit
b639cf0f
authored
Jan 04, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use six in pkg_resources.
--HG-- branch : feature/issue-229
parent
a2484bd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
25 deletions
+11
-25
pkg_resources/__init__.py
pkg_resources/__init__.py
+9
-22
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+2
-3
No files found.
pkg_resources/__init__.py
View file @
b639cf0f
...
...
@@ -37,7 +37,6 @@ import plistlib
import
email.parser
import
tempfile
import
textwrap
import
itertools
from
pkgutil
import
get_importer
try
:
...
...
@@ -46,23 +45,8 @@ except ImportError:
# Python 3.2 compatibility
import
imp
as
_imp
PY3
=
sys
.
version_info
>
(
3
,)
PY2
=
not
PY3
if
PY3
:
from
urllib.parse
import
urlparse
,
urlunparse
if
PY2
:
from
urlparse
import
urlparse
,
urlunparse
filter
=
itertools
.
ifilter
map
=
itertools
.
imap
if
PY3
:
string_types
=
str
,
else
:
string_types
=
str
,
eval
(
'unicode'
)
iteritems
=
(
lambda
i
:
i
.
items
())
if
PY3
else
lambda
i
:
i
.
iteritems
()
from
pkg_resources.extern
import
six
from
pkg_resources.extern.six.moves
import
urllib
# capture these to bypass sandboxing
from
os
import
utime
...
...
@@ -92,6 +76,9 @@ __import__('pkg_resources.extern.packaging.version')
__import__
(
'pkg_resources.extern.packaging.specifiers'
)
filter
=
six
.
moves
.
filter
map
=
six
.
moves
.
map
if
(
3
,
0
)
<
sys
.
version_info
<
(
3
,
3
):
msg
=
(
"Support for Python 3.0-3.2 has been dropped. Future versions "
...
...
@@ -549,7 +536,7 @@ run_main = run_script
def get_distribution(dist):
"""
Return
a
current
distribution
object
for
a
Requirement
or
string
"""
if isinstance(dist, string_types):
if isinstance(dist, s
ix.s
tring_types):
dist = Requirement.parse(dist)
if isinstance(dist, Requirement):
dist = get_provider(dist)
...
...
@@ -2297,7 +2284,7 @@ def _set_parent_ns(packageName):
def
yield_lines
(
strs
):
"""Yield non-empty/non-comment lines of a string or sequence"""
if
isinstance
(
strs
,
string_types
):
if
isinstance
(
strs
,
s
ix
.
s
tring_types
):
for
s
in
strs
.
splitlines
():
s
=
s
.
strip
()
# skip blank lines/comments
...
...
@@ -2464,9 +2451,9 @@ class EntryPoint(object):
def _remove_md5_fragment(location):
if not location:
return ''
parsed = urlparse(location)
parsed = url
lib.parse.url
parse(location)
if parsed[-1].startswith('
md5
=
'):
return urlunparse(parsed[:-1] + ('',))
return url
lib.parse.url
unparse(parsed[:-1] + ('',))
return location
...
...
pkg_resources/tests/test_resources.py
View file @
b639cf0f
...
...
@@ -244,9 +244,8 @@ class TestWorkingSet:
with
pytest
.
raises
(
VersionConflict
)
as
vc
:
ws
.
resolve
(
parse_requirements
(
"Foo
\
n
Bar
\
n
"
))
msg
=
"Baz 1.0 is installed but Baz==2.0 is required by {'Bar'}"
if
pkg_resources
.
PY2
:
msg
=
msg
.
replace
(
"{'Bar'}"
,
"set(['Bar'])"
)
msg
=
"Baz 1.0 is installed but Baz==2.0 is required by "
msg
+=
repr
(
set
([
'Bar'
]))
assert
vc
.
value
.
report
()
==
msg
...
...
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