MCPcopy Create free account
hub / github.com/numpy/numpy / get_atlas_version

Function get_atlas_version

numpy/distutils/system_info.py:1778–1848  ·  view source on GitHub ↗
(**config)

Source from the content-addressed store, hash-verified

1776
1777
1778def get_atlas_version(**config):
1779 libraries = config.get('libraries', [])
1780 library_dirs = config.get('library_dirs', [])
1781 key = (tuple(libraries), tuple(library_dirs))
1782 if key in _cached_atlas_version:
1783 return _cached_atlas_version[key]
1784 c = cmd_config(Distribution())
1785 atlas_version = None
1786 info = {}
1787 try:
1788 s, o = c.get_output(atlas_version_c_text,
1789 libraries=libraries, library_dirs=library_dirs,
1790 )
1791 if s and re.search(r'undefined reference to `_gfortran', o, re.M):
1792 s, o = c.get_output(atlas_version_c_text,
1793 libraries=libraries + ['gfortran'],
1794 library_dirs=library_dirs,
1795 )
1796 if not s:
1797 warnings.warn(textwrap.dedent("""
1798 *****************************************************
1799 Linkage with ATLAS requires gfortran. Use
1800
1801 python setup.py config_fc --fcompiler=gnu95 ...
1802
1803 when building extension libraries that use ATLAS.
1804 Make sure that -lgfortran is used for C++ extensions.
1805 *****************************************************
1806 """), stacklevel=2)
1807 dict_append(info, language='f90',
1808 define_macros=[('ATLAS_REQUIRES_GFORTRAN', None)])
1809 except Exception: # failed to get version from file -- maybe on Windows
1810 # look at directory name
1811 for o in library_dirs:
1812 m = re.search(r'ATLAS_(?P<version>\d+[.]\d+[.]\d+)_', o)
1813 if m:
1814 atlas_version = m.group('version')
1815 if atlas_version is not None:
1816 break
1817
1818 # final choice --- look at ATLAS_VERSION environment
1819 # variable
1820 if atlas_version is None:
1821 atlas_version = os.environ.get('ATLAS_VERSION', None)
1822 if atlas_version:
1823 dict_append(info, define_macros=[(
1824 'ATLAS_INFO', _c_string_literal(atlas_version))
1825 ])
1826 else:
1827 dict_append(info, define_macros=[('NO_ATLAS_INFO', -1)])
1828 return atlas_version or '?.?.?', info
1829
1830 if not s:
1831 m = re.search(r'ATLAS version (?P<version>\d+[.]\d+[.]\d+)', o)
1832 if m:
1833 atlas_version = m.group('version')
1834 if atlas_version is None:
1835 if re.search(r'undefined symbol: ATL_buildinfo', o, re.M):

Callers 3

calc_infoMethod · 0.85
calc_infoMethod · 0.85
calc_infoMethod · 0.85

Calls 6

_c_string_literalFunction · 0.85
get_outputMethod · 0.80
warnMethod · 0.80
infoMethod · 0.80
dict_appendFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected