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
...
@@ -37,7 +37,6 @@ import plistlib
import
email.parser
import
email.parser
import
tempfile
import
tempfile
import
textwrap
import
textwrap
import
itertools
from
pkgutil
import
get_importer
from
pkgutil
import
get_importer
try
:
try
:
...
@@ -46,23 +45,8 @@ except ImportError:
...
@@ -46,23 +45,8 @@ except ImportError:
# Python 3.2 compatibility
# Python 3.2 compatibility
import
imp
as
_imp
import
imp
as
_imp
PY3
=
sys
.
version_info
>
(
3
,)
from
pkg_resources.extern
import
six
PY2
=
not
PY3
from
pkg_resources.extern.six.moves
import
urllib
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
()
# capture these to bypass sandboxing
# capture these to bypass sandboxing
from
os
import
utime
from
os
import
utime
...
@@ -92,6 +76,9 @@ __import__('pkg_resources.extern.packaging.version')
...
@@ -92,6 +76,9 @@ __import__('pkg_resources.extern.packaging.version')
__import__
(
'pkg_resources.extern.packaging.specifiers'
)
__import__
(
'pkg_resources.extern.packaging.specifiers'
)
filter
=
six
.
moves
.
filter
map
=
six
.
moves
.
map
if
(
3
,
0
)
<
sys
.
version_info
<
(
3
,
3
):
if
(
3
,
0
)
<
sys
.
version_info
<
(
3
,
3
):
msg
=
(
msg
=
(
"Support for Python 3.0-3.2 has been dropped. Future versions "
"Support for Python 3.0-3.2 has been dropped. Future versions "
...
@@ -549,7 +536,7 @@ run_main = run_script
...
@@ -549,7 +536,7 @@ run_main = run_script
def get_distribution(dist):
def get_distribution(dist):
"""
Return
a
current
distribution
object
for
a
Requirement
or
string
"""
"""
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)
dist = Requirement.parse(dist)
if isinstance(dist, Requirement):
if isinstance(dist, Requirement):
dist = get_provider(dist)
dist = get_provider(dist)
...
@@ -2297,7 +2284,7 @@ def _set_parent_ns(packageName):
...
@@ -2297,7 +2284,7 @@ def _set_parent_ns(packageName):
def
yield_lines
(
strs
):
def
yield_lines
(
strs
):
"""Yield non-empty/non-comment lines of a string or sequence"""
"""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
():
for
s
in
strs
.
splitlines
():
s
=
s
.
strip
()
s
=
s
.
strip
()
# skip blank lines/comments
# skip blank lines/comments
...
@@ -2464,9 +2451,9 @@ class EntryPoint(object):
...
@@ -2464,9 +2451,9 @@ class EntryPoint(object):
def _remove_md5_fragment(location):
def _remove_md5_fragment(location):
if not location:
if not location:
return ''
return ''
parsed = urlparse(location)
parsed = url
lib.parse.url
parse(location)
if parsed[-1].startswith('
md5
=
'):
if parsed[-1].startswith('
md5
=
'):
return urlunparse(parsed[:-1] + ('',))
return url
lib.parse.url
unparse(parsed[:-1] + ('',))
return location
return location
...
...
pkg_resources/tests/test_resources.py
View file @
b639cf0f
...
@@ -244,9 +244,8 @@ class TestWorkingSet:
...
@@ -244,9 +244,8 @@ class TestWorkingSet:
with
pytest
.
raises
(
VersionConflict
)
as
vc
:
with
pytest
.
raises
(
VersionConflict
)
as
vc
:
ws
.
resolve
(
parse_requirements
(
"Foo
\
n
Bar
\
n
"
))
ws
.
resolve
(
parse_requirements
(
"Foo
\
n
Bar
\
n
"
))
msg
=
"Baz 1.0 is installed but Baz==2.0 is required by {'Bar'}"
msg
=
"Baz 1.0 is installed but Baz==2.0 is required by "
if
pkg_resources
.
PY2
:
msg
+=
repr
(
set
([
'Bar'
]))
msg
=
msg
.
replace
(
"{'Bar'}"
,
"set(['Bar'])"
)
assert
vc
.
value
.
report
()
==
msg
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