diff options
| author | Thomas Green <tomgreen66@hotmail.com> | 2021-12-08 11:57:10 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-08 11:57:10 +0000 |
| commit | dc766fc1abb546ab883f76ef4e405e99e9287ab6 (patch) | |
| tree | 9e7c7748ba8bfbb2ba5224633b0725909712d2fa /numpy/distutils | |
| parent | 1cfdac82ac793061d8ca4b07c046fc6b21ee7e54 (diff) | |
| parent | ab7a1927353ab9dd52e3f2f7a1a889ae790667b9 (diff) | |
| download | numpy-dc766fc1abb546ab883f76ef4e405e99e9287ab6.tar.gz | |
Merge branch 'numpy:main' into armcompiler
Diffstat (limited to 'numpy/distutils')
| -rw-r--r-- | numpy/distutils/ccompiler_opt.py | 4 | ||||
| -rw-r--r-- | numpy/distutils/checks/cpu_asimdfhm.c | 4 | ||||
| -rw-r--r-- | numpy/distutils/misc_util.py | 27 |
3 files changed, 22 insertions, 13 deletions
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index 39847c20f..b38e47c13 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -654,9 +654,9 @@ class _Distutils: @staticmethod def dist_load_module(name, path): """Load a module from file, required by the abstract class '_Cache'.""" - from numpy.compat import npy_load_module + from .misc_util import exec_mod_from_location try: - return npy_load_module(name, path) + return exec_mod_from_location(name, path) except Exception as e: _Distutils.dist_log(e, stderr=True) return None diff --git a/numpy/distutils/checks/cpu_asimdfhm.c b/numpy/distutils/checks/cpu_asimdfhm.c index bb437aa40..cb49751c4 100644 --- a/numpy/distutils/checks/cpu_asimdfhm.c +++ b/numpy/distutils/checks/cpu_asimdfhm.c @@ -10,8 +10,8 @@ int main(void) float32x4_t vf = vdupq_n_f32(1.0f); float32x2_t vlf = vdup_n_f32(1.0f); - int ret = (int)vget_lane_f32(vfmlal_low_u32(vlf, vlhp, vlhp), 0); - ret += (int)vgetq_lane_f32(vfmlslq_high_u32(vf, vhp, vhp), 0); + int ret = (int)vget_lane_f32(vfmlal_low_f16(vlf, vlhp, vlhp), 0); + ret += (int)vgetq_lane_f32(vfmlslq_high_f16(vf, vhp, vhp), 0); return ret; } diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index f0f9b4bd7..513be75db 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -31,8 +31,6 @@ def clean_up_temporary_directory(): atexit.register(clean_up_temporary_directory) -from numpy.compat import npy_load_module - __all__ = ['Configuration', 'get_numpy_include_dirs', 'default_config_dict', 'dict_append', 'appendpath', 'generate_config_py', 'get_cmd', 'allpath', 'get_mathlibs', @@ -44,7 +42,8 @@ __all__ = ['Configuration', 'get_numpy_include_dirs', 'default_config_dict', 'dot_join', 'get_frame', 'minrelpath', 'njoin', 'is_sequence', 'is_string', 'as_list', 'gpaths', 'get_language', 'get_build_architecture', 'get_info', 'get_pkg_info', - 'get_num_build_jobs', 'sanitize_cxx_flags'] + 'get_num_build_jobs', 'sanitize_cxx_flags', + 'exec_mod_from_location'] class InstallableLib: """ @@ -945,9 +944,8 @@ class Configuration: try: setup_name = os.path.splitext(os.path.basename(setup_py))[0] n = dot_join(self.name, subpackage_name, setup_name) - setup_module = npy_load_module('_'.join(n.split('.')), - setup_py, - ('.py', 'U', 1)) + setup_module = exec_mod_from_location( + '_'.join(n.split('.')), setup_py) if not hasattr(setup_module, 'configuration'): if not self.options['assume_default_configuration']: self.warn('Assuming default configuration '\ @@ -1993,8 +1991,8 @@ class Configuration: name = os.path.splitext(os.path.basename(fn))[0] n = dot_join(self.name, name) try: - version_module = npy_load_module('_'.join(n.split('.')), - fn, info) + version_module = exec_mod_from_location( + '_'.join(n.split('.')), fn) except ImportError as e: self.warn(str(e)) version_module = None @@ -2481,7 +2479,7 @@ def get_build_architecture(): return get_build_architecture() -_cxx_ignore_flags = {'-Werror=implicit-function-declaration'} +_cxx_ignore_flags = {'-Werror=implicit-function-declaration', '-std=c99'} def sanitize_cxx_flags(cxxflags): @@ -2491,3 +2489,14 @@ def sanitize_cxx_flags(cxxflags): return [flag for flag in cxxflags if flag not in _cxx_ignore_flags] +def exec_mod_from_location(modname, modfile): + ''' + Use importlib machinery to import a module `modname` from the file + `modfile`. Depending on the `spec.loader`, the module may not be + registered in sys.modules. + ''' + spec = importlib.util.spec_from_file_location(modname, modfile) + foo = importlib.util.module_from_spec(spec) + spec.loader.exec_module(foo) + return foo + |
