mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Whitespace normalization.
This commit is contained in:
		
							parent
							
								
									bcd8975740
								
							
						
					
					
						commit
						b94b849d65
					
				
					 21 changed files with 210 additions and 216 deletions
				
			
		|  | @ -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): | ||||||
|             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, | ||||||
| 
 | 
 | ||||||
|     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 @@ def compile (self, | ||||||
|             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 @@ def compile (self, | ||||||
|                     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 @@ def create_static_lib (self, | ||||||
|             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 @@ def link (self, | ||||||
|                     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 @@ def link (self, | ||||||
| 
 | 
 | ||||||
|             # 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 @@ def link (self, | ||||||
|             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: | ||||||
|     #     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 @@ def set_executable(self, key, value): | ||||||
|             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 @@ def _fix_compile_args (self, output_dir, macros, include_dirs): | ||||||
|         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 @@ def _prep_compile (self, sources, output_dir): | ||||||
|         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 @@ def _fix_object_args (self, objects, output_dir): | ||||||
|             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 @@ def create_static_lib (self, | ||||||
|         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 @@ def link (self, | ||||||
|         """ |         """ | ||||||
|         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 @@ def link_shared_lib (self, | ||||||
|                          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 @@ def link_executable (self, | ||||||
|                          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 @@ def mkpath (self, name, mode=0777): | ||||||
|     # 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(): | ||||||
|     # 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(): | ||||||
|     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, | ||||||
|     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: | ||||||
|     # 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 @@ def ensure_finalized (self): | ||||||
|         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 @@ def initialize_options (self): | ||||||
|         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 @@ def debug_print (self, msg): | ||||||
|         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 @@ def ensure_string_list (self, option): | ||||||
|                 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 @@ def copy_tree (self, infile, outfile, | ||||||
|         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 @@ def make_file (self, infiles, outfile, func, args, | ||||||
|                        (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): | ||||||
|     """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 @@ class found in 'cmdclass' is used in place of the default, which is | ||||||
|     # 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 @@ class found in 'cmdclass' is used in place of the default, which is | ||||||
|                 raise |                 raise | ||||||
|             else: |             else: | ||||||
|                 raise SystemExit, error |                 raise SystemExit, error | ||||||
|              | 
 | ||||||
|         except (DistutilsExecError, |         except (DistutilsExecError, | ||||||
|                 DistutilsFileError, |                 DistutilsFileError, | ||||||
|                 DistutilsOptionError, |                 DistutilsOptionError, | ||||||
|  |  | ||||||
|  | @ -18,28 +18,28 @@ | ||||||
| # | # | ||||||
| #   see also http://starship.python.net/crew/kernr/mingw32/Notes.html | #   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 | #   --export-all-symbols because it doesn't worked reliable in some | ||||||
| #   tested configurations. And because other windows compilers also | #   tested configurations. And because other windows compilers also | ||||||
| #   need their symbols specified this no serious problem. | #   need their symbols specified this no serious problem. | ||||||
| # | # | ||||||
| # tested configurations: | # 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) | #   (after patching python's config.h and for C++ some other include files) | ||||||
| #   see also http://starship.python.net/crew/kernr/mingw32/Notes.html | #   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  | # * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works | ||||||
| #   (ld doesn't support -shared, so we use dllwrap)    | #   (ld doesn't support -shared, so we use dllwrap) | ||||||
| # * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now | # * 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 | #   - 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 | #     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 tries to link against dlls instead their import libraries. (If | ||||||
| #     it finds the dll first.) | #     it finds the dll first.) | ||||||
| #     By specifying -static we force ld to link against the import libraries,  | #     By specifying -static we force ld to link against the import libraries, | ||||||
| #     this is windows standard and there are normally not the necessary symbols  | #     this is windows standard and there are normally not the necessary symbols | ||||||
| #     in the dlls. | #     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 | # created 2000/05/05, Rene Liebscher | ||||||
| 
 | 
 | ||||||
|  | @ -60,7 +60,7 @@ class CygwinCCompiler (UnixCCompiler): | ||||||
|     static_lib_format = "lib%s%s" |     static_lib_format = "lib%s%s" | ||||||
|     shared_lib_format = "%s%s" |     shared_lib_format = "%s%s" | ||||||
|     exe_extension = ".exe" |     exe_extension = ".exe" | ||||||
|     | 
 | ||||||
|     def __init__ (self, |     def __init__ (self, | ||||||
|                   verbose=0, |                   verbose=0, | ||||||
|                   dry_run=0, |                   dry_run=0, | ||||||
|  | @ -76,20 +76,20 @@ def __init__ (self, | ||||||
|                 "Python's pyconfig.h doesn't seem to support your compiler.  " + |                 "Python's pyconfig.h doesn't seem to support your compiler.  " + | ||||||
|                 ("Reason: %s." % details) + |                 ("Reason: %s." % details) + | ||||||
|                 "Compiling may fail because of undefined preprocessor macros.") |                 "Compiling may fail because of undefined preprocessor macros.") | ||||||
|          | 
 | ||||||
|         (self.gcc_version, self.ld_version, self.dllwrap_version) = \ |         (self.gcc_version, self.ld_version, self.dllwrap_version) = \ | ||||||
|             get_versions() |             get_versions() | ||||||
|         self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % |         self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % | ||||||
|                          (self.gcc_version,  |                          (self.gcc_version, | ||||||
|                           self.ld_version,  |                           self.ld_version, | ||||||
|                           self.dllwrap_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 |         # 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 ) |         # same as the rest of binutils ( also ld ) | ||||||
|         # dllwrap 2.10.90 is buggy |         # dllwrap 2.10.90 is buggy | ||||||
|         if self.ld_version >= "2.10.90":  |         if self.ld_version >= "2.10.90": | ||||||
|             self.linker_dll = "gcc" |             self.linker_dll = "gcc" | ||||||
|         else: |         else: | ||||||
|             self.linker_dll = "dllwrap" |             self.linker_dll = "dllwrap" | ||||||
|  | @ -102,22 +102,22 @@ def __init__ (self, | ||||||
|                              linker_so=('%s -mcygwin -mdll -static' % |                              linker_so=('%s -mcygwin -mdll -static' % | ||||||
|                                         self.linker_dll)) |                                         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": |         if self.gcc_version == "2.91.57": | ||||||
|             # cygwin shouldn't need msvcrt, but without the dlls will crash |             # cygwin shouldn't need msvcrt, but without the dlls will crash | ||||||
|             # (gcc version 2.91.57) -- perhaps something about initialization |             # (gcc version 2.91.57) -- perhaps something about initialization | ||||||
|             self.dll_libraries=["msvcrt"] |             self.dll_libraries=["msvcrt"] | ||||||
|             self.warn(  |             self.warn( | ||||||
|                 "Consider upgrading to a newer version of gcc") |                 "Consider upgrading to a newer version of gcc") | ||||||
|         else: |         else: | ||||||
|             self.dll_libraries=[] |             self.dll_libraries=[] | ||||||
|          | 
 | ||||||
|     # __init__ () |     # __init__ () | ||||||
| 
 | 
 | ||||||
|     # not much different of the compile method in UnixCCompiler, |     # not much different of the compile method in UnixCCompiler, | ||||||
|     # but we have to insert some lines in the middle of it, so |     # but we have to insert some lines in the middle of it, so | ||||||
|     # we put here a adapted version of it. |     # 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.) |     # initializations a second time, this is why all is done here.) | ||||||
|     def compile (self, |     def compile (self, | ||||||
|                  sources, |                  sources, | ||||||
|  | @ -143,7 +143,7 @@ def compile (self, | ||||||
|             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] | ||||||
|             ext = (os.path.splitext (src))[1] |             ext = (os.path.splitext (src))[1] | ||||||
|  | @ -157,7 +157,7 @@ def compile (self, | ||||||
|                         self.spawn (["windres","-i",src,"-o",obj]) |                         self.spawn (["windres","-i",src,"-o",obj]) | ||||||
|                     except DistutilsExecError, msg: |                     except DistutilsExecError, msg: | ||||||
|                         raise CompileError, msg |                         raise CompileError, msg | ||||||
|                 else: # for other files use the C-compiler  |                 else: # for other files use the C-compiler | ||||||
|                     try: |                     try: | ||||||
|                         self.spawn (self.compiler_so + cc_args + |                         self.spawn (self.compiler_so + cc_args + | ||||||
|                                 [src, '-o', obj] + |                                 [src, '-o', obj] + | ||||||
|  | @ -184,12 +184,12 @@ def link (self, | ||||||
|               extra_preargs=None, |               extra_preargs=None, | ||||||
|               extra_postargs=None, |               extra_postargs=None, | ||||||
|               build_temp=None): |               build_temp=None): | ||||||
|          | 
 | ||||||
|         # use separate copies, so we can modify the lists |         # use separate copies, so we can modify the lists | ||||||
|         extra_preargs = copy.copy(extra_preargs or []) |         extra_preargs = copy.copy(extra_preargs or []) | ||||||
|         libraries = copy.copy(libraries or []) |         libraries = copy.copy(libraries or []) | ||||||
|         objects = copy.copy(objects or []) |         objects = copy.copy(objects or []) | ||||||
|                  | 
 | ||||||
|         # Additional libraries |         # Additional libraries | ||||||
|         libraries.extend(self.dll_libraries) |         libraries.extend(self.dll_libraries) | ||||||
| 
 | 
 | ||||||
|  | @ -199,10 +199,10 @@ def link (self, | ||||||
|             (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): |             (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): | ||||||
|             # (The linker doesn't do anything if output is up-to-date. |             # (The linker doesn't do anything if output is up-to-date. | ||||||
|             # So it would probably better to check if we really need this, |             # So it would probably better to check if we really need this, | ||||||
|             # but for this we had to insert some unchanged parts of  |             # but for this we had to insert some unchanged parts of | ||||||
|             # UnixCCompiler, and this is not what we want.)  |             # 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 |             # object files are, build_temp doesn't help much | ||||||
|             # where are the object files |             # where are the object files | ||||||
|             temp_dir = os.path.dirname(objects[0]) |             temp_dir = os.path.dirname(objects[0]) | ||||||
|  | @ -214,7 +214,7 @@ def link (self, | ||||||
|             def_file = os.path.join(temp_dir, dll_name + ".def") |             def_file = os.path.join(temp_dir, dll_name + ".def") | ||||||
|             exp_file = os.path.join(temp_dir, dll_name + ".exp") |             exp_file = os.path.join(temp_dir, dll_name + ".exp") | ||||||
|             lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") |             lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") | ||||||
|         | 
 | ||||||
|             # Generate .def file |             # Generate .def file | ||||||
|             contents = [ |             contents = [ | ||||||
|                 "LIBRARY %s" % os.path.basename(output_filename), |                 "LIBRARY %s" % os.path.basename(output_filename), | ||||||
|  | @ -237,21 +237,21 @@ def link (self, | ||||||
|             else: |             else: | ||||||
|                 # doesn't work: bfd_close build\...\libfoo.a: Invalid operation |                 # doesn't work: bfd_close build\...\libfoo.a: Invalid operation | ||||||
|                 #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) |                 #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) |                 objects.append(def_file) | ||||||
| 
 | 
 | ||||||
|         #end: if ((export_symbols is not None) and |         #end: if ((export_symbols is not None) and | ||||||
|         #        (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): |         #        (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): | ||||||
|                                                   | 
 | ||||||
|         # who wants symbols and a many times larger output file |         # 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 |         # 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 |         #   unstripped_file = stripped_file + XXX KB | ||||||
|         #  ( XXX=254 for a typical python extension))  |         #  ( XXX=254 for a typical python extension)) | ||||||
|         if not debug:  |         if not debug: | ||||||
|             extra_preargs.append("-s")  |             extra_preargs.append("-s") | ||||||
|          | 
 | ||||||
|         UnixCCompiler.link(self, |         UnixCCompiler.link(self, | ||||||
|                            target_desc, |                            target_desc, | ||||||
|                            objects, |                            objects, | ||||||
|  | @ -265,7 +265,7 @@ def link (self, | ||||||
|                            extra_preargs, |                            extra_preargs, | ||||||
|                            extra_postargs, |                            extra_postargs, | ||||||
|                            build_temp) |                            build_temp) | ||||||
|          | 
 | ||||||
|     # link () |     # link () | ||||||
| 
 | 
 | ||||||
|     # -- Miscellaneous methods ----------------------------------------- |     # -- Miscellaneous methods ----------------------------------------- | ||||||
|  | @ -288,7 +288,7 @@ def object_filenames (self, | ||||||
|                 base = os.path.basename (base) |                 base = os.path.basename (base) | ||||||
|             if ext == '.res' or ext == '.rc': |             if ext == '.res' or ext == '.rc': | ||||||
|                 # these need to be compiled to object files |                 # 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)) |                                             base + ext + self.obj_extension)) | ||||||
|             else: |             else: | ||||||
|                 obj_names.append (os.path.join (output_dir, |                 obj_names.append (os.path.join (output_dir, | ||||||
|  | @ -311,7 +311,7 @@ def __init__ (self, | ||||||
|                   force=0): |                   force=0): | ||||||
| 
 | 
 | ||||||
|         CygwinCCompiler.__init__ (self, verbose, dry_run, force) |         CygwinCCompiler.__init__ (self, verbose, dry_run, force) | ||||||
|          | 
 | ||||||
|         # A real mingw32 doesn't need to specify a different entry point, |         # A real mingw32 doesn't need to specify a different entry point, | ||||||
|         # but cygwin 2.91.57 in no-cygwin-mode needs it. |         # but cygwin 2.91.57 in no-cygwin-mode needs it. | ||||||
|         if self.gcc_version <= "2.91.57": |         if self.gcc_version <= "2.91.57": | ||||||
|  | @ -322,15 +322,15 @@ def __init__ (self, | ||||||
|         self.set_executables(compiler='gcc -mno-cygwin -O -Wall', |         self.set_executables(compiler='gcc -mno-cygwin -O -Wall', | ||||||
|                              compiler_so='gcc -mno-cygwin -mdll -O -Wall', |                              compiler_so='gcc -mno-cygwin -mdll -O -Wall', | ||||||
|                              linker_exe='gcc -mno-cygwin', |                              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)) |                                         % (self.linker_dll, entry_point)) | ||||||
|         # Maybe we should also append -mthreads, but then the finished |         # Maybe we should also append -mthreads, but then the finished | ||||||
|         # dlls need another dll (mingwm10.dll see Mingw32 docs) |         # dlls need another dll (mingwm10.dll see Mingw32 docs) | ||||||
|         # (-mthreads: Support thread-safe exception handling on `Mingw32')        |         # (-mthreads: Support thread-safe exception handling on `Mingw32') | ||||||
|          | 
 | ||||||
|         # no additional libraries needed  |         # no additional libraries needed | ||||||
|         self.dll_libraries=[] |         self.dll_libraries=[] | ||||||
|          | 
 | ||||||
|     # __init__ () |     # __init__ () | ||||||
| 
 | 
 | ||||||
| # class Mingw32CCompiler | # class Mingw32CCompiler | ||||||
|  | @ -370,15 +370,15 @@ def check_config_h(): | ||||||
|     # GCC, and the pyconfig.h file should be OK |     # GCC, and the pyconfig.h file should be OK | ||||||
|     if string.find(sys.version,"GCC") >= 0: |     if string.find(sys.version,"GCC") >= 0: | ||||||
|         return (CONFIG_H_OK, "sys.version mentions 'GCC'") |         return (CONFIG_H_OK, "sys.version mentions 'GCC'") | ||||||
|      | 
 | ||||||
|     fn = sysconfig.get_config_h_filename() |     fn = sysconfig.get_config_h_filename() | ||||||
|     try: |     try: | ||||||
|         # It would probably better to read single lines to search. |         # 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) |         f = open(fn) | ||||||
|         s = f.read() |         s = f.read() | ||||||
|         f.close() |         f.close() | ||||||
|          | 
 | ||||||
|     except IOError, exc: |     except IOError, exc: | ||||||
|         # if we can't read this file, we cannot say it is wrong |         # if we can't read this file, we cannot say it is wrong | ||||||
|         # the compiler will complain later about this file as missing |         # the compiler will complain later about this file as missing | ||||||
|  | @ -401,7 +401,7 @@ def get_versions(): | ||||||
|     from distutils.version import StrictVersion |     from distutils.version import StrictVersion | ||||||
|     from distutils.spawn import find_executable |     from distutils.spawn import find_executable | ||||||
|     import re |     import re | ||||||
|          | 
 | ||||||
|     gcc_exe = find_executable('gcc') |     gcc_exe = find_executable('gcc') | ||||||
|     if gcc_exe: |     if gcc_exe: | ||||||
|         out = os.popen(gcc_exe + ' -dumpversion','r') |         out = os.popen(gcc_exe + ' -dumpversion','r') | ||||||
|  | @ -439,4 +439,3 @@ def get_versions(): | ||||||
|     else: |     else: | ||||||
|         dllwrap_version = None |         dllwrap_version = None | ||||||
|     return (gcc_version, ld_version, dllwrap_version) |     return (gcc_version, ld_version, dllwrap_version) | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -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'): | ||||||
|     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): | ||||||
| 
 | 
 | ||||||
|     (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, | ||||||
| 
 | 
 | ||||||
|     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, | ||||||
|             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: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     # -- 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 @@ def __init__ (self, attrs=None): | ||||||
|                           "invalid distribution option '%s'" % key |                           "invalid distribution option '%s'" % key | ||||||
| 
 | 
 | ||||||
|         self.finalize_options() |         self.finalize_options() | ||||||
|          | 
 | ||||||
|     # __init__ () |     # __init__ () | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -251,7 +251,7 @@ def dump_option_dicts (self, header=None, commands=None, indent=""): | ||||||
|                     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 @@ def parse_command_line (self): | ||||||
|             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 @@ def parse_command_line (self): | ||||||
|         # 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 @@ def _parse_command_opts (self, parser, args): | ||||||
|                             "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 @@ def _set_command_options (self, command_obj, option_dict=None): | ||||||
|         (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 @@ def reinitialize_command (self, command, reinit_subcommands=0): | ||||||
|         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 @@ def reinitialize_command (self, command, reinit_subcommands=0): | ||||||
| 
 | 
 | ||||||
|         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 @@ def __init__ (self): | ||||||
|         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 @@ def write_pkg_info (self, base_dir): | ||||||
|             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 @@ def get_url(self): | ||||||
|     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 @@ | ||||||
| # 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): | ||||||
|         #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 @@ def __init__ (self, option_table=None): | ||||||
|         # '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 @@ def __init__ (self, option_table=None): | ||||||
|         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 @@ def has_option (self, long_option): | ||||||
|         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 @@ def _check_alias_dict (self, aliases, what): | ||||||
|                 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): | ||||||
|     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 @@ def __init__ (self, options=[]): | ||||||
|             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): | ||||||
|         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): | ||||||
|             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, | ||||||
|             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, | ||||||
|         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, | ||||||
|     """ |     """ | ||||||
|     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, | ||||||
|             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 @@ | ||||||
| # 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: | ||||||
|         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 @@ def findall (self, dir=os.curdir): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     # -- 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 @@ def remove_duplicates (self): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     # -- "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 @@ def _parse_template_line (self, line): | ||||||
|         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 @@ def process_template_line (self, line): | ||||||
|                     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 @@ def include_pattern (self, pattern, | ||||||
|                 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 @@ def exclude_pattern (self, pattern, | ||||||
|                          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 @@ def exclude_pattern (self, pattern, | ||||||
|                 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): | ||||||
|         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 @@ | ||||||
|     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'): | ||||||
|     """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): | ||||||
|         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 @@ def compile (self, | ||||||
|             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 @@ def create_static_lib (self, | ||||||
|                 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 @@ def link (self, | ||||||
|         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 @@ def link (self, | ||||||
|             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 @@ def __init__ (self, | ||||||
|                   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 @@ def compile (self, | ||||||
|                  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 @@ def link (self, | ||||||
|         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 @@ def _filename_to_abs(self, filename): | ||||||
| ##           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, | ||||||
|     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, | ||||||
|             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, | ||||||
|             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, | ||||||
|                     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): | ||||||
|     else: |     else: | ||||||
|         return executable |         return executable | ||||||
| 
 | 
 | ||||||
| # find_executable()     | # find_executable() | ||||||
|  |  | ||||||
|  | @ -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(): | ||||||
|     # 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(): | ||||||
|             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(): | ||||||
|             # 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 @@ def __init__ (self, filename=None, file=None, **options): | ||||||
| 
 | 
 | ||||||
|         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 @@ def __init__ (self, filename=None, file=None, **options): | ||||||
|         # 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 @@ def readline (self): | ||||||
|                     # 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 @@ def readline (self): | ||||||
| 
 | 
 | ||||||
|                 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 @@ def readline (self): | ||||||
|                     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 @@ def test_input (count, description, file, expected_result): | ||||||
|             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 @@ def test_input (count, description, file, expected_result): | ||||||
|     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 @@ def preprocess (self, | ||||||
|             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 @@ def compile (self, | ||||||
|             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 @@ def compile (self, | ||||||
|         return objects |         return objects | ||||||
| 
 | 
 | ||||||
|     # compile () |     # compile () | ||||||
|      | 
 | ||||||
| 
 | 
 | ||||||
|     def create_static_lib (self, |     def create_static_lib (self, | ||||||
|                            objects, |                            objects, | ||||||
|  | @ -193,7 +193,7 @@ def create_static_lib (self, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     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 @@ def link (self, | ||||||
|             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 @@ def link (self, | ||||||
|                 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 @@ def link (self, | ||||||
|     # -- 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 (): | ||||||
|        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 (): | ||||||
| 
 | 
 | ||||||
|     # 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 (): | ||||||
|         # 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 (): | ||||||
|         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): | ||||||
|     # 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 @@ def byte_compile (py_files, | ||||||
|         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): | ||||||
|     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): | ||||||
|     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 @@ def parse (self, vstring): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     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 @@ def __str__ (self): | ||||||
|             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 @@ def __cmp__ (self, other): | ||||||
| # 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 @@ def __cmp__ (self, other): | ||||||
| #   - 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 @@ def __cmp__ (self, other): | ||||||
| # 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 @@ def __cmp__ (self, other): | ||||||
| # 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 @@ def __cmp__ (self, other): | ||||||
|             other = LooseVersion(other) |             other = LooseVersion(other) | ||||||
| 
 | 
 | ||||||
|         return cmp(self.version, other.version) |         return cmp(self.version, other.version) | ||||||
|          | 
 | ||||||
| 
 | 
 | ||||||
| # end class LooseVersion | # end class LooseVersion | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake