diff options
author | cookedm <cookedm@localhost> | 2007-05-25 11:41:55 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2007-05-25 11:41:55 +0000 |
commit | f7b399a6f9a299d82dc9490bf81683b0d1693427 (patch) | |
tree | 5d4ab72107b13e6e0641d73f4cc8434b8b3f6083 /numpy/distutils/command/build_src.py | |
parent | 5267b3e16654ef326f525fdb9a1287a88396c616 (diff) | |
download | numpy-f7b399a6f9a299d82dc9490bf81683b0d1693427.tar.gz |
merge from distutils-revamp branch (step 3)
- minor command/build_src cleanup
Diffstat (limited to 'numpy/distutils/command/build_src.py')
-rw-r--r-- | numpy/distutils/command/build_src.py | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py index b487dc11c..926f92a1a 100644 --- a/numpy/distutils/command/build_src.py +++ b/numpy/distutils/command/build_src.py @@ -10,6 +10,15 @@ from distutils.dep_util import newer_group, newer from distutils.util import get_platform from distutils.errors import DistutilsError, DistutilsSetupError +try: + from Pyrex.Compiler import Main + have_pyrex = True +except ImportError: + have_pyrex = False + +# this import can't be done here, as it uses numpy stuff only available +# after it's installed +#import numpy.f2py from numpy.distutils import log from numpy.distutils.misc_util import fortran_ext_match, \ appendpath, is_string, is_sequence @@ -56,7 +65,6 @@ class build_src(build_ext.build_ext): self.swig_opts = None self.swig_cpp = None self.swig = None - return def finalize_options(self): self.set_undefined_options('build', @@ -95,7 +103,7 @@ class build_src(build_ext.build_ext): self.swig_opts = self.swigflags self.swigflags = None - if self.swig_opts is None: + if self.swig_opts is None: self.swig_opts = [] else: self.swig_opts = splitcmdline(self.swig_opts) @@ -115,20 +123,17 @@ class build_src(build_ext.build_ext): else: log.info('using "%s=%s" option from build_ext command' % (o,v)) setattr(self, c, v) - return def run(self): if not (self.extensions or self.libraries): return self.build_sources() - return - def build_sources(self): if self.inplace: - self.get_package_dir = self.get_finalized_command('build_py')\ - .get_package_dir + self.get_package_dir = \ + self.get_finalized_command('build_py').get_package_dir self.build_py_modules_sources() @@ -143,8 +148,6 @@ class build_src(build_ext.build_ext): self.build_data_files_sources() - return - def build_data_files_sources(self): if not self.data_files: return @@ -179,7 +182,6 @@ class build_src(build_ext.build_ext): else: raise TypeError(repr(data)) self.data_files[:] = new_data_files - return def build_py_modules_sources(self): if not self.py_modules: @@ -206,7 +208,6 @@ class build_src(build_ext.build_ext): else: new_py_modules.append(source) self.py_modules[:] = new_py_modules - return def build_library_sources(self, lib_name, build_info): sources = list(build_info.get('sources',[])) @@ -274,8 +275,6 @@ class build_src(build_ext.build_ext): ext.sources = sources - return - def generate_sources(self, sources, extension): new_sources = [] func_sources = [] @@ -370,12 +369,6 @@ class build_src(build_ext.build_ext): return new_sources def pyrex_sources(self, sources, extension): - have_pyrex = False - try: - import Pyrex - have_pyrex = True - except ImportError: - pass new_sources = [] ext_name = extension.name.split('.')[-1] for source in sources: @@ -485,8 +478,9 @@ class build_src(build_ext.build_ext): if (self.force or newer_group(depends, target_file,'newer')) \ and not skip_f2py: log.info("f2py: %s" % (source)) - import numpy.f2py as f2py2e - f2py2e.run_main(f2py_options + ['--build-dir',target_dir,source]) + import numpy.f2py + numpy.f2py.run_main(f2py_options + + ['--build-dir',target_dir,source]) else: log.debug(" skipping '%s' f2py interface (up-to-date)" % (source)) else: @@ -501,10 +495,10 @@ class build_src(build_ext.build_ext): depends = f_sources + extension.depends if (self.force or newer_group(depends, target_file, 'newer')) \ and not skip_f2py: - import numpy.f2py as f2py2e log.info("f2py:> %s" % (target_file)) self.mkpath(target_dir) - f2py2e.run_main(f2py_options + ['--lower', + import numpy.f2py + numpy.f2py.run_main(f2py_options + ['--lower', '--build-dir',target_dir]+\ ['-m',ext_name]+f_sources) else: @@ -524,8 +518,8 @@ class build_src(build_ext.build_ext): extension.include_dirs.append(self.build_src) if not skip_f2py: - import numpy.f2py as f2py2e - d = os.path.dirname(f2py2e.__file__) + import numpy.f2py + d = os.path.dirname(numpy.f2py.__file__) source_c = os.path.join(d,'src','fortranobject.c') source_h = os.path.join(d,'src','fortranobject.h') if newer(source_c,target_c) or newer(source_h,target_h): |