Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b7e9d7

Browse files
committed
General cleanup, raise normalization in Lib/distutils.
1 parent a73bfee commit 5b7e9d7

47 files changed

Lines changed: 966 additions & 1643 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/distutils/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
setup (...)
99
"""
1010

11-
# This module should be kept compatible with Python 2.1.
12-
1311
__revision__ = "$Id$"
1412

1513
# Distutils version

Lib/distutils/archive_util.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Utility functions for creating archive files (tarballs, zip files,
44
that sort of thing)."""
55

6-
# This module should be kept compatible with Python 2.1.
7-
86
__revision__ = "$Id$"
97

108
import os
@@ -39,8 +37,8 @@ def make_tarball (base_name, base_dir, compress="gzip",
3937
'bzip2': ['-f9']}
4038

4139
if compress is not None and compress not in compress_ext.keys():
42-
raise ValueError, \
43-
"bad value for 'compress': must be None, 'gzip', or 'compress'"
40+
raise ValueError(
41+
"bad value for 'compress': must be None, 'gzip', or 'compress'")
4442

4543
archive_name = base_name + ".tar"
4644
mkpath(os.path.dirname(archive_name), dry_run=dry_run)
@@ -86,10 +84,9 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0):
8684
except DistutilsExecError:
8785
# XXX really should distinguish between "couldn't find
8886
# external 'zip' command" and "zip failed".
89-
raise DistutilsExecError, \
90-
("unable to create zip file '%s': "
87+
raise DistutilsExecError(("unable to create zip file '%s': "
9188
"could neither import the 'zipfile' module nor "
92-
"find a standalone zip utility") % zip_filename
89+
"find a standalone zip utility") % zip_filename)
9390

9491
else:
9592
log.info("creating '%s' and adding '%s' to it",
@@ -157,7 +154,7 @@ def make_archive (base_name, format,
157154
try:
158155
format_info = ARCHIVE_FORMATS[format]
159156
except KeyError:
160-
raise ValueError, "unknown archive format '%s'" % format
157+
raise ValueError("unknown archive format '%s'" % format)
161158

162159
func = format_info[0]
163160
for (arg,val) in format_info[1]:

Lib/distutils/bcppcompiler.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# someone should sit down and factor out the common code as
1212
# WindowsCCompiler! --GPW
1313

14-
# This module should be kept compatible with Python 2.1.
15-
1614
__revision__ = "$Id$"
1715

1816

@@ -116,7 +114,7 @@ def compile(self, sources,
116114
try:
117115
self.spawn (["brcc32", "-fo", obj, src])
118116
except DistutilsExecError as msg:
119-
raise CompileError, msg
117+
raise CompileError(msg)
120118
continue # the 'for' loop
121119

122120
# The next two are both for the real compiler.
@@ -140,7 +138,7 @@ def compile(self, sources,
140138
[input_opt, output_opt] +
141139
extra_postargs + [src])
142140
except DistutilsExecError as msg:
143-
raise CompileError, msg
141+
raise CompileError(msg)
144142

145143
return objects
146144

@@ -165,7 +163,7 @@ def create_static_lib (self,
165163
try:
166164
self.spawn ([self.lib] + lib_args)
167165
except DistutilsExecError as msg:
168-
raise LibError, msg
166+
raise LibError(msg)
169167
else:
170168
log.debug("skipping %s (up-to-date)", output_filename)
171169

@@ -299,7 +297,7 @@ def link (self,
299297
try:
300298
self.spawn ([self.linker] + ld_args)
301299
except DistutilsExecError as msg:
302-
raise LinkError, msg
300+
raise LinkError(msg)
303301

304302
else:
305303
log.debug("skipping %s (up-to-date)", output_filename)
@@ -345,9 +343,8 @@ def object_filenames (self,
345343
# use normcase to make sure '.rc' is really '.rc' and not '.RC'
346344
(base, ext) = os.path.splitext (os.path.normcase(src_name))
347345
if ext not in (self.src_extensions + ['.rc','.res']):
348-
raise UnknownFileError, \
349-
"unknown file type '%s' (from '%s')" % \
350-
(ext, src_name)
346+
raise UnknownFileError("unknown file type '%s' (from '%s')" % \
347+
(ext, src_name))
351348
if strip_dir:
352349
base = os.path.basename (base)
353350
if ext == '.res':
@@ -393,6 +390,6 @@ def preprocess (self,
393390
self.spawn(pp_args)
394391
except DistutilsExecError as msg:
395392
print(msg)
396-
raise CompileError, msg
393+
raise CompileError(msg)
397394

398395
# preprocess()

0 commit comments

Comments
 (0)