diff options
author | Fred Drake <fdrake@acm.org> | 2001-12-06 20:51:35 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-12-06 20:51:35 (GMT) |
commit | b94b849d65af71b4b432a74fdaef8ccd88209cc0 (patch) | |
tree | d32dd5d053192834153d90685ca56361f5ecc62a | |
parent | bcd8975740da47e7d1c8a5d2839ad4bf214fe34b (diff) | |
download | cpython-b94b849d65af71b4b432a74fdaef8ccd88209cc0.zip cpython-b94b849d65af71b4b432a74fdaef8ccd88209cc0.tar.gz cpython-b94b849d65af71b4b432a74fdaef8ccd88209cc0.tar.bz2 |
Whitespace normalization.
-rw-r--r-- | Lib/distutils/archive_util.py | 6 | ||||
-rw-r--r-- | Lib/distutils/bcppcompiler.py | 32 | ||||
-rw-r--r-- | Lib/distutils/ccompiler.py | 34 | ||||
-rw-r--r-- | Lib/distutils/cmd.py | 20 | ||||
-rw-r--r-- | Lib/distutils/core.py | 4 | ||||
-rw-r--r-- | Lib/distutils/cygwinccompiler.py | 97 | ||||
-rw-r--r-- | Lib/distutils/dep_util.py | 8 | ||||
-rw-r--r-- | Lib/distutils/dir_util.py | 6 | ||||
-rw-r--r-- | Lib/distutils/dist.py | 28 | ||||
-rw-r--r-- | Lib/distutils/extension.py | 4 | ||||
-rw-r--r-- | Lib/distutils/fancy_getopt.py | 12 | ||||
-rw-r--r-- | Lib/distutils/file_util.py | 16 | ||||
-rw-r--r-- | Lib/distutils/filelist.py | 28 | ||||
-rw-r--r-- | Lib/distutils/msvccompiler.py | 18 | ||||
-rw-r--r-- | Lib/distutils/mwerkscompiler.py | 32 | ||||
-rw-r--r-- | Lib/distutils/spawn.py | 12 | ||||
-rw-r--r-- | Lib/distutils/sysconfig.py | 8 | ||||
-rw-r--r-- | Lib/distutils/text_file.py | 13 | ||||
-rw-r--r-- | Lib/distutils/unixccompiler.py | 16 | ||||
-rw-r--r-- | Lib/distutils/util.py | 16 | ||||
-rw-r--r-- | Lib/distutils/version.py | 16 |
21 files changed, 210 insertions, 216 deletions
diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py index 4c5641b..58d9a06 100644 --- a/Lib/distutils/archive_util.py +++ b/Lib/distutils/archive_util.py @@ -31,7 +31,7 @@ def make_tarball (base_name, base_dir, compress="gzip", compress_ext = { 'gzip': ".gz", 'bzip2': '.bz2', 'compress': ".Z" } - + # flags for compression program, each element of list will be an argument compress_flags = {'gzip': ["-f9"], 'compress': ["-f"], @@ -85,7 +85,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): import zipfile except ImportError: raise DistutilsExecError, \ - ("unable to create zip file '%s': " + + ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename @@ -152,7 +152,7 @@ def make_archive (base_name, format, kwargs = { 'verbose': verbose, 'dry_run': dry_run } - + try: format_info = ARCHIVE_FORMATS[format] except KeyError: diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py index 5c0fae8..9ebba2d 100644 --- a/Lib/distutils/bcppcompiler.py +++ b/Lib/distutils/bcppcompiler.py @@ -102,7 +102,7 @@ class BCPPCompiler(CCompiler) : compile_opts.extend (self.compile_options_debug) else: compile_opts.extend (self.compile_options) - + for i in range (len (sources)): src = sources[i] ; obj = objects[i] ext = (os.path.splitext (src))[1] @@ -130,11 +130,11 @@ class BCPPCompiler(CCompiler) : input_opt = "" elif ext in self._cpp_extensions: input_opt = "-P" - else: + else: # Unknown file type -- no extra options. The compiler # will probably fail, but let it just in case this is a # file the compiler recognizes even if we don't. - input_opt = "" + input_opt = "" output_opt = "-o" + obj @@ -174,17 +174,17 @@ class BCPPCompiler(CCompiler) : if extra_postargs: lib_args.extend (extra_postargs) try: - self.spawn ([self.lib] + lib_args) + self.spawn ([self.lib] + lib_args) except DistutilsExecError, msg: - raise LibError, msg + raise LibError, msg else: self.announce ("skipping %s (up-to-date)" % output_filename) # create_static_lib () - - + + def link (self, - target_desc, + target_desc, objects, output_filename, output_dir=None, @@ -254,14 +254,14 @@ class BCPPCompiler(CCompiler) : resources.append(file) else: objects.append(file) - - + + 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 - # list of object files - ld_args.extend(objects) + # list of object files + ld_args.extend(objects) # XXX the command-line syntax for Borland C++ is a bit wonky; # certain filenames are jammed together in one big string, but @@ -275,11 +275,11 @@ class BCPPCompiler(CCompiler) : # name of dll/exe file ld_args.extend([',',output_filename]) - # no map file and start libraries + # no map file and start libraries ld_args.append(',,') 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) libfile = self.find_library_file(library_dirs, lib, debug) if libfile is None: @@ -300,7 +300,7 @@ class BCPPCompiler(CCompiler) : ld_args.append(',') ld_args.extend(resources) - + if extra_preargs: ld_args[:0] = extra_preargs if extra_postargs: diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index 4efd934..21bf0c17 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -61,7 +61,7 @@ class CCompiler: # different versions of libfoo.a in different locations. I # think this is useless without the ability to null out the # library search path anyways. - + # Subclasses that rely on the standard filename generation methods # implemented below should override these; see the comment near @@ -159,7 +159,7 @@ class CCompiler: setattr(self, key, split_quoted(value)) else: setattr(self, key, value) - + def _find_macro (self, name): @@ -352,7 +352,7 @@ class CCompiler: else: raise TypeError, \ "'include_dirs' (if supplied) must be a list of strings" - + return (output_dir, macros, include_dirs) # _fix_compile_args () @@ -364,7 +364,7 @@ class CCompiler: list of all object files and a dictionary telling which source 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, strip_dir=1, output_dir=output_dir) @@ -401,7 +401,7 @@ class CCompiler: raise TypeError, \ "'objects' must be a list or tuple of strings" objects = list (objects) - + if output_dir is None: output_dir = self.output_dir elif type (output_dir) is not StringType: @@ -560,7 +560,7 @@ class CCompiler: Raises LibError on failure. """ pass - + # values for target_desc parameter in link() SHARED_OBJECT = "shared_object" @@ -621,7 +621,7 @@ class CCompiler: """ raise NotImplementedError - + # Old 'link_*()' methods, rewritten to use the new 'link()' method. def link_shared_lib (self, @@ -636,13 +636,13 @@ class CCompiler: extra_preargs=None, extra_postargs=None, build_temp=None): - self.link(CCompiler.SHARED_LIBRARY, objects, + self.link(CCompiler.SHARED_LIBRARY, objects, self.library_filename(output_libname, lib_type='shared'), output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, extra_preargs, extra_postargs, build_temp) - + def link_shared_object (self, objects, @@ -673,9 +673,9 @@ class CCompiler: debug=0, extra_preargs=None, extra_postargs=None): - self.link(CCompiler.EXECUTABLE, objects, + self.link(CCompiler.EXECUTABLE, objects, 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) @@ -846,12 +846,12 @@ _default_compilers = ( # on a cygwin built python we can use gcc like an ordinary UNIXish # compiler ('cygwin.*', 'unix'), - + # OS name mappings ('posix', 'unix'), ('nt', 'msvc'), ('mac', 'mwerks'), - + ) def get_default_compiler(osname=None, platform=None): @@ -901,7 +901,7 @@ def show_compilers(): # XXX this "knows" that the compiler option it's describing is # "--compiler", which just happens to be the case for the three # commands that use it. - from distutils.fancy_getopt import FancyGetopt + from distutils.fancy_getopt import FancyGetopt compilers = [] for compiler in compiler_class.keys(): compilers.append(("compiler="+compiler, None, @@ -909,7 +909,7 @@ def show_compilers(): compilers.sort() pretty_printer = FancyGetopt(compilers) pretty_printer.print_help("List of available compilers:") - + def new_compiler (plat=None, compiler=None, @@ -932,14 +932,14 @@ def new_compiler (plat=None, try: if compiler is None: compiler = get_default_compiler(plat) - + (module_name, class_name, long_description) = compiler_class[compiler] except KeyError: msg = "don't know how to compile C/C++ code on platform '%s'" % plat if compiler is not None: msg = msg + " with '%s' compiler" % compiler raise DistutilsPlatformError, msg - + try: module_name = "distutils." + module_name __import__ (module_name) diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py index 85a7f46..65060d6 100644 --- a/Lib/distutils/cmd.py +++ b/Lib/distutils/cmd.py @@ -41,7 +41,7 @@ class Command: # current situation. (Eg. we "install_headers" is only applicable if # we have any C header files to install.) If 'predicate' is None, # that command is always applicable. - # + # # 'sub_commands' is usually defined at the *end* of a class, because # predicates can be unbound methods, so they must already have been # defined. The canonical example is the "install" command. @@ -111,7 +111,7 @@ class Command: if not self.finalized: self.finalize_options() self.finalized = 1 - + # Subclasses must define: # initialize_options() @@ -133,12 +133,12 @@ class Command: command-line. Thus, this is not the place to code dependencies between options; generally, 'initialize_options()' implementations are just a bunch of "self.foo = None" assignments. - + This method must be implemented by all command classes. """ raise RuntimeError, \ "abstract method -- subclass %s must override" % self.__class__ - + def finalize_options (self): """Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option @@ -198,12 +198,12 @@ class Command: if DEBUG: print msg sys.stdout.flush() - + # -- Option validation methods ------------------------------------- # (these are very handy in writing the 'finalize_options()' method) - # + # # NB. the general philosophy here is to ensure that a particular option # 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, @@ -252,7 +252,7 @@ class Command: raise DistutilsOptionError, \ "'%s' must be a list of strings (got %s)" % \ (option, `val`) - + def _ensure_tested_string (self, option, tester, what, error_fmt, default=None): val = self._ensure_stringlike(option, what, default) @@ -382,7 +382,7 @@ class Command: and force flags. """ return dir_util.copy_tree( - infile, outfile, + infile, outfile, preserve_mode,preserve_times,preserve_symlinks, not self.force, self.verbose >= level, @@ -426,7 +426,7 @@ class Command: (outfile, string.join(infiles, ', ')) if skip_msg is None: skip_msg = "skipping %s (inputs unchanged)" % outfile - + # Allow 'infiles' to be a single string if type(infiles) is StringType: @@ -459,7 +459,7 @@ class install_misc (Command): """Common base class for installing some files in a subdirectory. Currently used by install_data and install_scripts. """ - + user_options = [('install-dir=', 'd', "directory to install the files to")] def initialize_options (self): diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index 2aab7c4..97a741c 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -108,7 +108,7 @@ def setup (**attrs): # Find and parse the config file(s): they will override options from # the setup script, but be overridden by the command line. dist.parse_config_files() - + if DEBUG: print "options (after parsing config files):" dist.dump_option_dicts() @@ -146,7 +146,7 @@ def setup (**attrs): raise else: raise SystemExit, error - + except (DistutilsExecError, DistutilsFileError, DistutilsOptionError, diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 07e1665..1d97282 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -18,28 +18,28 @@ cygwin in no-cygwin mode). # # see also http://starship.python.net/crew/kernr/mingw32/Notes.html # -# * We put export_symbols in a def-file, and don't use +# * We put export_symbols in a def-file, and don't use # --export-all-symbols because it doesn't worked reliable in some # tested configurations. And because other windows compilers also # need their symbols specified this no serious problem. # # tested configurations: -# -# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works +# +# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works # (after patching python's config.h and for C++ some other include files) # see also http://starship.python.net/crew/kernr/mingw32/Notes.html -# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works -# (ld doesn't support -shared, so we use dllwrap) +# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works +# (ld doesn't support -shared, so we use dllwrap) # * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html -# - using gcc -mdll instead dllwrap doesn't work without -static because +# - using gcc -mdll instead dllwrap doesn't work without -static because # it tries to link against dlls instead their import libraries. (If # it finds the dll first.) -# By specifying -static we force ld to link against the import libraries, -# this is windows standard and there are normally not the necessary symbols +# By specifying -static we force ld to link against the import libraries, +# this is windows standard and there are normally not the necessary symbols # in the dlls. -# *** only the version of June 2000 shows these problems +# *** only the version of June 2000 shows these problems # created 2000/05/05, Rene Liebscher @@ -60,7 +60,7 @@ class CygwinCCompiler (UnixCCompiler): static_lib_format = "lib%s%s" shared_lib_format = "%s%s" exe_extension = ".exe" - + def __init__ (self, verbose=0, dry_run=0, @@ -76,20 +76,20 @@ class CygwinCCompiler (UnixCCompiler): "Python's pyconfig.h doesn't seem to support your compiler. " + ("Reason: %s." % details) + "Compiling may fail because of undefined preprocessor macros.") - + (self.gcc_version, self.ld_version, self.dllwrap_version) = \ get_versions() self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % - (self.gcc_version, - self.ld_version, + (self.gcc_version, + self.ld_version, self.dllwrap_version) ) - # ld_version >= "2.10.90" should also be able to use + # ld_version >= "2.10.90" should also be able to use # gcc -mdll instead of dllwrap - # Older dllwraps had own version numbers, newer ones use the + # Older dllwraps had own version numbers, newer ones use the # same as the rest of binutils ( also ld ) # dllwrap 2.10.90 is buggy - if self.ld_version >= "2.10.90": + if self.ld_version >= "2.10.90": self.linker_dll = "gcc" else: self.linker_dll = "dllwrap" @@ -102,22 +102,22 @@ class CygwinCCompiler (UnixCCompiler): linker_so=('%s -mcygwin -mdll -static' % self.linker_dll)) - # cygwin and mingw32 need different sets of libraries + # cygwin and mingw32 need different sets of libraries if self.gcc_version == "2.91.57": # cygwin shouldn't need msvcrt, but without the dlls will crash # (gcc version 2.91.57) -- perhaps something about initialization self.dll_libraries=["msvcrt"] - self.warn( + self.warn( "Consider upgrading to a newer version of gcc") else: self.dll_libraries=[] - + # __init__ () # not much different of the compile method in UnixCCompiler, # but we have to insert some lines in the middle of it, so # we put here a adapted version of it. - # (If we would call compile() in the base class, it would do some + # (If we would call compile() in the base class, it would do some # initializations a second time, this is why all is done here.) def compile (self, sources, @@ -143,7 +143,7 @@ class CygwinCCompiler (UnixCCompiler): extra_postargs = [] # Compile all source files that weren't eliminated by - # '_prep_compile()'. + # '_prep_compile()'. for i in range (len (sources)): src = sources[i] ; obj = objects[i] ext = (os.path.splitext (src))[1] @@ -157,7 +157,7 @@ class CygwinCCompiler (UnixCCompiler): self.spawn (["windres","-i",src,"-o",obj]) except DistutilsExecError, msg: raise CompileError, msg - else: # for other files use the C-compiler + else: # for other files use the C-compiler try: self.spawn (self.compiler_so + cc_args + [src, '-o', obj] + @@ -184,12 +184,12 @@ class CygwinCCompiler (UnixCCompiler): extra_preargs=None, extra_postargs=None, build_temp=None): - + # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) objects = copy.copy(objects or []) - + # Additional libraries libraries.extend(self.dll_libraries) @@ -199,10 +199,10 @@ class CygwinCCompiler (UnixCCompiler): (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): # (The linker doesn't do anything if output is up-to-date. # So it would probably better to check if we really need this, - # but for this we had to insert some unchanged parts of - # UnixCCompiler, and this is not what we want.) + # but for this we had to insert some unchanged parts of + # UnixCCompiler, and this is not what we want.) - # we want to put some files in the same directory as the + # we want to put some files in the same directory as the # object files are, build_temp doesn't help much # where are the object files temp_dir = os.path.dirname(objects[0]) @@ -214,7 +214,7 @@ class CygwinCCompiler (UnixCCompiler): def_file = os.path.join(temp_dir, dll_name + ".def") exp_file = os.path.join(temp_dir, dll_name + ".exp") lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") - + # Generate .def file contents = [ "LIBRARY %s" % os.path.basename(output_filename), @@ -237,21 +237,21 @@ class CygwinCCompiler (UnixCCompiler): else: # doesn't work: bfd_close build\...\libfoo.a: Invalid operation #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) - # for gcc/ld the def-file is specified as any other object files + # for gcc/ld the def-file is specified as any other object files objects.append(def_file) #end: if ((export_symbols is not None) and # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - + # who wants symbols and a many times larger output file - # should explicitly switch the debug mode on + # should explicitly switch the debug mode on # otherwise we let dllwrap/ld strip the output file - # (On my machine: 10KB < stripped_file < ??100KB + # (On my machine: 10KB < stripped_file < ??100KB # unstripped_file = stripped_file + XXX KB - # ( XXX=254 for a typical python extension)) - if not debug: - extra_preargs.append("-s") - + # ( XXX=254 for a typical python extension)) + if not debug: + extra_preargs.append("-s") + UnixCCompiler.link(self, target_desc, objects, @@ -265,7 +265,7 @@ class CygwinCCompiler (UnixCCompiler): extra_preargs, extra_postargs, build_temp) - + # link () # -- Miscellaneous methods ----------------------------------------- @@ -288,7 +288,7 @@ class CygwinCCompiler (UnixCCompiler): base = os.path.basename (base) if ext == '.res' or ext == '.rc': # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, + obj_names.append (os.path.join (output_dir, base + ext + self.obj_extension)) else: obj_names.append (os.path.join (output_dir, @@ -311,7 +311,7 @@ class Mingw32CCompiler (CygwinCCompiler): force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) - + # A real mingw32 doesn't need to specify a different entry point, # but cygwin 2.91.57 in no-cygwin-mode needs it. if self.gcc_version <= "2.91.57": @@ -322,15 +322,15 @@ class Mingw32CCompiler (CygwinCCompiler): self.set_executables(compiler='gcc -mno-cygwin -O -Wall', compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', - linker_so='%s -mno-cygwin -mdll -static %s' + linker_so='%s -mno-cygwin -mdll -static %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) - # (-mthreads: Support thread-safe exception handling on `Mingw32') - - # no additional libraries needed + # (-mthreads: Support thread-safe exception handling on `Mingw32') + + # no additional libraries needed self.dll_libraries=[] - + # __init__ () # class Mingw32CCompiler @@ -370,15 +370,15 @@ def check_config_h(): # GCC, and the pyconfig.h file should be OK if string.find(sys.version,"GCC") >= 0: return (CONFIG_H_OK, "sys.version mentions 'GCC'") - + fn = sysconfig.get_config_h_filename() try: # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough + # But we do this only once, and it is fast enough f = open(fn) s = f.read() f.close() - + except IOError, exc: # if we can't read this file, we cannot say it is wrong # the compiler will complain later about this file as missing @@ -401,7 +401,7 @@ def get_versions(): from distutils.version import StrictVersion from distutils.spawn import find_executable import re - + gcc_exe = find_executable('gcc') if gcc_exe: out = os.popen(gcc_exe + ' -dumpversion','r') @@ -439,4 +439,3 @@ def get_versions(): else: dllwrap_version = None return (gcc_version, ld_version, dllwrap_version) - diff --git a/Lib/distutils/dep_util.py b/Lib/distutils/dep_util.py index 4b93ed0..9edba4c 100644 --- a/Lib/distutils/dep_util.py +++ b/Lib/distutils/dep_util.py @@ -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 not os.path.exists(target): return 1 - + # 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 # we can immediately return true. If we fall through to the end @@ -80,12 +80,12 @@ def newer_group (sources, target, missing='error'): for source in sources: if not os.path.exists(source): if missing == 'error': # blow up when we stat() the file - pass - elif missing == 'ignore': # missing source dropped from + pass + elif missing == 'ignore': # missing source dropped from continue # target's dependency list elif missing == 'newer': # missing source means target is return 1 # out-of-date - + source_mtime = os.stat(source)[ST_MTIME] if source_mtime > target_mtime: return 1 diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py index a1578be..77007c9 100644 --- a/Lib/distutils/dir_util.py +++ b/Lib/distutils/dir_util.py @@ -49,7 +49,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0): (head, tail) = os.path.split(name) tails = [tail] # stack of lone dirs to create - + while head and tail and not os.path.isdir(head): #print "splitting '%s': " % head, (head, tail) = os.path.split(head) @@ -140,7 +140,7 @@ def copy_tree (src, dst, if not dry_run and not os.path.isdir(src): raise DistutilsFileError, \ - "cannot copy tree '%s': not a directory" % src + "cannot copy tree '%s': not a directory" % src try: names = os.listdir(src) except os.error, (errno, errstr): @@ -166,7 +166,7 @@ def copy_tree (src, dst, if not dry_run: os.symlink(link_dest, dst_name) outputs.append(dst_name) - + elif os.path.isdir(src_name): outputs.extend( copy_tree(src_name, dst_name, diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index d5bfa05..b648f24 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -97,7 +97,7 @@ class Distribution: # -- Creation/initialization methods ------------------------------- - + def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then use 'attrs' (a dictionary @@ -208,7 +208,7 @@ class Distribution: "invalid distribution option '%s'" % key self.finalize_options() - + # __init__ () @@ -251,7 +251,7 @@ class Distribution: print indent + " " + line # dump_option_dicts () - + # -- Config file finding/parsing methods --------------------------- @@ -378,7 +378,7 @@ class Distribution: cmdlist = self.get_command_list() self.script_args = EasyDialogs.GetArgv( self.global_options + self.display_options, cmdlist) - + # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and @@ -396,7 +396,7 @@ class Distribution: # for display options we return immediately if self.handle_display_options(option_order): return - + while args: args = self._parse_command_opts(parser, args) if args is None: # user asked for help (and got it) @@ -508,7 +508,7 @@ class Distribution: "must be a callable object (function, etc.)" % (`func`, help_option)) - if help_option_found: + if help_option_found: return # Put the options from the command-line into their official @@ -801,7 +801,7 @@ class Distribution: (from 'self.command_options'). """ from distutils.core import DEBUG - + command_name = command_obj.get_command_name() if option_dict is None: option_dict = self.get_option_dict(command_name) @@ -841,7 +841,7 @@ class Distribution: user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for - real. + real. 'command' should be a command name (string) or command object. If 'reinit_subcommands' is true, also reinitializes the command's @@ -868,11 +868,11 @@ class Distribution: if reinit_subcommands: for sub in command.get_sub_commands(): - self.reinitialize_command(sub, reinit_subcommands) + self.reinitialize_command(sub, reinit_subcommands) return command - + # -- Methods that operate on the Distribution ---------------------- def announce (self, msg, level=1): @@ -976,7 +976,7 @@ class DistributionMetadata: self.long_description = None self.keywords = None self.platforms = None - + def write_pkg_info (self, base_dir): """Write the PKG-INFO file into the release tree. """ @@ -1003,9 +1003,9 @@ class DistributionMetadata: pkg_info.write('Platform: %s\n' % platform ) pkg_info.close() - + # write_pkg_info () - + # -- Metadata query methods ---------------------------------------- def get_name (self): @@ -1045,7 +1045,7 @@ class DistributionMetadata: def get_license(self): return self.license or "UNKNOWN" get_licence = get_license - + def get_description(self): return self.description or "UNKNOWN" diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py index a63ede2..fbae7c5 100644 --- a/Lib/distutils/extension.py +++ b/Lib/distutils/extension.py @@ -16,7 +16,7 @@ from types import * # 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 # better error-checking ("foo.c" actually exists). -# +# # Also, putting this in build_ext.py means every setup script would have to # import that large-ish module (indirectly, through distutils.core) in # order to do anything. @@ -211,7 +211,7 @@ def read_setup_file (filename): #extensions[module] = { 'sources': source_files, # 'cpp_args': cpp_args, # 'lib_args': library_args } - + return extensions # read_setup_file () diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py index 83d0721..e65302f 100644 --- a/Lib/distutils/fancy_getopt.py +++ b/Lib/distutils/fancy_getopt.py @@ -73,7 +73,7 @@ class FancyGetopt: # 'negative_alias' keeps track of options that are the boolean # opposite of some other option self.negative_alias = {} - + # These keep track of the information in the option table. We # don't actually populate these structures until we're ready to # parse the command-line, since the 'option_table' passed in here @@ -90,7 +90,7 @@ class FancyGetopt: self.option_order = [] # __init__ () - + def _build_index (self): self.option_index.clear() @@ -117,7 +117,7 @@ class FancyGetopt: return self.option_index.has_key(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 to underscores.""" return string.translate(long_option, longopt_xlate) @@ -134,7 +134,7 @@ class FancyGetopt: raise DistutilsGetoptError, \ ("invalid %s '%s': " "aliased option '%s' not defined") % (what, alias, opt) - + def set_aliases (self, alias): """Set the aliases for this option parser.""" self._check_alias_dict(alias, "alias") @@ -476,7 +476,7 @@ def translate_longopt (opt): changing "-" to "_". """ return string.translate(opt, longopt_xlate) - + class OptionDummy: """Dummy class just used as a place to hold command-line option @@ -489,7 +489,7 @@ class OptionDummy: setattr(self, opt, None) # class OptionDummy - + if __name__ == "__main__": text = """\ diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index 991d835..526e4cf 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -35,20 +35,20 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): except os.error, (errno, errstr): raise DistutilsFileError, \ "could not open '%s': %s" % (src, errstr) - + try: fdst = open(dst, 'wb') except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (dst, errstr) - + while 1: try: buf = fsrc.read(buffer_size) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not read from '%s': %s" % (src, errstr) - + if not buf: break @@ -57,7 +57,7 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): except os.error, (errno, errstr): raise DistutilsFileError, \ "could not write to '%s': %s" % (dst, errstr) - + finally: if fdst: fdst.close() @@ -134,7 +134,7 @@ def copy_file (src, dst, print "%s %s -> %s" % (action, src, dir) else: print "%s %s -> %s" % (action, src, dst) - + if dry_run: return (dst, 1) @@ -146,7 +146,7 @@ def copy_file (src, dst, except os.error, exc: raise DistutilsFileError, \ "could not copy '%s' to '%s': %s" % (src, dst, exc[-1]) - + # If linking (hard or symbolic), use the appropriate system call # (Unix only, of course, but that's the caller's responsibility) elif link == 'hard': @@ -189,7 +189,7 @@ def move_file (src, dst, """ from os.path import exists, isfile, isdir, basename, dirname import errno - + if verbose: print "moving %s -> %s" % (src, dst) @@ -232,7 +232,7 @@ def move_file (src, dst, except os.error: pass raise DistutilsFileError, \ - ("couldn't move '%s' to '%s' by copy/delete: " + + ("couldn't move '%s' to '%s' by copy/delete: " + "delete '%s' failed: %s") % \ (src, dst, src, msg) diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py index 211b65f..f7222fd 100644 --- a/Lib/distutils/filelist.py +++ b/Lib/distutils/filelist.py @@ -7,7 +7,7 @@ and building lists of files. # created 2000/07/17, Rene Liebscher (as template.py) # most parts taken from commands/sdist.py # renamed 2000/07/29 (to filelist.py) and officially added to -# the Distutils source, Greg Ward +# the Distutils source, Greg Ward __revision__ = "$Id$" @@ -34,8 +34,8 @@ class FileList: filtering applied) """ - def __init__(self, - warn=None, + def __init__(self, + warn=None, debug_print=None): # use standard warning and debug functions if no other given self.warn = warn or self.__warn @@ -53,10 +53,10 @@ class FileList: # -- Fallback warning/debug functions ------------------------------ - + def __warn (self, msg): sys.stderr.write("warning: %s\n" % msg) - + def __debug_print (self, msg): """Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true. @@ -93,7 +93,7 @@ class FileList: # -- "File template" methods --------------------------------------- - + def _parse_template_line (self, line): words = string.split(line) action = words[0] @@ -129,9 +129,9 @@ class FileList: return (action, patterns, dir, dir_pattern) # _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 # is there, and return the relevant words. 'action' is always @@ -190,7 +190,7 @@ class FileList: self.warn(("no previously-included files matching '%s' " + "found under directory '%s'") % (pattern, dir)) - + elif action == 'graft': self.debug_print("graft " + dir_pattern) if not self.include_pattern(None, prefix=dir_pattern): @@ -251,7 +251,7 @@ class FileList: self.debug_print(" adding " + name) self.files.append(name) files_found = 1 - + return files_found # include_pattern () @@ -261,7 +261,7 @@ class FileList: anchor=1, prefix=None, is_regex=0): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for - 'include_pattern()', above. + 'include_pattern()', above. The list 'self.files' is modified in place. Return 1 if files are found. """ @@ -274,7 +274,7 @@ class FileList: self.debug_print(" removing " + self.files[i]) del self.files[i] files_found = 1 - + return files_found # exclude_pattern () @@ -354,14 +354,14 @@ def translate_pattern (pattern, anchor=1, prefix=None, is_regex=0): pattern_re = glob_to_re(pattern) else: pattern_re = '' - + if prefix is not None: prefix_re = (glob_to_re(prefix))[0:-1] # ditch trailing $ pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re) else: # no prefix -- respect anchor flag if anchor: pattern_re = "^" + pattern_re - + return re.compile(pattern_re) # translate_pattern () diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 0325b48..8a67dfc 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -50,8 +50,8 @@ if _can_read_reg: HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER HKEY_USERS = hkey_mod.HKEY_USERS - - + + def get_devstudio_versions (): """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'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" - + if not _can_read_reg: return [] @@ -149,7 +149,7 @@ def find_exe (exe, version_number): if os.path.isfile(fn): return fn - return exe # last desperate hope + return exe # last desperate hope def set_path_env_var (name, version_number): @@ -294,7 +294,7 @@ class MSVCCompiler (CCompiler) : compile_opts.extend (self.compile_options_debug) else: compile_opts.extend (self.compile_options) - + for i in range (len (sources)): src = sources[i] ; obj = objects[i] ext = (os.path.splitext (src))[1] @@ -390,12 +390,12 @@ class MSVCCompiler (CCompiler) : self.spawn ([self.lib] + lib_args) except DistutilsExecError, msg: raise LibError, msg - + else: self.announce ("skipping %s (up-to-date)" % output_filename) # create_static_lib () - + def link (self, target_desc, objects, @@ -417,7 +417,7 @@ class MSVCCompiler (CCompiler) : if runtime_library_dirs: self.warn ("I don't know what to do with 'runtime_library_dirs': " + str (runtime_library_dirs)) - + lib_opts = gen_lib_options (self, library_dirs, runtime_library_dirs, libraries) @@ -441,7 +441,7 @@ class MSVCCompiler (CCompiler) : for sym in (export_symbols or []): export_opts.append("/EXPORT:" + sym) - ld_args = (ldflags + lib_opts + export_opts + + ld_args = (ldflags + lib_opts + export_opts + objects + ['/OUT:' + output_filename]) # The MSVC linker generates .lib and .exp files, which cannot be diff --git a/Lib/distutils/mwerkscompiler.py b/Lib/distutils/mwerkscompiler.py index e759456..7c77b8b 100644 --- a/Lib/distutils/mwerkscompiler.py +++ b/Lib/distutils/mwerkscompiler.py @@ -52,8 +52,8 @@ class MWerksCompiler (CCompiler) : force=0): CCompiler.__init__ (self, verbose, dry_run, force) - - + + def compile (self, sources, output_dir=None, @@ -62,14 +62,14 @@ class MWerksCompiler (CCompiler) : debug=0, extra_preargs=None, extra_postargs=None): - (output_dir, macros, include_dirs) = \ - self._fix_compile_args (output_dir, macros, include_dirs) - self.__sources = sources - self.__macros = macros - self.__include_dirs = include_dirs - # Don't need extra_preargs and extra_postargs for CW - return [] - + (output_dir, macros, include_dirs) = \ + self._fix_compile_args (output_dir, macros, include_dirs) + self.__sources = sources + self.__macros = macros + self.__include_dirs = include_dirs + # Don't need extra_preargs and extra_postargs for CW + return [] + def link (self, target_desc, objects, @@ -198,7 +198,7 @@ class MWerksCompiler (CCompiler) : if self.verbose: print '\tBuild project' mkcwproject.buildproject(projectfilename) - + def _filename_to_abs(self, filename): # Some filenames seem to be unix-like. Convert to Mac names. ## if '/' in filename and ':' in filename: @@ -207,13 +207,11 @@ class MWerksCompiler (CCompiler) : ## filename = macurl2path(filename) filename = distutils.util.convert_path(filename) if not os.path.isabs(filename): - curdir = os.getcwd() - filename = os.path.join(curdir, filename) + curdir = os.getcwd() + filename = os.path.join(curdir, filename) # Finally remove .. components components = string.split(filename, ':') for i in range(1, len(components)): - if components[i] == '..': - components[i] = '' + if components[i] == '..': + components[i] = '' return string.join(components, ':') - - diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py index 1eed7a8..07dc814 100644 --- a/Lib/distutils/spawn.py +++ b/Lib/distutils/spawn.py @@ -71,7 +71,7 @@ def _spawn_nt (cmd, cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same - executable = find_executable(executable) or executable + executable = find_executable(executable) or executable if verbose: print string.join([executable] + cmd[1:], ' ') if not dry_run: @@ -87,7 +87,7 @@ def _spawn_nt (cmd, raise DistutilsExecError, \ "command '%s' failed with exit status %d" % (cmd[0], rc) - + def _spawn_posix (cmd, search_path=1, verbose=0, @@ -110,11 +110,11 @@ def _spawn_posix (cmd, sys.stderr.write("unable to execute %s: %s\n" % (cmd[0], e.strerror)) os._exit(1) - + sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) os._exit(1) - + else: # in the parent # Loop until the child either exits or is terminated by a signal # (ie. keep waiting if it's merely stopped) @@ -133,7 +133,7 @@ def _spawn_posix (cmd, raise DistutilsExecError, \ "command '%s' failed with exit status %d" % \ (cmd[0], exit_status) - + elif os.WIFSTOPPED(status): continue @@ -166,4 +166,4 @@ def find_executable(executable, path=None): else: return executable -# find_executable() +# find_executable() diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 935372c..feaf318 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -48,7 +48,7 @@ def get_python_inc(plat_specific=0, prefix=None): If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. - """ + """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": @@ -318,7 +318,7 @@ def _init_posix(): # the scripts are in another directory. if python_build: g['LDSHARED'] = g['BLDSHARED'] - + elif sys.version < '2.1': # The following two branches are for 1.5.2 compatibility. if sys.platform == 'aix4': # what about AIX 3.x ? @@ -337,7 +337,7 @@ def _init_posix(): python_lib = get_python_lib(standard_lib=1) linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) - + # 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" # command. (It's also needed for non-MS compilers on Windows, and @@ -345,7 +345,7 @@ def _init_posix(): # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) - + global _config_vars _config_vars = g diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index 37bffe6..7086b1a 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -86,7 +86,7 @@ class TextFile: if filename is None and file is None: 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 # or fallback to default_options @@ -113,7 +113,7 @@ class TextFile: # actually read from the file; it's only populated by an # 'unreadline()' operation self.linebuf = [] - + def open (self, filename): """Open a new file named 'filename'. This overrides both the @@ -213,7 +213,7 @@ class TextFile: # EOF; I think that's OK.) eol = (line[-1] == '\n') and '\n' or '' line = line[0:pos] + eol - + # If all that's left is whitespace, then skip line # *now*, before we try to join it to 'buildup_line' -- # that way constructs like @@ -226,7 +226,7 @@ class TextFile: else: # it's an escaped "#" line = string.replace (line, "\\#", "#") - + # did previous line end with a backslash? then accumulate if self.join_lines and buildup_line: @@ -256,7 +256,7 @@ class TextFile: self.current_line = self.current_line[1] + 1 else: self.current_line = self.current_line + 1 - + # strip whitespace however the client wants (leading and # trailing, or one or the other, or neither) @@ -351,7 +351,7 @@ line 3 \\ print expected_result print "** received:" print result - + filename = "test.txt" out_file = open (filename, "w") @@ -382,4 +382,3 @@ line 3 \\ test_input (6, "join lines with collapsing", in_file, result6) os.remove (filename) - diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index a4f0ac4..a9b5de5 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -103,8 +103,8 @@ class UnixCCompiler (CCompiler): pp_args.extend(extra_postargs) # 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 - # the source file is newer than the target (or the target doesn't + # 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 # exist). if self.force or output_file is None or newer(source, output_file): if output_file: @@ -139,7 +139,7 @@ class UnixCCompiler (CCompiler): extra_postargs = [] # Compile all source files that weren't eliminated by - # '_prep_compile()'. + # '_prep_compile()'. for i in range(len(sources)): src = sources[i] ; obj = objects[i] if skip_sources[src]: @@ -157,7 +157,7 @@ class UnixCCompiler (CCompiler): return objects # compile () - + def create_static_lib (self, objects, @@ -193,7 +193,7 @@ class UnixCCompiler (CCompiler): def link (self, - target_desc, + target_desc, objects, output_filename, output_dir=None, @@ -219,7 +219,7 @@ class UnixCCompiler (CCompiler): output_filename = os.path.join(output_dir, output_filename) if self._need_link(objects, output_filename): - ld_args = (objects + self.objects + + ld_args = (objects + self.objects + lib_opts + ['-o', output_filename]) if debug: ld_args[:0] = ['-g'] @@ -229,7 +229,7 @@ class UnixCCompiler (CCompiler): ld_args.extend(extra_postargs) self.mkpath(os.path.dirname(output_filename)) try: - if target_desc == CCompiler.EXECUTABLE: + if target_desc == CCompiler.EXECUTABLE: self.spawn(self.linker_exe + ld_args) else: self.spawn(self.linker_so + ld_args) @@ -244,7 +244,7 @@ class UnixCCompiler (CCompiler): # -- Miscellaneous methods ----------------------------------------- # These are all used by the 'gen_lib_options() function, in # ccompiler.py. - + def library_dir_option (self, dir): return "-L" + dir diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 25ddbdf..1541e02 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -30,7 +30,7 @@ def get_platform (): solaris-2.6-sun4u irix-5.3 irix64-6.2 - + For non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name != "posix" or not hasattr(os, 'uname'): @@ -44,9 +44,9 @@ def get_platform (): # Convert the OS name to lowercase and remove '/' characters # (to accommodate BSD/OS) - osname = string.lower(osname) + osname = string.lower(osname) osname = string.replace(osname, '/', '') - + if osname[:5] == "linux": # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. @@ -59,7 +59,7 @@ def get_platform (): # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) - elif osname[:3] == "aix": + elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": osname = "cygwin" @@ -67,7 +67,7 @@ def get_platform (): m = rel_re.match(release) if m: release = m.group() - + return "%s-%s-%s" % (osname, release, machine) # get_platform () @@ -280,7 +280,7 @@ def execute (func, args, msg=None, verbose=0, dry_run=0): # Generate a message if we weren't passed one if msg is None: msg = "%s%s" % (func.__name__, `args`) - if msg[-2:] == ',)': # correct for singleton tuple + if msg[-2:] == ',)': # correct for singleton tuple msg = msg[0:-2] + ')' # Print it if verbosity level is high enough @@ -403,7 +403,7 @@ byte_compile(files, optimize=%s, force=%s, spawn(cmd, verbose=verbose, dry_run=dry_run) execute(os.remove, (script_name,), "removing %s" % script_name, verbose=verbose, dry_run=dry_run) - + # "Direct" byte-compilation: use the py_compile module to compile # right here, right now. Note that the script generated in indirect # mode simply calls 'byte_compile()' in direct mode, a weird sort of @@ -453,5 +453,3 @@ def rfc822_escape (header): lines = map(string.strip, lines) header = string.join(lines, '\n' + 8*' ') return header - - diff --git a/Lib/distutils/version.py b/Lib/distutils/version.py index 9d3d172..02502da 100644 --- a/Lib/distutils/version.py +++ b/Lib/distutils/version.py @@ -98,7 +98,7 @@ class StrictVersion (Version): The rationale for this version numbering system will be explained in the distutils documentation. """ - + version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE) @@ -123,7 +123,7 @@ class StrictVersion (Version): def __str__ (self): - + if self.version[2] == 0: vstring = string.join(map(str, self.version[0:2]), '.') else: @@ -133,7 +133,7 @@ class StrictVersion (Version): vstring = vstring + self.prerelease[0] + str(self.prerelease[1]) return vstring - + def __cmp__ (self, other): if isinstance(other, StringType): @@ -170,7 +170,7 @@ class StrictVersion (Version): # 2) sequences of letters are part of the tuple for comparison and are # compared lexicographically # 3) recognize the numeric components may have leading zeroes -# +# # The LooseVersion class below implements these rules: a version number # string is split up into a tuple of integer and string components, and # comparison is a simple tuple comparison. This means that version @@ -185,7 +185,7 @@ class StrictVersion (Version): # - indicating a post-release patch ('p', 'pl', 'patch') # 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. -# +# # The problem is what to do with letters (and other non-numeric # characters) in a version number. The current implementation does the # obvious and predictable thing: keep them as strings and compare @@ -208,7 +208,7 @@ class StrictVersion (Version): # version numbering scheme to its domination. The free-thinking # anarchists in the lot will never give in, though, and something needs # to be done to accommodate them. -# +# # Perhaps a "moderately strict" version class could be implemented that # lets almost anything slide (syntactically), and makes some heuristic # assumptions about non-digits in version number strings. This could @@ -217,7 +217,7 @@ class StrictVersion (Version): # 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 # think I'm smart enough to do it right though. -# +# # In any case, I've coded the test suite for this module (see # ../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 @@ -296,6 +296,6 @@ class LooseVersion (Version): other = LooseVersion(other) return cmp(self.version, other.version) - + # end class LooseVersion |