diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 03:52:21 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 03:52:21 (GMT) |
commit | 5b7e9d76f39dbf63573519c178835f72e5a5027a (patch) | |
tree | 96b04b9d52d875c9f39d148d88efeafb5184fd35 /Lib/distutils/util.py | |
parent | a73bfee73da519a508e7d95bc55c1984ae7089bd (diff) | |
download | cpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.zip cpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.tar.gz cpython-5b7e9d76f39dbf63573519c178835f72e5a5027a.tar.bz2 |
General cleanup, raise normalization in Lib/distutils.
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r-- | Lib/distutils/util.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 9aa8570..22a8ba2 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -153,9 +153,9 @@ def convert_path (pathname): if not pathname: return pathname if pathname[0] == '/': - raise ValueError, "path '%s' cannot be absolute" % pathname + raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': - raise ValueError, "path '%s' cannot end with '/'" % pathname + raise ValueError("path '%s' cannot end with '/'" % pathname) paths = pathname.split('/') while '.' in paths: @@ -201,8 +201,7 @@ def change_root (new_root, pathname): return os.path.join(new_root, pathname) else: - raise DistutilsPlatformError, \ - "nothing known about platform '%s'" % os.name + raise DistutilsPlatformError("nothing known about platform '%s'" % os.name) _environ_checked = 0 @@ -248,7 +247,7 @@ def subst_vars (s, local_vars): try: return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s) except KeyError as var: - raise ValueError, "invalid variable '$%s'" % var + raise ValueError("invalid variable '$%s'" % var) # subst_vars () @@ -326,12 +325,10 @@ def split_quoted (s): elif s[end] == '"': # slurp doubly-quoted string m = _dquote_re.match(s, end) else: - raise RuntimeError, \ - "this can't happen (bad char '%c')" % s[end] + raise RuntimeError("this can't happen (bad char '%c')" % s[end]) if m is None: - raise ValueError, \ - "bad string (mismatched %s quotes?)" % s[end] + raise ValueError("bad string (mismatched %s quotes?)" % s[end]) (beg, end) = m.span() s = s[:beg] + s[beg+1:end-1] + s[end:] @@ -378,7 +375,7 @@ def strtobool (val): elif val in ('n', 'no', 'f', 'false', 'off', '0'): return 0 else: - raise ValueError, "invalid truth value %r" % (val,) + raise ValueError("invalid truth value %r" % (val,)) def byte_compile (py_files, @@ -502,8 +499,7 @@ byte_compile(files, optimize=%r, force=%r, dfile = file if prefix: if file[:len(prefix)] != prefix: - raise ValueError, \ - ("invalid prefix: filename %r doesn't start with %r" + raise ValueError("invalid prefix: filename %r doesn't start with %r" % (file, prefix)) dfile = dfile[len(prefix):] if base_dir: |