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

Function get_shared_lib_extension

numpy/distutils/misc_util.py:680–721  ·  view source on GitHub ↗

Return the correct file extension for shared libraries. Parameters ---------- is_python_ext : bool, optional Whether the shared library is a Python extension. Default is False. Returns ------- so_ext : str The shared library extension. Notes -----

(is_python_ext=False)

Source from the content-addressed store, hash-verified

678 return filenames
679
680def get_shared_lib_extension(is_python_ext=False):
681 """Return the correct file extension for shared libraries.
682
683 Parameters
684 ----------
685 is_python_ext : bool, optional
686 Whether the shared library is a Python extension. Default is False.
687
688 Returns
689 -------
690 so_ext : str
691 The shared library extension.
692
693 Notes
694 -----
695 For Python shared libs, `so_ext` will typically be '.so' on Linux and OS X,
696 and '.pyd' on Windows. For Python >= 3.2 `so_ext` has a tag prepended on
697 POSIX systems according to PEP 3149.
698
699 """
700 confvars = distutils.sysconfig.get_config_vars()
701 so_ext = confvars.get('EXT_SUFFIX', '')
702
703 if not is_python_ext:
704 # hardcode known values, config vars (including SHLIB_SUFFIX) are
705 # unreliable (see #3182)
706 # darwin, windows and debug linux are wrong in 3.3.1 and older
707 if (sys.platform.startswith('linux') or
708 sys.platform.startswith('gnukfreebsd')):
709 so_ext = '.so'
710 elif sys.platform.startswith('darwin'):
711 so_ext = '.dylib'
712 elif sys.platform.startswith('win'):
713 so_ext = '.dll'
714 else:
715 # fall back to config vars for unknown platforms
716 # fix long extension for Python >=3.2, see PEP 3149.
717 if 'SOABI' in confvars:
718 # Does nothing unless SOABI config var exists
719 so_ext = so_ext.replace('.' + confvars.get('SOABI'), '', 1)
720
721 return so_ext
722
723def get_data_files(data):
724 if is_string(data):

Callers 3

system_info.pyFile · 0.90
FCompilerClass · 0.90

Calls 3

startswithMethod · 0.80
replaceMethod · 0.80
getMethod · 0.45

Tested by 1