diff options
author | David Cournapeau <cournape@gmail.com> | 2008-01-06 10:33:00 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-01-06 10:33:00 +0000 |
commit | 8a93d38f5743fb5005b88e803a19c24a13e325b3 (patch) | |
tree | 0f2748ad446ecb0e5ee3b14314dbefe30d699d5f /numpy/distutils/misc_util.py | |
parent | f9dbe2870e4d7ed425bbeb59a831b0626bdcf29e (diff) | |
download | numpy-8a93d38f5743fb5005b88e803a19c24a13e325b3.tar.gz |
Add the infrastructure to add SConstruct files in
numpy.distutils.Configuration.
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r-- | numpy/distutils/misc_util.py | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 9777d14b2..3d827d94e 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -574,7 +574,7 @@ def get_frame(level=0): class Configuration(object): _list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs', - 'libraries', 'headers', 'scripts', 'py_modules'] + 'libraries', 'headers', 'scripts', 'py_modules', 'scons_data'] _dict_keys = ['package_dir'] _extra_keys = ['name', 'version'] @@ -1165,6 +1165,50 @@ class Configuration(object): self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a library '+ name) + def add_sconscript(self, sconscript, subpackage_path=None, + standalone = False, pre_hook = None, + post_hook = None, source_files = None): + """Add a sconscript to configuration. + + pre_hook and post hook should be sequences of callable, which will be + use before and after executing scons. """ + if standalone: + parent_name = None + else: + parent_name = self.name + + dist = self.get_distribution() + # Convert the sconscript name to a relative filename (relative from top + # setup.py's directory) + fullsconsname = self.paths(sconscript)[0] + + # XXX: Think about a way to automatically register source files from + # scons... + full_source_files = [] + if source_files: + full_source_files.extend([self.paths(i)[0] for i in source_files]) + + if dist is not None: + dist.scons_data.append((fullsconsname, + pre_hook, + post_hook, + full_source_files, + parent_name)) + self.warn('distutils distribution has been initialized,'\ + ' it may be too late to add a subpackage '+ subpackage_name) + # XXX: we add a fake extension, to correctly initialize some + # options in distutils command. + dist.add_extension('', sources = []) + else: + self.scons_data.append((fullsconsname, + pre_hook, + post_hook, + full_source_files, + parent_name)) + # XXX: we add a fake extension, to correctly initialize some + # options in distutils command. + self.add_extension('', sources = []) + def add_scripts(self,*files): """Add scripts to configuration. """ |