Kaydet (Commit) b94b849d authored tarafından Fred Drake's avatar Fred Drake

Whitespace normalization.

üst bcd89757
...@@ -31,7 +31,7 @@ def make_tarball (base_name, base_dir, compress="gzip", ...@@ -31,7 +31,7 @@ def make_tarball (base_name, base_dir, compress="gzip",
compress_ext = { 'gzip': ".gz", compress_ext = { 'gzip': ".gz",
'bzip2': '.bz2', 'bzip2': '.bz2',
'compress': ".Z" } 'compress': ".Z" }
# flags for compression program, each element of list will be an argument # flags for compression program, each element of list will be an argument
compress_flags = {'gzip': ["-f9"], compress_flags = {'gzip': ["-f9"],
'compress': ["-f"], 'compress': ["-f"],
...@@ -85,7 +85,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): ...@@ -85,7 +85,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0):
import zipfile import zipfile
except ImportError: except ImportError:
raise DistutilsExecError, \ raise DistutilsExecError, \
("unable to create zip file '%s': " + ("unable to create zip file '%s': " +
"could neither find a standalone zip utility nor " + "could neither find a standalone zip utility nor " +
"import the 'zipfile' module") % zip_filename "import the 'zipfile' module") % zip_filename
...@@ -152,7 +152,7 @@ def make_archive (base_name, format, ...@@ -152,7 +152,7 @@ def make_archive (base_name, format,
kwargs = { 'verbose': verbose, kwargs = { 'verbose': verbose,
'dry_run': dry_run } 'dry_run': dry_run }
try: try:
format_info = ARCHIVE_FORMATS[format] format_info = ARCHIVE_FORMATS[format]
except KeyError: except KeyError:
......
...@@ -102,7 +102,7 @@ class BCPPCompiler(CCompiler) : ...@@ -102,7 +102,7 @@ class BCPPCompiler(CCompiler) :
compile_opts.extend (self.compile_options_debug) compile_opts.extend (self.compile_options_debug)
else: else:
compile_opts.extend (self.compile_options) compile_opts.extend (self.compile_options)
for i in range (len (sources)): for i in range (len (sources)):
src = sources[i] ; obj = objects[i] src = sources[i] ; obj = objects[i]
ext = (os.path.splitext (src))[1] ext = (os.path.splitext (src))[1]
...@@ -130,11 +130,11 @@ class BCPPCompiler(CCompiler) : ...@@ -130,11 +130,11 @@ class BCPPCompiler(CCompiler) :
input_opt = "" input_opt = ""
elif ext in self._cpp_extensions: elif ext in self._cpp_extensions:
input_opt = "-P" input_opt = "-P"
else: else:
# Unknown file type -- no extra options. The compiler # Unknown file type -- no extra options. The compiler
# will probably fail, but let it just in case this is a # will probably fail, but let it just in case this is a
# file the compiler recognizes even if we don't. # file the compiler recognizes even if we don't.
input_opt = "" input_opt = ""
output_opt = "-o" + obj output_opt = "-o" + obj
...@@ -174,17 +174,17 @@ class BCPPCompiler(CCompiler) : ...@@ -174,17 +174,17 @@ class BCPPCompiler(CCompiler) :
if extra_postargs: if extra_postargs:
lib_args.extend (extra_postargs) lib_args.extend (extra_postargs)
try: try:
self.spawn ([self.lib] + lib_args) self.spawn ([self.lib] + lib_args)
except DistutilsExecError, msg: except DistutilsExecError, msg:
raise LibError, msg raise LibError, msg
else: else:
self.announce ("skipping %s (up-to-date)" % output_filename) self.announce ("skipping %s (up-to-date)" % output_filename)
# create_static_lib () # create_static_lib ()
def link (self, def link (self,
target_desc, target_desc,
objects, objects,
output_filename, output_filename,
output_dir=None, output_dir=None,
...@@ -254,14 +254,14 @@ class BCPPCompiler(CCompiler) : ...@@ -254,14 +254,14 @@ class BCPPCompiler(CCompiler) :
resources.append(file) resources.append(file)
else: else:
objects.append(file) objects.append(file)
for l in library_dirs: for l in library_dirs:
ld_args.append("/L%s" % os.path.normpath(l)) ld_args.append("/L%s" % os.path.normpath(l))
ld_args.append("/L.") # we sometimes use relative paths ld_args.append("/L.") # we sometimes use relative paths
# list of object files # list of object files
ld_args.extend(objects) ld_args.extend(objects)
# XXX the command-line syntax for Borland C++ is a bit wonky; # XXX the command-line syntax for Borland C++ is a bit wonky;
# certain filenames are jammed together in one big string, but # certain filenames are jammed together in one big string, but
...@@ -275,11 +275,11 @@ class BCPPCompiler(CCompiler) : ...@@ -275,11 +275,11 @@ class BCPPCompiler(CCompiler) :
# name of dll/exe file # name of dll/exe file
ld_args.extend([',',output_filename]) ld_args.extend([',',output_filename])
# no map file and start libraries # no map file and start libraries
ld_args.append(',,') ld_args.append(',,')
for lib in libraries: for lib in libraries:
# see if we find it and if there is a bcpp specific lib # see if we find it and if there is a bcpp specific lib
# (xxx_bcpp.lib) # (xxx_bcpp.lib)
libfile = self.find_library_file(library_dirs, lib, debug) libfile = self.find_library_file(library_dirs, lib, debug)
if libfile is None: if libfile is None:
...@@ -300,7 +300,7 @@ class BCPPCompiler(CCompiler) : ...@@ -300,7 +300,7 @@ class BCPPCompiler(CCompiler) :
ld_args.append(',') ld_args.append(',')
ld_args.extend(resources) ld_args.extend(resources)
if extra_preargs: if extra_preargs:
ld_args[:0] = extra_preargs ld_args[:0] = extra_preargs
if extra_postargs: if extra_postargs:
......
...@@ -61,7 +61,7 @@ class CCompiler: ...@@ -61,7 +61,7 @@ class CCompiler:
# different versions of libfoo.a in different locations. I # different versions of libfoo.a in different locations. I
# think this is useless without the ability to null out the # think this is useless without the ability to null out the
# library search path anyways. # library search path anyways.
# Subclasses that rely on the standard filename generation methods # Subclasses that rely on the standard filename generation methods
# implemented below should override these; see the comment near # implemented below should override these; see the comment near
...@@ -159,7 +159,7 @@ class CCompiler: ...@@ -159,7 +159,7 @@ class CCompiler:
setattr(self, key, split_quoted(value)) setattr(self, key, split_quoted(value))
else: else:
setattr(self, key, value) setattr(self, key, value)
def _find_macro (self, name): def _find_macro (self, name):
...@@ -352,7 +352,7 @@ class CCompiler: ...@@ -352,7 +352,7 @@ class CCompiler:
else: else:
raise TypeError, \ raise TypeError, \
"'include_dirs' (if supplied) must be a list of strings" "'include_dirs' (if supplied) must be a list of strings"
return (output_dir, macros, include_dirs) return (output_dir, macros, include_dirs)
# _fix_compile_args () # _fix_compile_args ()
...@@ -364,7 +364,7 @@ class CCompiler: ...@@ -364,7 +364,7 @@ class CCompiler:
list of all object files and a dictionary telling which source list of all object files and a dictionary telling which source
files can be skipped. files can be skipped.
""" """
# Get the list of expected output (object) files # Get the list of expected output (object) files
objects = self.object_filenames (sources, objects = self.object_filenames (sources,
strip_dir=1, strip_dir=1,
output_dir=output_dir) output_dir=output_dir)
...@@ -401,7 +401,7 @@ class CCompiler: ...@@ -401,7 +401,7 @@ class CCompiler:
raise TypeError, \ raise TypeError, \
"'objects' must be a list or tuple of strings" "'objects' must be a list or tuple of strings"
objects = list (objects) objects = list (objects)
if output_dir is None: if output_dir is None:
output_dir = self.output_dir output_dir = self.output_dir
elif type (output_dir) is not StringType: elif type (output_dir) is not StringType:
...@@ -560,7 +560,7 @@ class CCompiler: ...@@ -560,7 +560,7 @@ class CCompiler:
Raises LibError on failure. Raises LibError on failure.
""" """
pass pass
# values for target_desc parameter in link() # values for target_desc parameter in link()
SHARED_OBJECT = "shared_object" SHARED_OBJECT = "shared_object"
...@@ -621,7 +621,7 @@ class CCompiler: ...@@ -621,7 +621,7 @@ class CCompiler:
""" """
raise NotImplementedError raise NotImplementedError
# Old 'link_*()' methods, rewritten to use the new 'link()' method. # Old 'link_*()' methods, rewritten to use the new 'link()' method.
def link_shared_lib (self, def link_shared_lib (self,
...@@ -636,13 +636,13 @@ class CCompiler: ...@@ -636,13 +636,13 @@ class CCompiler:
extra_preargs=None, extra_preargs=None,
extra_postargs=None, extra_postargs=None,
build_temp=None): build_temp=None):
self.link(CCompiler.SHARED_LIBRARY, objects, self.link(CCompiler.SHARED_LIBRARY, objects,
self.library_filename(output_libname, lib_type='shared'), self.library_filename(output_libname, lib_type='shared'),
output_dir, output_dir,
libraries, library_dirs, runtime_library_dirs, libraries, library_dirs, runtime_library_dirs,
export_symbols, debug, export_symbols, debug,
extra_preargs, extra_postargs, build_temp) extra_preargs, extra_postargs, build_temp)
def link_shared_object (self, def link_shared_object (self,
objects, objects,
...@@ -673,9 +673,9 @@ class CCompiler: ...@@ -673,9 +673,9 @@ class CCompiler:
debug=0, debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
self.link(CCompiler.EXECUTABLE, objects, self.link(CCompiler.EXECUTABLE, objects,
self.executable_filename(output_progname), output_dir, self.executable_filename(output_progname), output_dir,
libraries, library_dirs, runtime_library_dirs, None, libraries, library_dirs, runtime_library_dirs, None,
debug, extra_preargs, extra_postargs, None) debug, extra_preargs, extra_postargs, None)
...@@ -846,12 +846,12 @@ _default_compilers = ( ...@@ -846,12 +846,12 @@ _default_compilers = (
# on a cygwin built python we can use gcc like an ordinary UNIXish # on a cygwin built python we can use gcc like an ordinary UNIXish
# compiler # compiler
('cygwin.*', 'unix'), ('cygwin.*', 'unix'),
# OS name mappings # OS name mappings
('posix', 'unix'), ('posix', 'unix'),
('nt', 'msvc'), ('nt', 'msvc'),
('mac', 'mwerks'), ('mac', 'mwerks'),
) )
def get_default_compiler(osname=None, platform=None): def get_default_compiler(osname=None, platform=None):
...@@ -901,7 +901,7 @@ def show_compilers(): ...@@ -901,7 +901,7 @@ def show_compilers():
# XXX this "knows" that the compiler option it's describing is # XXX this "knows" that the compiler option it's describing is
# "--compiler", which just happens to be the case for the three # "--compiler", which just happens to be the case for the three
# commands that use it. # commands that use it.
from distutils.fancy_getopt import FancyGetopt from distutils.fancy_getopt import FancyGetopt
compilers = [] compilers = []
for compiler in compiler_class.keys(): for compiler in compiler_class.keys():
compilers.append(("compiler="+compiler, None, compilers.append(("compiler="+compiler, None,
...@@ -909,7 +909,7 @@ def show_compilers(): ...@@ -909,7 +909,7 @@ def show_compilers():
compilers.sort() compilers.sort()
pretty_printer = FancyGetopt(compilers) pretty_printer = FancyGetopt(compilers)
pretty_printer.print_help("List of available compilers:") pretty_printer.print_help("List of available compilers:")
def new_compiler (plat=None, def new_compiler (plat=None,
compiler=None, compiler=None,
...@@ -932,14 +932,14 @@ def new_compiler (plat=None, ...@@ -932,14 +932,14 @@ def new_compiler (plat=None,
try: try:
if compiler is None: if compiler is None:
compiler = get_default_compiler(plat) compiler = get_default_compiler(plat)
(module_name, class_name, long_description) = compiler_class[compiler] (module_name, class_name, long_description) = compiler_class[compiler]
except KeyError: except KeyError:
msg = "don't know how to compile C/C++ code on platform '%s'" % plat msg = "don't know how to compile C/C++ code on platform '%s'" % plat
if compiler is not None: if compiler is not None:
msg = msg + " with '%s' compiler" % compiler msg = msg + " with '%s' compiler" % compiler
raise DistutilsPlatformError, msg raise DistutilsPlatformError, msg
try: try:
module_name = "distutils." + module_name module_name = "distutils." + module_name
__import__ (module_name) __import__ (module_name)
......
...@@ -41,7 +41,7 @@ class Command: ...@@ -41,7 +41,7 @@ class Command:
# current situation. (Eg. we "install_headers" is only applicable if # current situation. (Eg. we "install_headers" is only applicable if
# we have any C header files to install.) If 'predicate' is None, # we have any C header files to install.) If 'predicate' is None,
# that command is always applicable. # that command is always applicable.
# #
# 'sub_commands' is usually defined at the *end* of a class, because # 'sub_commands' is usually defined at the *end* of a class, because
# predicates can be unbound methods, so they must already have been # predicates can be unbound methods, so they must already have been
# defined. The canonical example is the "install" command. # defined. The canonical example is the "install" command.
...@@ -111,7 +111,7 @@ class Command: ...@@ -111,7 +111,7 @@ class Command:
if not self.finalized: if not self.finalized:
self.finalize_options() self.finalize_options()
self.finalized = 1 self.finalized = 1
# Subclasses must define: # Subclasses must define:
# initialize_options() # initialize_options()
...@@ -133,12 +133,12 @@ class Command: ...@@ -133,12 +133,12 @@ class Command:
command-line. Thus, this is not the place to code dependencies command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_options()' implementations between options; generally, 'initialize_options()' implementations
are just a bunch of "self.foo = None" assignments. are just a bunch of "self.foo = None" assignments.
This method must be implemented by all command classes. This method must be implemented by all command classes.
""" """
raise RuntimeError, \ raise RuntimeError, \
"abstract method -- subclass %s must override" % self.__class__ "abstract method -- subclass %s must override" % self.__class__
def finalize_options (self): def finalize_options (self):
"""Set final values for all the options that this command supports. """Set final values for all the options that this command supports.
This is always called as late as possible, ie. after any option This is always called as late as possible, ie. after any option
...@@ -198,12 +198,12 @@ class Command: ...@@ -198,12 +198,12 @@ class Command:
if DEBUG: if DEBUG:
print msg print msg
sys.stdout.flush() sys.stdout.flush()
# -- Option validation methods ------------------------------------- # -- Option validation methods -------------------------------------
# (these are very handy in writing the 'finalize_options()' method) # (these are very handy in writing the 'finalize_options()' method)
# #
# NB. the general philosophy here is to ensure that a particular option # NB. the general philosophy here is to ensure that a particular option
# value meets certain type and value constraints. If not, we try to # value meets certain type and value constraints. If not, we try to
# force it into conformance (eg. if we expect a list but have a string, # force it into conformance (eg. if we expect a list but have a string,
...@@ -252,7 +252,7 @@ class Command: ...@@ -252,7 +252,7 @@ class Command:
raise DistutilsOptionError, \ raise DistutilsOptionError, \
"'%s' must be a list of strings (got %s)" % \ "'%s' must be a list of strings (got %s)" % \
(option, `val`) (option, `val`)
def _ensure_tested_string (self, option, tester, def _ensure_tested_string (self, option, tester,
what, error_fmt, default=None): what, error_fmt, default=None):
val = self._ensure_stringlike(option, what, default) val = self._ensure_stringlike(option, what, default)
...@@ -382,7 +382,7 @@ class Command: ...@@ -382,7 +382,7 @@ class Command:
and force flags. and force flags.
""" """
return dir_util.copy_tree( return dir_util.copy_tree(
infile, outfile, infile, outfile,
preserve_mode,preserve_times,preserve_symlinks, preserve_mode,preserve_times,preserve_symlinks,
not self.force, not self.force,
self.verbose >= level, self.verbose >= level,
...@@ -426,7 +426,7 @@ class Command: ...@@ -426,7 +426,7 @@ class Command:
(outfile, string.join(infiles, ', ')) (outfile, string.join(infiles, ', '))
if skip_msg is None: if skip_msg is None:
skip_msg = "skipping %s (inputs unchanged)" % outfile skip_msg = "skipping %s (inputs unchanged)" % outfile
# Allow 'infiles' to be a single string # Allow 'infiles' to be a single string
if type(infiles) is StringType: if type(infiles) is StringType:
...@@ -459,7 +459,7 @@ class install_misc (Command): ...@@ -459,7 +459,7 @@ class install_misc (Command):
"""Common base class for installing some files in a subdirectory. """Common base class for installing some files in a subdirectory.
Currently used by install_data and install_scripts. Currently used by install_data and install_scripts.
""" """
user_options = [('install-dir=', 'd', "directory to install the files to")] user_options = [('install-dir=', 'd', "directory to install the files to")]
def initialize_options (self): def initialize_options (self):
......
...@@ -108,7 +108,7 @@ def setup (**attrs): ...@@ -108,7 +108,7 @@ def setup (**attrs):
# Find and parse the config file(s): they will override options from # Find and parse the config file(s): they will override options from
# the setup script, but be overridden by the command line. # the setup script, but be overridden by the command line.
dist.parse_config_files() dist.parse_config_files()
if DEBUG: if DEBUG:
print "options (after parsing config files):" print "options (after parsing config files):"
dist.dump_option_dicts() dist.dump_option_dicts()
...@@ -146,7 +146,7 @@ def setup (**attrs): ...@@ -146,7 +146,7 @@ def setup (**attrs):
raise raise
else: else:
raise SystemExit, error raise SystemExit, error
except (DistutilsExecError, except (DistutilsExecError,
DistutilsFileError, DistutilsFileError,
DistutilsOptionError, DistutilsOptionError,
......
...@@ -70,7 +70,7 @@ def newer_group (sources, target, missing='error'): ...@@ -70,7 +70,7 @@ def newer_group (sources, target, missing='error'):
# If the target doesn't even exist, then it's definitely out-of-date. # If the target doesn't even exist, then it's definitely out-of-date.
if not os.path.exists(target): if not os.path.exists(target):
return 1 return 1
# Otherwise we have to find out the hard way: if *any* source file # Otherwise we have to find out the hard way: if *any* source file
# is more recent than 'target', then 'target' is out-of-date and # is more recent than 'target', then 'target' is out-of-date and
# we can immediately return true. If we fall through to the end # we can immediately return true. If we fall through to the end
...@@ -80,12 +80,12 @@ def newer_group (sources, target, missing='error'): ...@@ -80,12 +80,12 @@ def newer_group (sources, target, missing='error'):
for source in sources: for source in sources:
if not os.path.exists(source): if not os.path.exists(source):
if missing == 'error': # blow up when we stat() the file if missing == 'error': # blow up when we stat() the file
pass pass
elif missing == 'ignore': # missing source dropped from elif missing == 'ignore': # missing source dropped from
continue # target's dependency list continue # target's dependency list
elif missing == 'newer': # missing source means target is elif missing == 'newer': # missing source means target is
return 1 # out-of-date return 1 # out-of-date
source_mtime = os.stat(source)[ST_MTIME] source_mtime = os.stat(source)[ST_MTIME]
if source_mtime > target_mtime: if source_mtime > target_mtime:
return 1 return 1
......
...@@ -49,7 +49,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0): ...@@ -49,7 +49,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
(head, tail) = os.path.split(name) (head, tail) = os.path.split(name)
tails = [tail] # stack of lone dirs to create tails = [tail] # stack of lone dirs to create
while head and tail and not os.path.isdir(head): while head and tail and not os.path.isdir(head):
#print "splitting '%s': " % head, #print "splitting '%s': " % head,
(head, tail) = os.path.split(head) (head, tail) = os.path.split(head)
...@@ -140,7 +140,7 @@ def copy_tree (src, dst, ...@@ -140,7 +140,7 @@ def copy_tree (src, dst,
if not dry_run and not os.path.isdir(src): if not dry_run and not os.path.isdir(src):
raise DistutilsFileError, \ raise DistutilsFileError, \
"cannot copy tree '%s': not a directory" % src "cannot copy tree '%s': not a directory" % src
try: try:
names = os.listdir(src) names = os.listdir(src)
except os.error, (errno, errstr): except os.error, (errno, errstr):
...@@ -166,7 +166,7 @@ def copy_tree (src, dst, ...@@ -166,7 +166,7 @@ def copy_tree (src, dst,
if not dry_run: if not dry_run:
os.symlink(link_dest, dst_name) os.symlink(link_dest, dst_name)
outputs.append(dst_name) outputs.append(dst_name)
elif os.path.isdir(src_name): elif os.path.isdir(src_name):
outputs.extend( outputs.extend(
copy_tree(src_name, dst_name, copy_tree(src_name, dst_name,
......
...@@ -97,7 +97,7 @@ class Distribution: ...@@ -97,7 +97,7 @@ class Distribution:
# -- Creation/initialization methods ------------------------------- # -- Creation/initialization methods -------------------------------
def __init__ (self, attrs=None): def __init__ (self, attrs=None):
"""Construct a new Distribution instance: initialize all the """Construct a new Distribution instance: initialize all the
attributes of a Distribution, and then use 'attrs' (a dictionary attributes of a Distribution, and then use 'attrs' (a dictionary
...@@ -208,7 +208,7 @@ class Distribution: ...@@ -208,7 +208,7 @@ class Distribution:
"invalid distribution option '%s'" % key "invalid distribution option '%s'" % key
self.finalize_options() self.finalize_options()
# __init__ () # __init__ ()
...@@ -251,7 +251,7 @@ class Distribution: ...@@ -251,7 +251,7 @@ class Distribution:
print indent + " " + line print indent + " " + line
# dump_option_dicts () # dump_option_dicts ()
# -- Config file finding/parsing methods --------------------------- # -- Config file finding/parsing methods ---------------------------
...@@ -378,7 +378,7 @@ class Distribution: ...@@ -378,7 +378,7 @@ class Distribution:
cmdlist = self.get_command_list() cmdlist = self.get_command_list()
self.script_args = EasyDialogs.GetArgv( self.script_args = EasyDialogs.GetArgv(
self.global_options + self.display_options, cmdlist) self.global_options + self.display_options, cmdlist)
# We have to parse the command line a bit at a time -- global # We have to parse the command line a bit at a time -- global
# options, then the first command, then its options, and so on -- # options, then the first command, then its options, and so on --
# because each command will be handled by a different class, and # because each command will be handled by a different class, and
...@@ -396,7 +396,7 @@ class Distribution: ...@@ -396,7 +396,7 @@ class Distribution:
# for display options we return immediately # for display options we return immediately
if self.handle_display_options(option_order): if self.handle_display_options(option_order):
return return
while args: while args:
args = self._parse_command_opts(parser, args) args = self._parse_command_opts(parser, args)
if args is None: # user asked for help (and got it) if args is None: # user asked for help (and got it)
...@@ -508,7 +508,7 @@ class Distribution: ...@@ -508,7 +508,7 @@ class Distribution:
"must be a callable object (function, etc.)" "must be a callable object (function, etc.)"
% (`func`, help_option)) % (`func`, help_option))
if help_option_found: if help_option_found:
return return
# Put the options from the command-line into their official # Put the options from the command-line into their official
...@@ -801,7 +801,7 @@ class Distribution: ...@@ -801,7 +801,7 @@ class Distribution:
(from 'self.command_options'). (from 'self.command_options').
""" """
from distutils.core import DEBUG from distutils.core import DEBUG
command_name = command_obj.get_command_name() command_name = command_obj.get_command_name()
if option_dict is None: if option_dict is None:
option_dict = self.get_option_dict(command_name) option_dict = self.get_option_dict(command_name)
...@@ -841,7 +841,7 @@ class Distribution: ...@@ -841,7 +841,7 @@ class Distribution:
user-supplied values from the config files and command line. user-supplied values from the config files and command line.
You'll have to re-finalize the command object (by calling You'll have to re-finalize the command object (by calling
'finalize_options()' or 'ensure_finalized()') before using it for 'finalize_options()' or 'ensure_finalized()') before using it for
real. real.
'command' should be a command name (string) or command object. If 'command' should be a command name (string) or command object. If
'reinit_subcommands' is true, also reinitializes the command's 'reinit_subcommands' is true, also reinitializes the command's
...@@ -868,11 +868,11 @@ class Distribution: ...@@ -868,11 +868,11 @@ class Distribution:
if reinit_subcommands: if reinit_subcommands:
for sub in command.get_sub_commands(): for sub in command.get_sub_commands():
self.reinitialize_command(sub, reinit_subcommands) self.reinitialize_command(sub, reinit_subcommands)
return command return command
# -- Methods that operate on the Distribution ---------------------- # -- Methods that operate on the Distribution ----------------------
def announce (self, msg, level=1): def announce (self, msg, level=1):
...@@ -976,7 +976,7 @@ class DistributionMetadata: ...@@ -976,7 +976,7 @@ class DistributionMetadata:
self.long_description = None self.long_description = None
self.keywords = None self.keywords = None
self.platforms = None self.platforms = None
def write_pkg_info (self, base_dir): def write_pkg_info (self, base_dir):
"""Write the PKG-INFO file into the release tree. """Write the PKG-INFO file into the release tree.
""" """
...@@ -1003,9 +1003,9 @@ class DistributionMetadata: ...@@ -1003,9 +1003,9 @@ class DistributionMetadata:
pkg_info.write('Platform: %s\n' % platform ) pkg_info.write('Platform: %s\n' % platform )
pkg_info.close() pkg_info.close()
# write_pkg_info () # write_pkg_info ()
# -- Metadata query methods ---------------------------------------- # -- Metadata query methods ----------------------------------------
def get_name (self): def get_name (self):
...@@ -1045,7 +1045,7 @@ class DistributionMetadata: ...@@ -1045,7 +1045,7 @@ class DistributionMetadata:
def get_license(self): def get_license(self):
return self.license or "UNKNOWN" return self.license or "UNKNOWN"
get_licence = get_license get_licence = get_license
def get_description(self): def get_description(self):
return self.description or "UNKNOWN" return self.description or "UNKNOWN"
......
...@@ -16,7 +16,7 @@ from types import * ...@@ -16,7 +16,7 @@ from types import *
# module is already big enough, and I want to make this class a bit more # module is already big enough, and I want to make this class a bit more
# complex to simplify some common cases ("foo" module in "foo.c") and do # complex to simplify some common cases ("foo" module in "foo.c") and do
# better error-checking ("foo.c" actually exists). # better error-checking ("foo.c" actually exists).
# #
# Also, putting this in build_ext.py means every setup script would have to # Also, putting this in build_ext.py means every setup script would have to
# import that large-ish module (indirectly, through distutils.core) in # import that large-ish module (indirectly, through distutils.core) in
# order to do anything. # order to do anything.
...@@ -211,7 +211,7 @@ def read_setup_file (filename): ...@@ -211,7 +211,7 @@ def read_setup_file (filename):
#extensions[module] = { 'sources': source_files, #extensions[module] = { 'sources': source_files,
# 'cpp_args': cpp_args, # 'cpp_args': cpp_args,
# 'lib_args': library_args } # 'lib_args': library_args }
return extensions return extensions
# read_setup_file () # read_setup_file ()
...@@ -73,7 +73,7 @@ class FancyGetopt: ...@@ -73,7 +73,7 @@ class FancyGetopt:
# 'negative_alias' keeps track of options that are the boolean # 'negative_alias' keeps track of options that are the boolean
# opposite of some other option # opposite of some other option
self.negative_alias = {} self.negative_alias = {}
# These keep track of the information in the option table. We # These keep track of the information in the option table. We
# don't actually populate these structures until we're ready to # don't actually populate these structures until we're ready to
# parse the command-line, since the 'option_table' passed in here # parse the command-line, since the 'option_table' passed in here
...@@ -90,7 +90,7 @@ class FancyGetopt: ...@@ -90,7 +90,7 @@ class FancyGetopt:
self.option_order = [] self.option_order = []
# __init__ () # __init__ ()
def _build_index (self): def _build_index (self):
self.option_index.clear() self.option_index.clear()
...@@ -117,7 +117,7 @@ class FancyGetopt: ...@@ -117,7 +117,7 @@ class FancyGetopt:
return self.option_index.has_key(long_option) return self.option_index.has_key(long_option)
def get_attr_name (self, long_option): def get_attr_name (self, long_option):
"""Translate long option name 'long_option' to the form it """Translate long option name 'long_option' to the form it
has as an attribute of some object: ie., translate hyphens has as an attribute of some object: ie., translate hyphens
to underscores.""" to underscores."""
return string.translate(long_option, longopt_xlate) return string.translate(long_option, longopt_xlate)
...@@ -134,7 +134,7 @@ class FancyGetopt: ...@@ -134,7 +134,7 @@ class FancyGetopt:
raise DistutilsGetoptError, \ raise DistutilsGetoptError, \
("invalid %s '%s': " ("invalid %s '%s': "
"aliased option '%s' not defined") % (what, alias, opt) "aliased option '%s' not defined") % (what, alias, opt)
def set_aliases (self, alias): def set_aliases (self, alias):
"""Set the aliases for this option parser.""" """Set the aliases for this option parser."""
self._check_alias_dict(alias, "alias") self._check_alias_dict(alias, "alias")
...@@ -476,7 +476,7 @@ def translate_longopt (opt): ...@@ -476,7 +476,7 @@ def translate_longopt (opt):
changing "-" to "_". changing "-" to "_".
""" """
return string.translate(opt, longopt_xlate) return string.translate(opt, longopt_xlate)
class OptionDummy: class OptionDummy:
"""Dummy class just used as a place to hold command-line option """Dummy class just used as a place to hold command-line option
...@@ -489,7 +489,7 @@ class OptionDummy: ...@@ -489,7 +489,7 @@ class OptionDummy:
setattr(self, opt, None) setattr(self, opt, None)
# class OptionDummy # class OptionDummy
if __name__ == "__main__": if __name__ == "__main__":
text = """\ text = """\
......
...@@ -35,20 +35,20 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): ...@@ -35,20 +35,20 @@ def _copy_file_contents (src, dst, buffer_size=16*1024):
except os.error, (errno, errstr): except os.error, (errno, errstr):
raise DistutilsFileError, \ raise DistutilsFileError, \
"could not open '%s': %s" % (src, errstr) "could not open '%s': %s" % (src, errstr)
try: try:
fdst = open(dst, 'wb') fdst = open(dst, 'wb')
except os.error, (errno, errstr): except os.error, (errno, errstr):
raise DistutilsFileError, \ raise DistutilsFileError, \
"could not create '%s': %s" % (dst, errstr) "could not create '%s': %s" % (dst, errstr)
while 1: while 1:
try: try:
buf = fsrc.read(buffer_size) buf = fsrc.read(buffer_size)
except os.error, (errno, errstr): except os.error, (errno, errstr):
raise DistutilsFileError, \ raise DistutilsFileError, \
"could not read from '%s': %s" % (src, errstr) "could not read from '%s': %s" % (src, errstr)
if not buf: if not buf:
break break
...@@ -57,7 +57,7 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): ...@@ -57,7 +57,7 @@ def _copy_file_contents (src, dst, buffer_size=16*1024):
except os.error, (errno, errstr): except os.error, (errno, errstr):
raise DistutilsFileError, \ raise DistutilsFileError, \
"could not write to '%s': %s" % (dst, errstr) "could not write to '%s': %s" % (dst, errstr)
finally: finally:
if fdst: if fdst:
fdst.close() fdst.close()
...@@ -134,7 +134,7 @@ def copy_file (src, dst, ...@@ -134,7 +134,7 @@ def copy_file (src, dst,
print "%s %s -> %s" % (action, src, dir) print "%s %s -> %s" % (action, src, dir)
else: else:
print "%s %s -> %s" % (action, src, dst) print "%s %s -> %s" % (action, src, dst)
if dry_run: if dry_run:
return (dst, 1) return (dst, 1)
...@@ -146,7 +146,7 @@ def copy_file (src, dst, ...@@ -146,7 +146,7 @@ def copy_file (src, dst,
except os.error, exc: except os.error, exc:
raise DistutilsFileError, \ raise DistutilsFileError, \
"could not copy '%s' to '%s': %s" % (src, dst, exc[-1]) "could not copy '%s' to '%s': %s" % (src, dst, exc[-1])
# If linking (hard or symbolic), use the appropriate system call # If linking (hard or symbolic), use the appropriate system call
# (Unix only, of course, but that's the caller's responsibility) # (Unix only, of course, but that's the caller's responsibility)
elif link == 'hard': elif link == 'hard':
...@@ -189,7 +189,7 @@ def move_file (src, dst, ...@@ -189,7 +189,7 @@ def move_file (src, dst,
""" """
from os.path import exists, isfile, isdir, basename, dirname from os.path import exists, isfile, isdir, basename, dirname
import errno import errno
if verbose: if verbose:
print "moving %s -> %s" % (src, dst) print "moving %s -> %s" % (src, dst)
...@@ -232,7 +232,7 @@ def move_file (src, dst, ...@@ -232,7 +232,7 @@ def move_file (src, dst,
except os.error: except os.error:
pass pass
raise DistutilsFileError, \ raise DistutilsFileError, \
("couldn't move '%s' to '%s' by copy/delete: " + ("couldn't move '%s' to '%s' by copy/delete: " +
"delete '%s' failed: %s") % \ "delete '%s' failed: %s") % \
(src, dst, src, msg) (src, dst, src, msg)
......
...@@ -7,7 +7,7 @@ and building lists of files. ...@@ -7,7 +7,7 @@ and building lists of files.
# created 2000/07/17, Rene Liebscher (as template.py) # created 2000/07/17, Rene Liebscher (as template.py)
# most parts taken from commands/sdist.py # most parts taken from commands/sdist.py
# renamed 2000/07/29 (to filelist.py) and officially added to # renamed 2000/07/29 (to filelist.py) and officially added to
# the Distutils source, Greg Ward # the Distutils source, Greg Ward
__revision__ = "$Id$" __revision__ = "$Id$"
...@@ -34,8 +34,8 @@ class FileList: ...@@ -34,8 +34,8 @@ class FileList:
filtering applied) filtering applied)
""" """
def __init__(self, def __init__(self,
warn=None, warn=None,
debug_print=None): debug_print=None):
# use standard warning and debug functions if no other given # use standard warning and debug functions if no other given
self.warn = warn or self.__warn self.warn = warn or self.__warn
...@@ -53,10 +53,10 @@ class FileList: ...@@ -53,10 +53,10 @@ class FileList:
# -- Fallback warning/debug functions ------------------------------ # -- Fallback warning/debug functions ------------------------------
def __warn (self, msg): def __warn (self, msg):
sys.stderr.write("warning: %s\n" % msg) sys.stderr.write("warning: %s\n" % msg)
def __debug_print (self, msg): def __debug_print (self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the """Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true. DISTUTILS_DEBUG environment variable) flag is true.
...@@ -93,7 +93,7 @@ class FileList: ...@@ -93,7 +93,7 @@ class FileList:
# -- "File template" methods --------------------------------------- # -- "File template" methods ---------------------------------------
def _parse_template_line (self, line): def _parse_template_line (self, line):
words = string.split(line) words = string.split(line)
action = words[0] action = words[0]
...@@ -129,9 +129,9 @@ class FileList: ...@@ -129,9 +129,9 @@ class FileList:
return (action, patterns, dir, dir_pattern) return (action, patterns, dir, dir_pattern)
# _parse_template_line () # _parse_template_line ()
def process_template_line (self, line):
def process_template_line (self, line):
# Parse the line: split it up, make sure the right number of words # Parse the line: split it up, make sure the right number of words
# is there, and return the relevant words. 'action' is always # is there, and return the relevant words. 'action' is always
...@@ -190,7 +190,7 @@ class FileList: ...@@ -190,7 +190,7 @@ class FileList:
self.warn(("no previously-included files matching '%s' " + self.warn(("no previously-included files matching '%s' " +
"found under directory '%s'") % "found under directory '%s'") %
(pattern, dir)) (pattern, dir))
elif action == 'graft': elif action == 'graft':
self.debug_print("graft " + dir_pattern) self.debug_print("graft " + dir_pattern)
if not self.include_pattern(None, prefix=dir_pattern): if not self.include_pattern(None, prefix=dir_pattern):
...@@ -251,7 +251,7 @@ class FileList: ...@@ -251,7 +251,7 @@ class FileList:
self.debug_print(" adding " + name) self.debug_print(" adding " + name)
self.files.append(name) self.files.append(name)
files_found = 1 files_found = 1
return files_found return files_found
# include_pattern () # include_pattern ()
...@@ -261,7 +261,7 @@ class FileList: ...@@ -261,7 +261,7 @@ class FileList:
anchor=1, prefix=None, is_regex=0): anchor=1, prefix=None, is_regex=0):
"""Remove strings (presumably filenames) from 'files' that match """Remove strings (presumably filenames) from 'files' that match
'pattern'. Other parameters are the same as for 'pattern'. Other parameters are the same as for
'include_pattern()', above. 'include_pattern()', above.
The list 'self.files' is modified in place. The list 'self.files' is modified in place.
Return 1 if files are found. Return 1 if files are found.
""" """
...@@ -274,7 +274,7 @@ class FileList: ...@@ -274,7 +274,7 @@ class FileList:
self.debug_print(" removing " + self.files[i]) self.debug_print(" removing " + self.files[i])
del self.files[i] del self.files[i]
files_found = 1 files_found = 1
return files_found return files_found
# exclude_pattern () # exclude_pattern ()
...@@ -354,14 +354,14 @@ def translate_pattern (pattern, anchor=1, prefix=None, is_regex=0): ...@@ -354,14 +354,14 @@ def translate_pattern (pattern, anchor=1, prefix=None, is_regex=0):
pattern_re = glob_to_re(pattern) pattern_re = glob_to_re(pattern)
else: else:
pattern_re = '' pattern_re = ''
if prefix is not None: if prefix is not None:
prefix_re = (glob_to_re(prefix))[0:-1] # ditch trailing $ prefix_re = (glob_to_re(prefix))[0:-1] # ditch trailing $
pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re) pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re)
else: # no prefix -- respect anchor flag else: # no prefix -- respect anchor flag
if anchor: if anchor:
pattern_re = "^" + pattern_re pattern_re = "^" + pattern_re
return re.compile(pattern_re) return re.compile(pattern_re)
# translate_pattern () # translate_pattern ()
...@@ -50,8 +50,8 @@ if _can_read_reg: ...@@ -50,8 +50,8 @@ if _can_read_reg:
HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER
HKEY_USERS = hkey_mod.HKEY_USERS HKEY_USERS = hkey_mod.HKEY_USERS
def get_devstudio_versions (): def get_devstudio_versions ():
"""Get list of devstudio versions from the Windows registry. Return a """Get list of devstudio versions from the Windows registry. Return a
...@@ -93,7 +93,7 @@ def get_msvc_paths (path, version='6.0', platform='x86'): ...@@ -93,7 +93,7 @@ def get_msvc_paths (path, version='6.0', platform='x86'):
"""Get a list of devstudio directories (include, lib or path). Return """Get a list of devstudio directories (include, lib or path). Return
a list of strings; will be empty list if unable to access the a list of strings; will be empty list if unable to access the
registry or appropriate registry keys not found.""" registry or appropriate registry keys not found."""
if not _can_read_reg: if not _can_read_reg:
return [] return []
...@@ -149,7 +149,7 @@ def find_exe (exe, version_number): ...@@ -149,7 +149,7 @@ def find_exe (exe, version_number):
if os.path.isfile(fn): if os.path.isfile(fn):
return fn return fn
return exe # last desperate hope return exe # last desperate hope
def set_path_env_var (name, version_number): def set_path_env_var (name, version_number):
...@@ -294,7 +294,7 @@ class MSVCCompiler (CCompiler) : ...@@ -294,7 +294,7 @@ class MSVCCompiler (CCompiler) :
compile_opts.extend (self.compile_options_debug) compile_opts.extend (self.compile_options_debug)
else: else:
compile_opts.extend (self.compile_options) compile_opts.extend (self.compile_options)
for i in range (len (sources)): for i in range (len (sources)):
src = sources[i] ; obj = objects[i] src = sources[i] ; obj = objects[i]
ext = (os.path.splitext (src))[1] ext = (os.path.splitext (src))[1]
...@@ -390,12 +390,12 @@ class MSVCCompiler (CCompiler) : ...@@ -390,12 +390,12 @@ class MSVCCompiler (CCompiler) :
self.spawn ([self.lib] + lib_args) self.spawn ([self.lib] + lib_args)
except DistutilsExecError, msg: except DistutilsExecError, msg:
raise LibError, msg raise LibError, msg
else: else:
self.announce ("skipping %s (up-to-date)" % output_filename) self.announce ("skipping %s (up-to-date)" % output_filename)
# create_static_lib () # create_static_lib ()
def link (self, def link (self,
target_desc, target_desc,
objects, objects,
...@@ -417,7 +417,7 @@ class MSVCCompiler (CCompiler) : ...@@ -417,7 +417,7 @@ class MSVCCompiler (CCompiler) :
if runtime_library_dirs: if runtime_library_dirs:
self.warn ("I don't know what to do with 'runtime_library_dirs': " self.warn ("I don't know what to do with 'runtime_library_dirs': "
+ str (runtime_library_dirs)) + str (runtime_library_dirs))
lib_opts = gen_lib_options (self, lib_opts = gen_lib_options (self,
library_dirs, runtime_library_dirs, library_dirs, runtime_library_dirs,
libraries) libraries)
...@@ -441,7 +441,7 @@ class MSVCCompiler (CCompiler) : ...@@ -441,7 +441,7 @@ class MSVCCompiler (CCompiler) :
for sym in (export_symbols or []): for sym in (export_symbols or []):
export_opts.append("/EXPORT:" + sym) export_opts.append("/EXPORT:" + sym)
ld_args = (ldflags + lib_opts + export_opts + ld_args = (ldflags + lib_opts + export_opts +
objects + ['/OUT:' + output_filename]) objects + ['/OUT:' + output_filename])
# The MSVC linker generates .lib and .exp files, which cannot be # The MSVC linker generates .lib and .exp files, which cannot be
......
...@@ -52,8 +52,8 @@ class MWerksCompiler (CCompiler) : ...@@ -52,8 +52,8 @@ class MWerksCompiler (CCompiler) :
force=0): force=0):
CCompiler.__init__ (self, verbose, dry_run, force) CCompiler.__init__ (self, verbose, dry_run, force)
def compile (self, def compile (self,
sources, sources,
output_dir=None, output_dir=None,
...@@ -62,14 +62,14 @@ class MWerksCompiler (CCompiler) : ...@@ -62,14 +62,14 @@ class MWerksCompiler (CCompiler) :
debug=0, debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
(output_dir, macros, include_dirs) = \ (output_dir, macros, include_dirs) = \
self._fix_compile_args (output_dir, macros, include_dirs) self._fix_compile_args (output_dir, macros, include_dirs)
self.__sources = sources self.__sources = sources
self.__macros = macros self.__macros = macros
self.__include_dirs = include_dirs self.__include_dirs = include_dirs
# Don't need extra_preargs and extra_postargs for CW # Don't need extra_preargs and extra_postargs for CW
return [] return []
def link (self, def link (self,
target_desc, target_desc,
objects, objects,
...@@ -198,7 +198,7 @@ class MWerksCompiler (CCompiler) : ...@@ -198,7 +198,7 @@ class MWerksCompiler (CCompiler) :
if self.verbose: if self.verbose:
print '\tBuild project' print '\tBuild project'
mkcwproject.buildproject(projectfilename) mkcwproject.buildproject(projectfilename)
def _filename_to_abs(self, filename): def _filename_to_abs(self, filename):
# Some filenames seem to be unix-like. Convert to Mac names. # Some filenames seem to be unix-like. Convert to Mac names.
## if '/' in filename and ':' in filename: ## if '/' in filename and ':' in filename:
...@@ -207,13 +207,11 @@ class MWerksCompiler (CCompiler) : ...@@ -207,13 +207,11 @@ class MWerksCompiler (CCompiler) :
## filename = macurl2path(filename) ## filename = macurl2path(filename)
filename = distutils.util.convert_path(filename) filename = distutils.util.convert_path(filename)
if not os.path.isabs(filename): if not os.path.isabs(filename):
curdir = os.getcwd() curdir = os.getcwd()
filename = os.path.join(curdir, filename) filename = os.path.join(curdir, filename)
# Finally remove .. components # Finally remove .. components
components = string.split(filename, ':') components = string.split(filename, ':')
for i in range(1, len(components)): for i in range(1, len(components)):
if components[i] == '..': if components[i] == '..':
components[i] = '' components[i] = ''
return string.join(components, ':') return string.join(components, ':')
...@@ -71,7 +71,7 @@ def _spawn_nt (cmd, ...@@ -71,7 +71,7 @@ def _spawn_nt (cmd,
cmd = _nt_quote_args(cmd) cmd = _nt_quote_args(cmd)
if search_path: if search_path:
# either we find one or it stays the same # either we find one or it stays the same
executable = find_executable(executable) or executable executable = find_executable(executable) or executable
if verbose: if verbose:
print string.join([executable] + cmd[1:], ' ') print string.join([executable] + cmd[1:], ' ')
if not dry_run: if not dry_run:
...@@ -87,7 +87,7 @@ def _spawn_nt (cmd, ...@@ -87,7 +87,7 @@ def _spawn_nt (cmd,
raise DistutilsExecError, \ raise DistutilsExecError, \
"command '%s' failed with exit status %d" % (cmd[0], rc) "command '%s' failed with exit status %d" % (cmd[0], rc)
def _spawn_posix (cmd, def _spawn_posix (cmd,
search_path=1, search_path=1,
verbose=0, verbose=0,
...@@ -110,11 +110,11 @@ def _spawn_posix (cmd, ...@@ -110,11 +110,11 @@ def _spawn_posix (cmd,
sys.stderr.write("unable to execute %s: %s\n" % sys.stderr.write("unable to execute %s: %s\n" %
(cmd[0], e.strerror)) (cmd[0], e.strerror))
os._exit(1) os._exit(1)
sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0])
os._exit(1) os._exit(1)
else: # in the parent else: # in the parent
# Loop until the child either exits or is terminated by a signal # Loop until the child either exits or is terminated by a signal
# (ie. keep waiting if it's merely stopped) # (ie. keep waiting if it's merely stopped)
...@@ -133,7 +133,7 @@ def _spawn_posix (cmd, ...@@ -133,7 +133,7 @@ def _spawn_posix (cmd,
raise DistutilsExecError, \ raise DistutilsExecError, \
"command '%s' failed with exit status %d" % \ "command '%s' failed with exit status %d" % \
(cmd[0], exit_status) (cmd[0], exit_status)
elif os.WIFSTOPPED(status): elif os.WIFSTOPPED(status):
continue continue
...@@ -166,4 +166,4 @@ def find_executable(executable, path=None): ...@@ -166,4 +166,4 @@ def find_executable(executable, path=None):
else: else:
return executable return executable
# find_executable() # find_executable()
...@@ -48,7 +48,7 @@ def get_python_inc(plat_specific=0, prefix=None): ...@@ -48,7 +48,7 @@ def get_python_inc(plat_specific=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.prefix or If 'prefix' is supplied, use it instead of sys.prefix or
sys.exec_prefix -- i.e., ignore 'plat_specific'. sys.exec_prefix -- i.e., ignore 'plat_specific'.
""" """
if prefix is None: if prefix is None:
prefix = plat_specific and EXEC_PREFIX or PREFIX prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix": if os.name == "posix":
...@@ -318,7 +318,7 @@ def _init_posix(): ...@@ -318,7 +318,7 @@ def _init_posix():
# the scripts are in another directory. # the scripts are in another directory.
if python_build: if python_build:
g['LDSHARED'] = g['BLDSHARED'] g['LDSHARED'] = g['BLDSHARED']
elif sys.version < '2.1': elif sys.version < '2.1':
# The following two branches are for 1.5.2 compatibility. # The following two branches are for 1.5.2 compatibility.
if sys.platform == 'aix4': # what about AIX 3.x ? if sys.platform == 'aix4': # what about AIX 3.x ?
...@@ -337,7 +337,7 @@ def _init_posix(): ...@@ -337,7 +337,7 @@ def _init_posix():
python_lib = get_python_lib(standard_lib=1) python_lib = get_python_lib(standard_lib=1)
linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0])
linkerscript = os.path.join(python_lib, 'config', linkerscript_name) linkerscript = os.path.join(python_lib, 'config', linkerscript_name)
# XXX this isn't the right place to do this: adding the Python # XXX this isn't the right place to do this: adding the Python
# library to the link, if needed, should be in the "build_ext" # library to the link, if needed, should be in the "build_ext"
# command. (It's also needed for non-MS compilers on Windows, and # command. (It's also needed for non-MS compilers on Windows, and
...@@ -345,7 +345,7 @@ def _init_posix(): ...@@ -345,7 +345,7 @@ def _init_posix():
# method.) # method.)
g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
(linkerscript, PREFIX, sys.version[0:3])) (linkerscript, PREFIX, sys.version[0:3]))
global _config_vars global _config_vars
_config_vars = g _config_vars = g
......
...@@ -86,7 +86,7 @@ class TextFile: ...@@ -86,7 +86,7 @@ class TextFile:
if filename is None and file is None: if filename is None and file is None:
raise RuntimeError, \ raise RuntimeError, \
"you must supply either or both of 'filename' and 'file'" "you must supply either or both of 'filename' and 'file'"
# set values for all options -- either from client option hash # set values for all options -- either from client option hash
# or fallback to default_options # or fallback to default_options
...@@ -113,7 +113,7 @@ class TextFile: ...@@ -113,7 +113,7 @@ class TextFile:
# actually read from the file; it's only populated by an # actually read from the file; it's only populated by an
# 'unreadline()' operation # 'unreadline()' operation
self.linebuf = [] self.linebuf = []
def open (self, filename): def open (self, filename):
"""Open a new file named 'filename'. This overrides both the """Open a new file named 'filename'. This overrides both the
...@@ -213,7 +213,7 @@ class TextFile: ...@@ -213,7 +213,7 @@ class TextFile:
# EOF; I think that's OK.) # EOF; I think that's OK.)
eol = (line[-1] == '\n') and '\n' or '' eol = (line[-1] == '\n') and '\n' or ''
line = line[0:pos] + eol line = line[0:pos] + eol
# If all that's left is whitespace, then skip line # If all that's left is whitespace, then skip line
# *now*, before we try to join it to 'buildup_line' -- # *now*, before we try to join it to 'buildup_line' --
# that way constructs like # that way constructs like
...@@ -226,7 +226,7 @@ class TextFile: ...@@ -226,7 +226,7 @@ class TextFile:
else: # it's an escaped "#" else: # it's an escaped "#"
line = string.replace (line, "\\#", "#") line = string.replace (line, "\\#", "#")
# did previous line end with a backslash? then accumulate # did previous line end with a backslash? then accumulate
if self.join_lines and buildup_line: if self.join_lines and buildup_line:
...@@ -256,7 +256,7 @@ class TextFile: ...@@ -256,7 +256,7 @@ class TextFile:
self.current_line = self.current_line[1] + 1 self.current_line = self.current_line[1] + 1
else: else:
self.current_line = self.current_line + 1 self.current_line = self.current_line + 1
# strip whitespace however the client wants (leading and # strip whitespace however the client wants (leading and
# trailing, or one or the other, or neither) # trailing, or one or the other, or neither)
...@@ -351,7 +351,7 @@ line 3 \\ ...@@ -351,7 +351,7 @@ line 3 \\
print expected_result print expected_result
print "** received:" print "** received:"
print result print result
filename = "test.txt" filename = "test.txt"
out_file = open (filename, "w") out_file = open (filename, "w")
...@@ -382,4 +382,3 @@ line 3 \\ ...@@ -382,4 +382,3 @@ line 3 \\
test_input (6, "join lines with collapsing", in_file, result6) test_input (6, "join lines with collapsing", in_file, result6)
os.remove (filename) os.remove (filename)
...@@ -103,8 +103,8 @@ class UnixCCompiler (CCompiler): ...@@ -103,8 +103,8 @@ class UnixCCompiler (CCompiler):
pp_args.extend(extra_postargs) pp_args.extend(extra_postargs)
# We need to preprocess: either we're being forced to, or we're # We need to preprocess: either we're being forced to, or we're
# generating output to stdout, or there's a target output file and # generating output to stdout, or there's a target output file and
# the source file is newer than the target (or the target doesn't # the source file is newer than the target (or the target doesn't
# exist). # exist).
if self.force or output_file is None or newer(source, output_file): if self.force or output_file is None or newer(source, output_file):
if output_file: if output_file:
...@@ -139,7 +139,7 @@ class UnixCCompiler (CCompiler): ...@@ -139,7 +139,7 @@ class UnixCCompiler (CCompiler):
extra_postargs = [] extra_postargs = []
# Compile all source files that weren't eliminated by # Compile all source files that weren't eliminated by
# '_prep_compile()'. # '_prep_compile()'.
for i in range(len(sources)): for i in range(len(sources)):
src = sources[i] ; obj = objects[i] src = sources[i] ; obj = objects[i]
if skip_sources[src]: if skip_sources[src]:
...@@ -157,7 +157,7 @@ class UnixCCompiler (CCompiler): ...@@ -157,7 +157,7 @@ class UnixCCompiler (CCompiler):
return objects return objects
# compile () # compile ()
def create_static_lib (self, def create_static_lib (self,
objects, objects,
...@@ -193,7 +193,7 @@ class UnixCCompiler (CCompiler): ...@@ -193,7 +193,7 @@ class UnixCCompiler (CCompiler):
def link (self, def link (self,
target_desc, target_desc,
objects, objects,
output_filename, output_filename,
output_dir=None, output_dir=None,
...@@ -219,7 +219,7 @@ class UnixCCompiler (CCompiler): ...@@ -219,7 +219,7 @@ class UnixCCompiler (CCompiler):
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 + ld_args = (objects + self.objects +
lib_opts + ['-o', output_filename]) lib_opts + ['-o', output_filename])
if debug: if debug:
ld_args[:0] = ['-g'] ld_args[:0] = ['-g']
...@@ -229,7 +229,7 @@ class UnixCCompiler (CCompiler): ...@@ -229,7 +229,7 @@ class UnixCCompiler (CCompiler):
ld_args.extend(extra_postargs) ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename)) self.mkpath(os.path.dirname(output_filename))
try: try:
if target_desc == CCompiler.EXECUTABLE: if target_desc == CCompiler.EXECUTABLE:
self.spawn(self.linker_exe + ld_args) self.spawn(self.linker_exe + ld_args)
else: else:
self.spawn(self.linker_so + ld_args) self.spawn(self.linker_so + ld_args)
...@@ -244,7 +244,7 @@ class UnixCCompiler (CCompiler): ...@@ -244,7 +244,7 @@ class UnixCCompiler (CCompiler):
# -- Miscellaneous methods ----------------------------------------- # -- Miscellaneous methods -----------------------------------------
# These are all used by the 'gen_lib_options() function, in # These are all used by the 'gen_lib_options() function, in
# ccompiler.py. # ccompiler.py.
def library_dir_option (self, dir): def library_dir_option (self, dir):
return "-L" + dir return "-L" + dir
......
...@@ -30,7 +30,7 @@ def get_platform (): ...@@ -30,7 +30,7 @@ def get_platform ():
solaris-2.6-sun4u solaris-2.6-sun4u
irix-5.3 irix-5.3
irix64-6.2 irix64-6.2
For non-POSIX platforms, currently just returns 'sys.platform'. For non-POSIX platforms, currently just returns 'sys.platform'.
""" """
if os.name != "posix" or not hasattr(os, 'uname'): if os.name != "posix" or not hasattr(os, 'uname'):
...@@ -44,9 +44,9 @@ def get_platform (): ...@@ -44,9 +44,9 @@ def get_platform ():
# Convert the OS name to lowercase and remove '/' characters # Convert the OS name to lowercase and remove '/' characters
# (to accommodate BSD/OS) # (to accommodate BSD/OS)
osname = string.lower(osname) osname = string.lower(osname)
osname = string.replace(osname, '/', '') osname = string.replace(osname, '/', '')
if osname[:5] == "linux": if osname[:5] == "linux":
# At least on Linux/Intel, 'machine' is the processor -- # At least on Linux/Intel, 'machine' is the processor --
# i386, etc. # i386, etc.
...@@ -59,7 +59,7 @@ def get_platform (): ...@@ -59,7 +59,7 @@ def get_platform ():
# fall through to standard osname-release-machine representation # fall through to standard osname-release-machine representation
elif osname[:4] == "irix": # could be "irix64"! elif osname[:4] == "irix": # could be "irix64"!
return "%s-%s" % (osname, release) return "%s-%s" % (osname, release)
elif osname[:3] == "aix": elif osname[:3] == "aix":
return "%s-%s.%s" % (osname, version, release) return "%s-%s.%s" % (osname, version, release)
elif osname[:6] == "cygwin": elif osname[:6] == "cygwin":
osname = "cygwin" osname = "cygwin"
...@@ -67,7 +67,7 @@ def get_platform (): ...@@ -67,7 +67,7 @@ def get_platform ():
m = rel_re.match(release) m = rel_re.match(release)
if m: if m:
release = m.group() release = m.group()
return "%s-%s-%s" % (osname, release, machine) return "%s-%s-%s" % (osname, release, machine)
# get_platform () # get_platform ()
...@@ -280,7 +280,7 @@ def execute (func, args, msg=None, verbose=0, dry_run=0): ...@@ -280,7 +280,7 @@ def execute (func, args, msg=None, verbose=0, dry_run=0):
# Generate a message if we weren't passed one # Generate a message if we weren't passed one
if msg is None: if msg is None:
msg = "%s%s" % (func.__name__, `args`) msg = "%s%s" % (func.__name__, `args`)
if msg[-2:] == ',)': # correct for singleton tuple if msg[-2:] == ',)': # correct for singleton tuple
msg = msg[0:-2] + ')' msg = msg[0:-2] + ')'
# Print it if verbosity level is high enough # Print it if verbosity level is high enough
...@@ -403,7 +403,7 @@ byte_compile(files, optimize=%s, force=%s, ...@@ -403,7 +403,7 @@ byte_compile(files, optimize=%s, force=%s,
spawn(cmd, verbose=verbose, dry_run=dry_run) spawn(cmd, verbose=verbose, dry_run=dry_run)
execute(os.remove, (script_name,), "removing %s" % script_name, execute(os.remove, (script_name,), "removing %s" % script_name,
verbose=verbose, dry_run=dry_run) verbose=verbose, dry_run=dry_run)
# "Direct" byte-compilation: use the py_compile module to compile # "Direct" byte-compilation: use the py_compile module to compile
# right here, right now. Note that the script generated in indirect # right here, right now. Note that the script generated in indirect
# mode simply calls 'byte_compile()' in direct mode, a weird sort of # mode simply calls 'byte_compile()' in direct mode, a weird sort of
...@@ -453,5 +453,3 @@ def rfc822_escape (header): ...@@ -453,5 +453,3 @@ def rfc822_escape (header):
lines = map(string.strip, lines) lines = map(string.strip, lines)
header = string.join(lines, '\n' + 8*' ') header = string.join(lines, '\n' + 8*' ')
return header return header
...@@ -98,7 +98,7 @@ class StrictVersion (Version): ...@@ -98,7 +98,7 @@ class StrictVersion (Version):
The rationale for this version numbering system will be explained The rationale for this version numbering system will be explained
in the distutils documentation. in the distutils documentation.
""" """
version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
re.VERBOSE) re.VERBOSE)
...@@ -123,7 +123,7 @@ class StrictVersion (Version): ...@@ -123,7 +123,7 @@ class StrictVersion (Version):
def __str__ (self): def __str__ (self):
if self.version[2] == 0: if self.version[2] == 0:
vstring = string.join(map(str, self.version[0:2]), '.') vstring = string.join(map(str, self.version[0:2]), '.')
else: else:
...@@ -133,7 +133,7 @@ class StrictVersion (Version): ...@@ -133,7 +133,7 @@ class StrictVersion (Version):
vstring = vstring + self.prerelease[0] + str(self.prerelease[1]) vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
return vstring return vstring
def __cmp__ (self, other): def __cmp__ (self, other):
if isinstance(other, StringType): if isinstance(other, StringType):
...@@ -170,7 +170,7 @@ class StrictVersion (Version): ...@@ -170,7 +170,7 @@ class StrictVersion (Version):
# 2) sequences of letters are part of the tuple for comparison and are # 2) sequences of letters are part of the tuple for comparison and are
# compared lexicographically # compared lexicographically
# 3) recognize the numeric components may have leading zeroes # 3) recognize the numeric components may have leading zeroes
# #
# The LooseVersion class below implements these rules: a version number # The LooseVersion class below implements these rules: a version number
# string is split up into a tuple of integer and string components, and # string is split up into a tuple of integer and string components, and
# comparison is a simple tuple comparison. This means that version # comparison is a simple tuple comparison. This means that version
...@@ -185,7 +185,7 @@ class StrictVersion (Version): ...@@ -185,7 +185,7 @@ class StrictVersion (Version):
# - indicating a post-release patch ('p', 'pl', 'patch') # - indicating a post-release patch ('p', 'pl', 'patch')
# but of course this can't cover all version number schemes, and there's # but of course this can't cover all version number schemes, and there's
# no way to know what a programmer means without asking him. # no way to know what a programmer means without asking him.
# #
# The problem is what to do with letters (and other non-numeric # The problem is what to do with letters (and other non-numeric
# characters) in a version number. The current implementation does the # characters) in a version number. The current implementation does the
# obvious and predictable thing: keep them as strings and compare # obvious and predictable thing: keep them as strings and compare
...@@ -208,7 +208,7 @@ class StrictVersion (Version): ...@@ -208,7 +208,7 @@ class StrictVersion (Version):
# version numbering scheme to its domination. The free-thinking # version numbering scheme to its domination. The free-thinking
# anarchists in the lot will never give in, though, and something needs # anarchists in the lot will never give in, though, and something needs
# to be done to accommodate them. # to be done to accommodate them.
# #
# Perhaps a "moderately strict" version class could be implemented that # Perhaps a "moderately strict" version class could be implemented that
# lets almost anything slide (syntactically), and makes some heuristic # lets almost anything slide (syntactically), and makes some heuristic
# assumptions about non-digits in version number strings. This could # assumptions about non-digits in version number strings. This could
...@@ -217,7 +217,7 @@ class StrictVersion (Version): ...@@ -217,7 +217,7 @@ class StrictVersion (Version):
# somehow knows that "1.2.1" < "1.2.2a2" < "1.2.2" < "1.2.2pl3", and is # somehow knows that "1.2.1" < "1.2.2a2" < "1.2.2" < "1.2.2pl3", and is
# just as happy dealing with things like "2g6" and "1.13++". I don't # just as happy dealing with things like "2g6" and "1.13++". I don't
# think I'm smart enough to do it right though. # think I'm smart enough to do it right though.
# #
# In any case, I've coded the test suite for this module (see # In any case, I've coded the test suite for this module (see
# ../test/test_version.py) specifically to fail on things like comparing # ../test/test_version.py) specifically to fail on things like comparing
# "1.2a2" and "1.2". That's not because the *code* is doing anything # "1.2a2" and "1.2". That's not because the *code* is doing anything
...@@ -296,6 +296,6 @@ class LooseVersion (Version): ...@@ -296,6 +296,6 @@ class LooseVersion (Version):
other = LooseVersion(other) other = LooseVersion(other)
return cmp(self.version, other.version) return cmp(self.version, other.version)
# end class LooseVersion # end class LooseVersion
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment