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
9d6a6e59
Commit
9d6a6e59
authored
Jan 04, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use except/as, now supported by Python 2.6
parent
a849ee95
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
27 additions
and
49 deletions
+27
-49
pkg_resources/__init__.py
pkg_resources/__init__.py
+4
-6
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+4
-8
setuptools/command/sdist.py
setuptools/command/sdist.py
+2
-1
setuptools/command/upload_docs.py
setuptools/command/upload_docs.py
+1
-2
setuptools/dist.py
setuptools/dist.py
+1
-2
setuptools/msvc9_support.py
setuptools/msvc9_support.py
+1
-2
setuptools/package_index.py
setuptools/package_index.py
+5
-10
setuptools/sandbox.py
setuptools/sandbox.py
+1
-2
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+4
-8
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+4
-8
No files found.
pkg_resources/__init__.py
View file @
9d6a6e59
...
@@ -843,8 +843,7 @@ class WorkingSet(object):
...
@@ -843,8 +843,7 @@ class WorkingSet(object):
try:
try:
resolvees = shadow_set.resolve(req, env, installer)
resolvees = shadow_set.resolve(req, env, installer)
except ResolutionError:
except ResolutionError as v:
v = sys.exc_info()[1]
# save error info
# save error info
error_info[dist] = v
error_info[dist] = v
if fallback:
if fallback:
...
@@ -1340,8 +1339,8 @@ class MarkerEvaluation(object):
...
@@ -1340,8 +1339,8 @@ class MarkerEvaluation(object):
"""
"""
try:
try:
cls.evaluate_marker(text)
cls.evaluate_marker(text)
except SyntaxError:
except SyntaxError
as e
:
return cls.normalize_exception(
sys.exc_info()[1]
)
return cls.normalize_exception(
e
)
return False
return False
@staticmethod
@staticmethod
...
@@ -1456,8 +1455,7 @@ class MarkerEvaluation(object):
...
@@ -1456,8 +1455,7 @@ class MarkerEvaluation(object):
env[new_key] = env.pop(key)
env[new_key] = env.pop(key)
try:
try:
result = _markerlib.interpret(text, env)
result = _markerlib.interpret(text, env)
except NameError:
except NameError as e:
e = sys.exc_info()[1]
raise SyntaxError(e.args[0])
raise SyntaxError(e.args[0])
return result
return result
...
...
setuptools/command/easy_install.py
View file @
9d6a6e59
...
@@ -698,13 +698,11 @@ Please make the appropriate changes for your system and try again.
...
@@ -698,13 +698,11 @@ Please make the appropriate changes for your system and try again.
distros
=
WorkingSet
([]).
resolve
(
distros
=
WorkingSet
([]).
resolve
(
[
requirement
],
self
.
local_index
,
self
.
easy_install
[
requirement
],
self
.
local_index
,
self
.
easy_install
)
)
except
DistributionNotFound
:
except
DistributionNotFound
as
e
:
e
=
sys
.
exc_info
()[
1
]
raise
DistutilsError
(
raise
DistutilsError
(
"Could not find required distribution %s"
%
e
.
args
"Could not find required distribution %s"
%
e
.
args
)
)
except
VersionConflict
:
except
VersionConflict
as
e
:
e
=
sys
.
exc_info
()[
1
]
raise
DistutilsError
(
raise
DistutilsError
(
"Installed distribution %s conflicts with requirement %s"
"Installed distribution %s conflicts with requirement %s"
%
e
.
args
%
e
.
args
...
@@ -1044,8 +1042,7 @@ See the setuptools documentation for the "develop" command for more info.
...
@@ -1044,8 +1042,7 @@ See the setuptools documentation for the "develop" command for more info.
)
)
try
:
try
:
run_setup
(
setup_script
,
args
)
run_setup
(
setup_script
,
args
)
except
SystemExit
:
except
SystemExit
as
v
:
v
=
sys
.
exc_info
()[
1
]
raise
DistutilsError
(
"Setup script exited with %s"
%
(
v
.
args
[
0
],))
raise
DistutilsError
(
"Setup script exited with %s"
%
(
v
.
args
[
0
],))
def
build_and_install
(
self
,
setup_script
,
setup_base
):
def
build_and_install
(
self
,
setup_script
,
setup_base
):
...
@@ -1889,8 +1886,7 @@ def chmod(path, mode):
...
@@ -1889,8 +1886,7 @@ def chmod(path, mode):
log
.
debug
(
"changing mode of %s to %o"
,
path
,
mode
)
log
.
debug
(
"changing mode of %s to %o"
,
path
,
mode
)
try
:
try
:
_chmod
(
path
,
mode
)
_chmod
(
path
,
mode
)
except
os
.
error
:
except
os
.
error
as
e
:
e
=
sys
.
exc_info
()[
1
]
log
.
debug
(
"chmod failed: %s"
,
e
)
log
.
debug
(
"chmod failed: %s"
,
e
)
...
...
setuptools/command/sdist.py
View file @
9d6a6e59
...
@@ -70,7 +70,8 @@ class sdist(orig.sdist):
...
@@ -70,7 +70,8 @@ class sdist(orig.sdist):
try
:
try
:
orig
.
sdist
.
read_template
(
self
)
orig
.
sdist
.
read_template
(
self
)
except
:
except
:
sys
.
exc_info
()[
2
].
tb_next
.
tb_frame
.
f_locals
[
'template'
].
close
()
_
,
_
,
tb
=
sys
.
exc_info
()
tb
.
tb_next
.
tb_frame
.
f_locals
[
'template'
].
close
()
raise
raise
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
...
...
setuptools/command/upload_docs.py
View file @
9d6a6e59
...
@@ -169,8 +169,7 @@ class upload_docs(upload):
...
@@ -169,8 +169,7 @@ class upload_docs(upload):
conn
.
putheader
(
'Authorization'
,
auth
)
conn
.
putheader
(
'Authorization'
,
auth
)
conn
.
endheaders
()
conn
.
endheaders
()
conn
.
send
(
body
)
conn
.
send
(
body
)
except
socket
.
error
:
except
socket
.
error
as
e
:
e
=
sys
.
exc_info
()[
1
]
self
.
announce
(
str
(
e
),
log
.
ERROR
)
self
.
announce
(
str
(
e
),
log
.
ERROR
)
return
return
...
...
setuptools/dist.py
View file @
9d6a6e59
...
@@ -131,8 +131,7 @@ def check_entry_points(dist, attr, value):
...
@@ -131,8 +131,7 @@ def check_entry_points(dist, attr, value):
"""Verify that entry_points map is parseable"""
"""Verify that entry_points map is parseable"""
try
:
try
:
pkg_resources
.
EntryPoint
.
parse_map
(
value
)
pkg_resources
.
EntryPoint
.
parse_map
(
value
)
except
ValueError
:
except
ValueError
as
e
:
e
=
sys
.
exc_info
()[
1
]
raise
DistutilsSetupError
(
e
)
raise
DistutilsSetupError
(
e
)
def
check_test_suite
(
dist
,
attr
,
value
):
def
check_test_suite
(
dist
,
attr
,
value
):
...
...
setuptools/msvc9_support.py
View file @
9d6a6e59
...
@@ -50,8 +50,7 @@ def find_vcvarsall(version):
...
@@ -50,8 +50,7 @@ def find_vcvarsall(version):
def
query_vcvarsall
(
version
,
*
args
,
**
kwargs
):
def
query_vcvarsall
(
version
,
*
args
,
**
kwargs
):
try
:
try
:
return
unpatched
[
'query_vcvarsall'
](
version
,
*
args
,
**
kwargs
)
return
unpatched
[
'query_vcvarsall'
](
version
,
*
args
,
**
kwargs
)
except
distutils
.
errors
.
DistutilsPlatformError
:
except
distutils
.
errors
.
DistutilsPlatformError
as
exc
:
exc
=
sys
.
exc_info
()[
1
]
if
exc
and
"vcvarsall.bat"
in
exc
.
args
[
0
]:
if
exc
and
"vcvarsall.bat"
in
exc
.
args
[
0
]:
message
=
'Microsoft Visual C++ %0.1f is required (%s).'
%
(
version
,
exc
.
args
[
0
])
message
=
'Microsoft Visual C++ %0.1f is required (%s).'
%
(
version
,
exc
.
args
[
0
])
if
int
(
version
)
==
9
:
if
int
(
version
)
==
9
:
...
...
setuptools/package_index.py
View file @
9d6a6e59
...
@@ -699,25 +699,21 @@ class PackageIndex(Environment):
...
@@ -699,25 +699,21 @@ class PackageIndex(Environment):
return
local_open
(
url
)
return
local_open
(
url
)
try
:
try
:
return
open_with_auth
(
url
,
self
.
opener
)
return
open_with_auth
(
url
,
self
.
opener
)
except
(
ValueError
,
httplib
.
InvalidURL
):
except
(
ValueError
,
httplib
.
InvalidURL
)
as
v
:
v
=
sys
.
exc_info
()[
1
]
msg
=
' '
.
join
([
str
(
arg
)
for
arg
in
v
.
args
])
msg
=
' '
.
join
([
str
(
arg
)
for
arg
in
v
.
args
])
if
warning
:
if
warning
:
self
.
warn
(
warning
,
msg
)
self
.
warn
(
warning
,
msg
)
else
:
else
:
raise
DistutilsError
(
'%s %s'
%
(
url
,
msg
))
raise
DistutilsError
(
'%s %s'
%
(
url
,
msg
))
except
urllib2
.
HTTPError
:
except
urllib2
.
HTTPError
as
v
:
v
=
sys
.
exc_info
()[
1
]
return
v
return
v
except
urllib2
.
URLError
:
except
urllib2
.
URLError
as
v
:
v
=
sys
.
exc_info
()[
1
]
if
warning
:
if
warning
:
self
.
warn
(
warning
,
v
.
reason
)
self
.
warn
(
warning
,
v
.
reason
)
else
:
else
:
raise
DistutilsError
(
"Download error for %s: %s"
raise
DistutilsError
(
"Download error for %s: %s"
%
(
url
,
v
.
reason
))
%
(
url
,
v
.
reason
))
except
httplib
.
BadStatusLine
:
except
httplib
.
BadStatusLine
as
v
:
v
=
sys
.
exc_info
()[
1
]
if
warning
:
if
warning
:
self
.
warn
(
warning
,
v
.
line
)
self
.
warn
(
warning
,
v
.
line
)
else
:
else
:
...
@@ -726,8 +722,7 @@ class PackageIndex(Environment):
...
@@ -726,8 +722,7 @@ class PackageIndex(Environment):
'down, %s'
%
'down, %s'
%
(
url
,
v
.
line
)
(
url
,
v
.
line
)
)
)
except
httplib
.
HTTPException
:
except
httplib
.
HTTPException
as
v
:
v
=
sys
.
exc_info
()[
1
]
if
warning
:
if
warning
:
self
.
warn
(
warning
,
v
)
self
.
warn
(
warning
,
v
)
else
:
else
:
...
...
setuptools/sandbox.py
View file @
9d6a6e59
...
@@ -199,8 +199,7 @@ def run_setup(setup_script, args):
...
@@ -199,8 +199,7 @@ def run_setup(setup_script, args):
ns = dict(__file__=setup_script, __name__='__main__')
ns = dict(__file__=setup_script, __name__='__main__')
_execfile(setup_script, ns)
_execfile(setup_script, ns)
DirectorySandbox(setup_dir).run(runner)
DirectorySandbox(setup_dir).run(runner)
except SystemExit:
except SystemExit as v:
v = sys.exc_info()[1]
if v.args and v.args[0]:
if v.args and v.args[0]:
raise
raise
# Normal exit, just return
# Normal exit, just return
...
...
setuptools/tests/test_packageindex.py
View file @
9d6a6e59
...
@@ -15,8 +15,7 @@ class TestPackageIndex:
...
@@ -15,8 +15,7 @@ class TestPackageIndex:
url
=
'http://127.0.0.1:0/nonesuch/test_package_index'
url
=
'http://127.0.0.1:0/nonesuch/test_package_index'
try
:
try
:
v
=
index
.
open_url
(
url
)
v
=
index
.
open_url
(
url
)
except
Exception
:
except
Exception
as
v
:
v
=
sys
.
exc_info
()[
1
]
assert
url
in
str
(
v
)
assert
url
in
str
(
v
)
else
:
else
:
assert
isinstance
(
v
,
HTTPError
)
assert
isinstance
(
v
,
HTTPError
)
...
@@ -32,8 +31,7 @@ class TestPackageIndex:
...
@@ -32,8 +31,7 @@ class TestPackageIndex:
url
=
'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
url
=
'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
try
:
try
:
v
=
index
.
open_url
(
url
)
v
=
index
.
open_url
(
url
)
except
Exception
:
except
Exception
as
v
:
v
=
sys
.
exc_info
()[
1
]
assert
url
in
str
(
v
)
assert
url
in
str
(
v
)
else
:
else
:
assert
isinstance
(
v
,
HTTPError
)
assert
isinstance
(
v
,
HTTPError
)
...
@@ -50,8 +48,7 @@ class TestPackageIndex:
...
@@ -50,8 +48,7 @@ class TestPackageIndex:
url
=
'http://example.com'
url
=
'http://example.com'
try
:
try
:
v
=
index
.
open_url
(
url
)
v
=
index
.
open_url
(
url
)
except
Exception
:
except
Exception
as
v
:
v
=
sys
.
exc_info
()[
1
]
assert
'line'
in
str
(
v
)
assert
'line'
in
str
(
v
)
else
:
else
:
raise
AssertionError
(
'Should have raise here!'
)
raise
AssertionError
(
'Should have raise here!'
)
...
@@ -68,8 +65,7 @@ class TestPackageIndex:
...
@@ -68,8 +65,7 @@ class TestPackageIndex:
url
=
'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
url
=
'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
try
:
try
:
index
.
open_url
(
url
)
index
.
open_url
(
url
)
except
distutils
.
errors
.
DistutilsError
:
except
distutils
.
errors
.
DistutilsError
as
error
:
error
=
sys
.
exc_info
()[
1
]
msg
=
unicode
(
error
)
msg
=
unicode
(
error
)
assert
'nonnumeric port'
in
msg
or
'getaddrinfo failed'
in
msg
or
'Name or service not known'
in
msg
assert
'nonnumeric port'
in
msg
or
'getaddrinfo failed'
in
msg
or
'Name or service not known'
in
msg
return
return
...
...
setuptools/tests/test_sdist.py
View file @
9d6a6e59
...
@@ -174,8 +174,7 @@ class TestSdistTest:
...
@@ -174,8 +174,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
# The manifest should be UTF-8 encoded
try
:
try
:
u_contents
=
contents
.
decode
(
'UTF-8'
)
u_contents
=
contents
.
decode
(
'UTF-8'
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
as
e
:
e
=
sys
.
exc_info
()[
1
]
self
.
fail
(
e
)
self
.
fail
(
e
)
# The manifest should contain the UTF-8 filename
# The manifest should contain the UTF-8 filename
...
@@ -217,8 +216,7 @@ class TestSdistTest:
...
@@ -217,8 +216,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
# The manifest should be UTF-8 encoded
try
:
try
:
contents
.
decode
(
'UTF-8'
)
contents
.
decode
(
'UTF-8'
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
as
e
:
e
=
sys
.
exc_info
()[
1
]
self
.
fail
(
e
)
self
.
fail
(
e
)
# The manifest should contain the UTF-8 filename
# The manifest should contain the UTF-8 filename
...
@@ -258,8 +256,7 @@ class TestSdistTest:
...
@@ -258,8 +256,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
# The manifest should be UTF-8 encoded
try
:
try
:
contents
.
decode
(
'UTF-8'
)
contents
.
decode
(
'UTF-8'
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
as
e
:
e
=
sys
.
exc_info
()[
1
]
self
.
fail
(
e
)
self
.
fail
(
e
)
# The Latin-1 filename should have been skipped
# The Latin-1 filename should have been skipped
...
@@ -328,8 +325,7 @@ class TestSdistTest:
...
@@ -328,8 +325,7 @@ class TestSdistTest:
with
quiet
():
with
quiet
():
try
:
try
:
cmd
.
read_manifest
()
cmd
.
read_manifest
()
except
UnicodeDecodeError
:
except
UnicodeDecodeError
as
e
:
e
=
sys
.
exc_info
()[
1
]
self
.
fail
(
e
)
self
.
fail
(
e
)
# The Latin-1 filename should have been skipped
# The Latin-1 filename should have been skipped
...
...
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