diff options
| author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-05-09 14:15:57 +0200 |
|---|---|---|
| committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-05-09 14:15:57 +0200 |
| commit | b114d1e0326937e5d04907ea0f666429580dc806 (patch) | |
| tree | d66029658ad32ba50a3f7322c25d2d25bad6b79a /numpy | |
| parent | b0ef6aebcbedc2ea528c5f8d09f31f37320b08a2 (diff) | |
| download | numpy-b114d1e0326937e5d04907ea0f666429580dc806.tar.gz | |
ENH: add possibility to add define_macros to extensions
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/distutils/misc_util.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 5bd3a9086..38690aec3 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -671,7 +671,7 @@ class Configuration(object): _list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs', 'libraries', 'headers', 'scripts', 'py_modules', - 'installed_libraries'] + 'installed_libraries', 'define_macros'] _dict_keys = ['package_dir', 'installed_pkg_config'] _extra_keys = ['name', 'version'] @@ -1273,6 +1273,22 @@ class Configuration(object): ### XXX Implement add_py_modules + def add_define_macros(self, macros): + """Add define macros to configuration + + Add the given sequence of macro name and value duples to the beginning + of the define_macros list This list will be visible to all extension + modules of the current package. + """ + dist = self.get_distribution() + if dist is not None: + if not hasattr(dist, 'define_macros'): + dist.define_macros = [] + dist.define_macros.extend(macros) + else: + self.define_macros.extend(macros) + + def add_include_dirs(self,*paths): """Add paths to configuration include directories. @@ -1440,6 +1456,8 @@ class Configuration(object): libnames.append(libname) ext_args['libraries'] = libnames + ext_args['libraries'] + ext_args['define_macros'] = \ + self.define_macros + ext_args.get('define_macros', []) from numpy.distutils.core import Extension ext = Extension(**ext_args) |
