summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/core.py6
-rw-r--r--Lib/distutils/unixccompiler.py104
-rw-r--r--Lib/distutils/util.py24
-rw-r--r--Lib/distutils/version.py50
4 files changed, 92 insertions, 92 deletions
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
index 5dfe2db..2aab7c4 100644
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -84,7 +84,7 @@ def setup (**attrs):
# Determine the distribution class -- either caller-supplied or
# our Distribution (see below).
- klass = attrs.get ('distclass')
+ klass = attrs.get('distclass')
if klass:
del attrs['distclass']
else:
@@ -98,7 +98,7 @@ def setup (**attrs):
# Create the Distribution instance, using the remaining arguments
# (ie. everything except distclass) to initialize it
try:
- _setup_distribution = dist = klass (attrs)
+ _setup_distribution = dist = klass(attrs)
except DistutilsSetupError, msg:
raise SystemExit, "error in setup script: %s" % msg
@@ -135,7 +135,7 @@ def setup (**attrs):
# And finally, run all the commands found on the command line.
if ok:
try:
- dist.run_commands ()
+ dist.run_commands()
except KeyboardInterrupt:
raise SystemExit, "interrupted"
except (IOError, os.error), exc:
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index 9339850..ff0341a 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -91,8 +91,8 @@ class UnixCCompiler (CCompiler):
extra_postargs=None):
(_, macros, include_dirs) = \
- self._fix_compile_args (None, macros, include_dirs)
- pp_opts = gen_preprocess_options (macros, include_dirs)
+ self._fix_compile_args(None, macros, include_dirs)
+ pp_opts = gen_preprocess_options(macros, include_dirs)
pp_args = self.preprocessor + pp_opts
if output_file:
pp_args.extend(['-o', output_file])
@@ -108,7 +108,7 @@ class UnixCCompiler (CCompiler):
if output_file:
self.mkpath(os.path.dirname(output_file))
try:
- self.spawn (pp_args)
+ self.spawn(pp_args)
except DistutilsExecError, msg:
raise CompileError, msg
@@ -123,11 +123,11 @@ class UnixCCompiler (CCompiler):
extra_postargs=None):
(output_dir, macros, include_dirs) = \
- self._fix_compile_args (output_dir, macros, include_dirs)
- (objects, skip_sources) = self._prep_compile (sources, output_dir)
+ self._fix_compile_args(output_dir, macros, include_dirs)
+ (objects, skip_sources) = self._prep_compile(sources, output_dir)
# Figure out the options for the compiler command line.
- pp_opts = gen_preprocess_options (macros, include_dirs)
+ pp_opts = gen_preprocess_options(macros, include_dirs)
cc_args = pp_opts + ['-c']
if debug:
cc_args[:0] = ['-g']
@@ -138,16 +138,16 @@ class UnixCCompiler (CCompiler):
# Compile all source files that weren't eliminated by
# '_prep_compile()'.
- for i in range (len (sources)):
+ for i in range(len(sources)):
src = sources[i] ; obj = objects[i]
if skip_sources[src]:
- self.announce ("skipping %s (%s up-to-date)" % (src, obj))
+ self.announce("skipping %s (%s up-to-date)" % (src, obj))
else:
- self.mkpath (os.path.dirname (obj))
+ self.mkpath(os.path.dirname(obj))
try:
- self.spawn (self.compiler_so + cc_args +
- [src, '-o', obj] +
- extra_postargs)
+ self.spawn(self.compiler_so + cc_args +
+ [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError, msg:
raise CompileError, msg
@@ -163,16 +163,16 @@ class UnixCCompiler (CCompiler):
output_dir=None,
debug=0):
- (objects, output_dir) = self._fix_object_args (objects, output_dir)
+ (objects, output_dir) = self._fix_object_args(objects, output_dir)
output_filename = \
- self.library_filename (output_libname, output_dir=output_dir)
+ self.library_filename(output_libname, output_dir=output_dir)
- if self._need_link (objects, output_filename):
- self.mkpath (os.path.dirname (output_filename))
- self.spawn (self.archiver +
- [output_filename] +
- objects + self.objects)
+ if self._need_link(objects, output_filename):
+ self.mkpath(os.path.dirname(output_filename))
+ self.spawn(self.archiver +
+ [output_filename] +
+ objects + self.objects)
# Not many Unices required ranlib anymore -- SunOS 4.x is, I
# think the only major Unix that does. Maybe we need some
@@ -181,11 +181,11 @@ class UnixCCompiler (CCompiler):
# it for us, hence the check for leading colon.
if self.ranlib:
try:
- self.spawn (self.ranlib + [output_filename])
+ self.spawn(self.ranlib + [output_filename])
except DistutilsExecError, msg:
raise LibError, msg
else:
- self.announce ("skipping %s (up-to-date)" % output_filename)
+ self.announce("skipping %s (up-to-date)" % output_filename)
# create_static_lib ()
@@ -203,9 +203,9 @@ class UnixCCompiler (CCompiler):
extra_postargs=None,
build_temp=None):
- self.link_shared_object (
+ self.link_shared_object(
objects,
- self.library_filename (output_libname, lib_type='shared'),
+ self.library_filename(output_libname, lib_type='shared'),
output_dir,
libraries,
library_dirs,
@@ -230,19 +230,19 @@ class UnixCCompiler (CCompiler):
extra_postargs=None,
build_temp=None):
- (objects, output_dir) = self._fix_object_args (objects, output_dir)
+ (objects, output_dir) = self._fix_object_args(objects, output_dir)
(libraries, library_dirs, runtime_library_dirs) = \
- self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
+ self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
- lib_opts = gen_lib_options (self,
- library_dirs, runtime_library_dirs,
- libraries)
- if type (output_dir) not in (StringType, NoneType):
+ lib_opts = gen_lib_options(self,
+ library_dirs, runtime_library_dirs,
+ libraries)
+ if type(output_dir) not in (StringType, NoneType):
raise TypeError, "'output_dir' must be a string or None"
if output_dir is not None:
- output_filename = os.path.join (output_dir, output_filename)
+ output_filename = os.path.join(output_dir, output_filename)
- if self._need_link (objects, output_filename):
+ if self._need_link(objects, output_filename):
ld_args = (objects + self.objects +
lib_opts + ['-o', output_filename])
if debug:
@@ -250,14 +250,14 @@ class UnixCCompiler (CCompiler):
if extra_preargs:
ld_args[:0] = extra_preargs
if extra_postargs:
- ld_args.extend (extra_postargs)
- self.mkpath (os.path.dirname (output_filename))
+ ld_args.extend(extra_postargs)
+ self.mkpath(os.path.dirname(output_filename))
try:
- self.spawn (self.linker_so + ld_args)
+ self.spawn(self.linker_so + ld_args)
except DistutilsExecError, msg:
raise LinkError, msg
else:
- self.announce ("skipping %s (up-to-date)" % output_filename)
+ self.announce("skipping %s (up-to-date)" % output_filename)
# link_shared_object ()
@@ -273,32 +273,32 @@ class UnixCCompiler (CCompiler):
extra_preargs=None,
extra_postargs=None):
- (objects, output_dir) = self._fix_object_args (objects, output_dir)
+ (objects, output_dir) = self._fix_object_args(objects, output_dir)
(libraries, library_dirs, runtime_library_dirs) = \
- self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
+ self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
- lib_opts = gen_lib_options (self,
- library_dirs, runtime_library_dirs,
- libraries)
+ lib_opts = gen_lib_options(self,
+ library_dirs, runtime_library_dirs,
+ libraries)
output_filename = output_progname # Unix-ism!
if output_dir is not None:
- output_filename = os.path.join (output_dir, output_filename)
+ output_filename = os.path.join(output_dir, output_filename)
- if self._need_link (objects, output_filename):
+ if self._need_link(objects, output_filename):
ld_args = objects + self.objects + lib_opts + ['-o', output_filename]
if debug:
ld_args[:0] = ['-g']
if extra_preargs:
ld_args[:0] = extra_preargs
if extra_postargs:
- ld_args.extend (extra_postargs)
- self.mkpath (os.path.dirname (output_filename))
+ ld_args.extend(extra_postargs)
+ self.mkpath(os.path.dirname(output_filename))
try:
- self.spawn (self.linker_exe + ld_args)
+ self.spawn(self.linker_exe + ld_args)
except DistutilsExecError, msg:
raise LinkError, msg
else:
- self.announce ("skipping %s (up-to-date)" % output_filename)
+ self.announce("skipping %s (up-to-date)" % output_filename)
# link_executable ()
@@ -320,18 +320,18 @@ class UnixCCompiler (CCompiler):
def find_library_file (self, dirs, lib, debug=0):
for dir in dirs:
- shared = os.path.join (
- dir, self.library_filename (lib, lib_type='shared'))
- static = os.path.join (
- dir, self.library_filename (lib, lib_type='static'))
+ shared = os.path.join(
+ dir, self.library_filename(lib, lib_type='shared'))
+ static = os.path.join(
+ dir, self.library_filename(lib, lib_type='static'))
# We're second-guessing the linker here, with not much hard
# data to go on: GCC seems to prefer the shared library, so I'm
# assuming that *all* Unix C compilers do. And of course I'm
# ignoring even GCC's "-static" option. So sue me.
- if os.path.exists (shared):
+ if os.path.exists(shared):
return shared
- elif os.path.exists (static):
+ elif os.path.exists(static):
return static
else:
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 367985a..d52c69b 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -88,16 +88,16 @@ def change_root (new_root, pathname):
two, which is tricky on DOS/Windows and Mac OS.
"""
if os.name == 'posix':
- if not os.path.isabs (pathname):
- return os.path.join (new_root, pathname)
+ if not os.path.isabs(pathname):
+ return os.path.join(new_root, pathname)
else:
- return os.path.join (new_root, pathname[1:])
+ return os.path.join(new_root, pathname[1:])
elif os.name == 'nt':
- (drive, path) = os.path.splitdrive (pathname)
+ (drive, path) = os.path.splitdrive(pathname)
if path[0] == '\\':
path = path[1:]
- return os.path.join (new_root, path)
+ return os.path.join(new_root, path)
elif os.name == 'mac':
if not os.path.isabs(pathname):
@@ -129,10 +129,10 @@ def check_environ ():
if os.name == 'posix' and not os.environ.has_key('HOME'):
import pwd
- os.environ['HOME'] = pwd.getpwuid (os.getuid())[5]
+ os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
if not os.environ.has_key('PLAT'):
- os.environ['PLAT'] = get_platform ()
+ os.environ['PLAT'] = get_platform()
_environ_checked = 1
@@ -147,15 +147,15 @@ def subst_vars (str, local_vars):
'_check_environ()'. Raise ValueError for any variables not found in
either 'local_vars' or 'os.environ'."""
- check_environ ()
+ check_environ()
def _subst (match, local_vars=local_vars):
var_name = match.group(1)
- if local_vars.has_key (var_name):
- return str (local_vars[var_name])
+ if local_vars.has_key(var_name):
+ return str(local_vars[var_name])
else:
return os.environ[var_name]
- return re.sub (r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str)
+ return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str)
# subst_vars ()
@@ -169,7 +169,7 @@ def grok_environment_error (exc, prefix="error: "):
prefixed with 'prefix'.
"""
# check for Python 1.5.2-style {IO,OS}Error exception objects
- if hasattr (exc, 'filename') and hasattr (exc, 'strerror'):
+ if hasattr(exc, 'filename') and hasattr(exc, 'strerror'):
if exc.filename:
error = prefix + "%s: %s" % (exc.filename, exc.strerror)
else:
diff --git a/Lib/distutils/version.py b/Lib/distutils/version.py
index 8b9ef10..9d3d172 100644
--- a/Lib/distutils/version.py
+++ b/Lib/distutils/version.py
@@ -39,10 +39,10 @@ class Version:
def __init__ (self, vstring=None):
if vstring:
- self.parse (vstring)
+ self.parse(vstring)
def __repr__ (self):
- return "%s ('%s')" % (self.__class__.__name__, str (self))
+ return "%s ('%s')" % (self.__class__.__name__, str(self))
# Interface for version-number classes -- must be implemented
@@ -99,25 +99,25 @@ class StrictVersion (Version):
in the distutils documentation.
"""
- version_re = re.compile (r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
- re.VERBOSE)
+ version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
+ re.VERBOSE)
def parse (self, vstring):
- match = self.version_re.match (vstring)
+ match = self.version_re.match(vstring)
if not match:
raise ValueError, "invalid version number '%s'" % vstring
(major, minor, patch, prerelease, prerelease_num) = \
- match.group (1, 2, 4, 5, 6)
+ match.group(1, 2, 4, 5, 6)
if patch:
- self.version = tuple (map (string.atoi, [major, minor, patch]))
+ self.version = tuple(map(string.atoi, [major, minor, patch]))
else:
- self.version = tuple (map (string.atoi, [major, minor]) + [0])
+ self.version = tuple(map(string.atoi, [major, minor]) + [0])
if prerelease:
- self.prerelease = (prerelease[0], string.atoi (prerelease_num))
+ self.prerelease = (prerelease[0], string.atoi(prerelease_num))
else:
self.prerelease = None
@@ -125,21 +125,21 @@ class StrictVersion (Version):
def __str__ (self):
if self.version[2] == 0:
- vstring = string.join (map (str, self.version[0:2]), '.')
+ vstring = string.join(map(str, self.version[0:2]), '.')
else:
- vstring = string.join (map (str, self.version), '.')
+ vstring = string.join(map(str, self.version), '.')
if self.prerelease:
- vstring = vstring + self.prerelease[0] + str (self.prerelease[1])
+ vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
return vstring
def __cmp__ (self, other):
- if isinstance (other, StringType):
- other = StrictVersion (other)
+ if isinstance(other, StringType):
+ other = StrictVersion(other)
- compare = cmp (self.version, other.version)
+ compare = cmp(self.version, other.version)
if (compare == 0): # have to compare prerelease
# case 1: neither has prerelease; they're equal
@@ -154,7 +154,7 @@ class StrictVersion (Version):
elif (not self.prerelease and other.prerelease):
return 1
elif (self.prerelease and other.prerelease):
- return cmp (self.prerelease, other.prerelease)
+ return cmp(self.prerelease, other.prerelease)
else: # numeric versions don't match --
return compare # prerelease stuff doesn't matter
@@ -264,7 +264,7 @@ class LooseVersion (Version):
def __init__ (self, vstring=None):
if vstring:
- self.parse (vstring)
+ self.parse(vstring)
def parse (self, vstring):
@@ -272,11 +272,11 @@ class LooseVersion (Version):
# from the parsed tuple -- so I just store the string here for
# use by __str__
self.vstring = vstring
- components = filter (lambda x: x and x != '.',
- self.component_re.split (vstring))
- for i in range (len (components)):
+ components = filter(lambda x: x and x != '.',
+ self.component_re.split(vstring))
+ for i in range(len(components)):
try:
- components[i] = int (components[i])
+ components[i] = int(components[i])
except ValueError:
pass
@@ -288,14 +288,14 @@ class LooseVersion (Version):
def __repr__ (self):
- return "LooseVersion ('%s')" % str (self)
+ return "LooseVersion ('%s')" % str(self)
def __cmp__ (self, other):
- if isinstance (other, StringType):
- other = LooseVersion (other)
+ if isinstance(other, StringType):
+ other = LooseVersion(other)
- return cmp (self.version, other.version)
+ return cmp(self.version, other.version)
# end class LooseVersion