diff options
author | Greg Ward <gward@python.net> | 2000-09-30 18:27:54 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-09-30 18:27:54 (GMT) |
commit | cb1f4c4d33711a964dcd40b32a562e2acf745fc2 (patch) | |
tree | 3e8bd80543d1b5e6c843087678194fa1608d13e6 /Lib/distutils/command/build_ext.py | |
parent | 963cd2d85d26467f60a3c03b5025fddfff0cd80c (diff) | |
download | cpython-cb1f4c4d33711a964dcd40b32a562e2acf745fc2.zip cpython-cb1f4c4d33711a964dcd40b32a562e2acf745fc2.tar.gz cpython-cb1f4c4d33711a964dcd40b32a562e2acf745fc2.tar.bz2 |
Standardized whitespace around function calls.
Diffstat (limited to 'Lib/distutils/command/build_ext.py')
-rw-r--r-- | Lib/distutils/command/build_ext.py | 127 |
1 files changed, 63 insertions, 64 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 9147c3d..70e8a73 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -112,12 +112,12 @@ class build_ext (Command): def finalize_options (self): from distutils import sysconfig - self.set_undefined_options ('build', - ('build_lib', 'build_lib'), - ('build_temp', 'build_temp'), - ('compiler', 'compiler'), - ('debug', 'debug'), - ('force', 'force')) + self.set_undefined_options('build', + ('build_lib', 'build_lib'), + ('build_temp', 'build_temp'), + ('compiler', 'compiler'), + ('debug', 'debug'), + ('force', 'force')) if self.package is None: self.package = self.distribution.ext_package @@ -131,17 +131,16 @@ class build_ext (Command): plat_py_include = sysconfig.get_python_inc(plat_specific=1) if self.include_dirs is None: self.include_dirs = self.distribution.include_dirs or [] - if type (self.include_dirs) is StringType: - self.include_dirs = string.split (self.include_dirs, - os.pathsep) + if type(self.include_dirs) is StringType: + self.include_dirs = string.split(self.include_dirs, os.pathsep) # Put the Python "system" include dir at the end, so that # any local include dirs take precedence. - self.include_dirs.append (py_include) + self.include_dirs.append(py_include) if plat_py_include != py_include: - self.include_dirs.append (plat_py_include) + self.include_dirs.append(plat_py_include) - if type (self.libraries) is StringType: + if type(self.libraries) is StringType: self.libraries = [self.libraries] # Life is easier if we're not forever checking for None, so @@ -157,11 +156,11 @@ class build_ext (Command): # for Release and Debug builds. # also Python's library directory must be appended to library_dirs if os.name == 'nt': - self.library_dirs.append (os.path.join(sys.exec_prefix, 'libs')) + self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) if self.debug: - self.build_temp = os.path.join (self.build_temp, "Debug") + self.build_temp = os.path.join(self.build_temp, "Debug") else: - self.build_temp = os.path.join (self.build_temp, "Release") + self.build_temp = os.path.join(self.build_temp, "Release") # finalize_options () @@ -188,16 +187,16 @@ class build_ext (Command): # directory where we put them is in the library search path for # linking extensions. if self.distribution.has_c_libraries(): - build_clib = self.get_finalized_command ('build_clib') - self.libraries.extend (build_clib.get_library_names() or []) - self.library_dirs.append (build_clib.build_clib) + build_clib = self.get_finalized_command('build_clib') + self.libraries.extend(build_clib.get_library_names() or []) + self.library_dirs.append(build_clib.build_clib) # Setup the CCompiler object that we'll use to do all the # compiling and linking - self.compiler = new_compiler (compiler=self.compiler, - verbose=self.verbose, - dry_run=self.dry_run, - force=self.force) + self.compiler = new_compiler(compiler=self.compiler, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force) customize_compiler(self.compiler) # And make sure that any compile/link-related options (which might @@ -205,25 +204,25 @@ class build_ext (Command): # that CCompiler object -- that way, they automatically apply to # all compiling and linking done here. if self.include_dirs is not None: - self.compiler.set_include_dirs (self.include_dirs) + self.compiler.set_include_dirs(self.include_dirs) if self.define is not None: # 'define' option is a list of (name,value) tuples for (name,value) in self.define: - self.compiler.define_macro (name, value) + self.compiler.define_macro(name, value) if self.undef is not None: for macro in self.undef: - self.compiler.undefine_macro (macro) + self.compiler.undefine_macro(macro) if self.libraries is not None: - self.compiler.set_libraries (self.libraries) + self.compiler.set_libraries(self.libraries) if self.library_dirs is not None: - self.compiler.set_library_dirs (self.library_dirs) + self.compiler.set_library_dirs(self.library_dirs) if self.rpath is not None: - self.compiler.set_runtime_library_dirs (self.rpath) + self.compiler.set_runtime_library_dirs(self.rpath) if self.link_objects is not None: - self.compiler.set_link_objects (self.link_objects) + self.compiler.set_link_objects(self.link_objects) # Now actually compile and link everything. - self.build_extensions () + self.build_extensions() # run () @@ -320,7 +319,7 @@ class build_ext (Command): # Wouldn't it be neat if we knew the names of header files too... for ext in self.extensions: - filenames.extend (ext.sources) + filenames.extend(ext.sources) return filenames @@ -330,16 +329,16 @@ class build_ext (Command): # Sanity check the 'extensions' list -- can't assume this is being # done in the same run as a 'build_extensions()' call (in fact, we # can probably assume that it *isn't*!). - self.check_extensions_list (self.extensions) + self.check_extensions_list(self.extensions) # And build the list of output (built) filenames. Note that this # ignores the 'inplace' flag, and assumes everything goes in the # "build" tree. outputs = [] for ext in self.extensions: - fullname = self.get_ext_fullname (ext.name) - outputs.append (os.path.join (self.build_lib, - self.get_ext_filename(fullname))) + fullname = self.get_ext_fullname(ext.name) + outputs.append(os.path.join(self.build_lib, + self.get_ext_filename(fullname))) return outputs # get_outputs () @@ -348,40 +347,40 @@ class build_ext (Command): def build_extensions (self): # First, sanity-check the 'extensions' list - self.check_extensions_list (self.extensions) + self.check_extensions_list(self.extensions) for ext in self.extensions: sources = ext.sources - if sources is None or type (sources) not in (ListType, TupleType): + if sources is None or type(sources) not in (ListType, TupleType): raise DistutilsSetupError, \ ("in 'ext_modules' option (extension '%s'), " + "'sources' must be present and must be " + "a list of source filenames") % ext.name - sources = list (sources) + sources = list(sources) - fullname = self.get_ext_fullname (ext.name) + fullname = self.get_ext_fullname(ext.name) if self.inplace: # ignore build-lib -- put the compiled extension into # the source tree along with pure Python modules - modpath = string.split (fullname, '.') - package = string.join (modpath[0:-1], '.') + modpath = string.split(fullname, '.') + package = string.join(modpath[0:-1], '.') base = modpath[-1] - build_py = self.get_finalized_command ('build_py') - package_dir = build_py.get_package_dir (package) - ext_filename = os.path.join (package_dir, - self.get_ext_filename(base)) + build_py = self.get_finalized_command('build_py') + package_dir = build_py.get_package_dir(package) + ext_filename = os.path.join(package_dir, + self.get_ext_filename(base)) else: - ext_filename = os.path.join (self.build_lib, - self.get_ext_filename(fullname)) + ext_filename = os.path.join(self.build_lib, + self.get_ext_filename(fullname)) if not (self.force or newer_group(sources, ext_filename, 'newer')): - self.announce ("skipping '%s' extension (up-to-date)" % - ext.name) + self.announce("skipping '%s' extension (up-to-date)" % + ext.name) continue # 'for' loop over all extensions else: - self.announce ("building '%s' extension" % ext.name) + self.announce("building '%s' extension" % ext.name) # First, scan the sources for SWIG definition files (.i), run # SWIG on 'em to create .c files, and modify the sources list @@ -416,22 +415,22 @@ class build_ext (Command): if os.environ.has_key('CFLAGS'): extra_args.extend(string.split(os.environ['CFLAGS'])) - objects = self.compiler.compile (sources, - output_dir=self.build_temp, - macros=macros, - include_dirs=ext.include_dirs, - debug=self.debug, - extra_postargs=extra_args) + objects = self.compiler.compile(sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=ext.include_dirs, + debug=self.debug, + extra_postargs=extra_args) # Now link the object files together into a "shared object" -- # of course, first we have to figure out all the other things # that go into the mix. if ext.extra_objects: - objects.extend (ext.extra_objects) + objects.extend(ext.extra_objects) extra_args = ext.extra_link_args or [] - self.compiler.link_shared_object ( + self.compiler.link_shared_object( objects, ext_filename, libraries=self.get_libraries(ext), library_dirs=ext.library_dirs, @@ -481,11 +480,11 @@ class build_ext (Command): swig = self.find_swig() swig_cmd = [swig, "-python", "-dnone", "-ISWIG"] if self.swig_cpp: - swig_cmd.append ("-c++") + swig_cmd.append("-c++") for source in swig_sources: target = swig_targets[source] - self.announce ("swigging %s to %s" % (source, target)) + self.announce("swigging %s to %s" % (source, target)) self.spawn(swig_cmd + ["-o", target, source]) return new_sources @@ -507,7 +506,7 @@ class build_ext (Command): # if not, act like Unix and assume it's in the PATH. for vers in ("1.3", "1.2", "1.1"): fn = os.path.join("c:\\swig%s" % vers, "swig.exe") - if os.path.isfile (fn): + if os.path.isfile(fn): return fn else: return "swig.exe" @@ -535,12 +534,12 @@ class build_ext (Command): """ from distutils.sysconfig import get_config_var - ext_path = string.split (ext_name, '.') + ext_path = string.split(ext_name, '.') # extensions in debug_mode are named 'module_d.pyd' under windows so_ext = get_config_var('SO') if os.name == 'nt' and self.debug: - return apply (os.path.join, ext_path) + '_d' + so_ext - return apply (os.path.join, ext_path) + so_ext + return apply(os.path.join, ext_path) + '_d' + so_ext + return apply(os.path.join, ext_path) + so_ext def get_export_symbols (self, ext): """Return the list of symbols that a shared extension has to |