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