Python sysconfig.get_path() Examples
The following are 30
code examples of sysconfig.get_path().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sysconfig
, or try the search function
.
Example #1
Source File: site.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #2
Source File: __init__.py From recruit with Apache License 2.0 | 6 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #3
Source File: site.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #4
Source File: site.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #5
Source File: site.py From meddle with MIT License | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #6
Source File: site.py From ironpython2 with Apache License 2.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #7
Source File: site.py From BinderFilter with MIT License | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #8
Source File: site.py From oss-ftp with MIT License | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #9
Source File: pydevd_file_utils.py From PyDev.Debugger with Eclipse Public License 1.0 | 6 votes |
def _get_library_dir(): library_dir = None try: import sysconfig library_dir = sysconfig.get_path('purelib') except ImportError: pass # i.e.: Only 2.7 onwards if library_dir is None or not os_path_exists(library_dir): for path in sys.path: if os_path_exists(path) and os.path.basename(path) == 'site-packages': library_dir = path break if library_dir is None or not os_path_exists(library_dir): library_dir = os.path.dirname(os.__file__) return library_dir # Note: we can't call sysconfig.get_path from _NormPath (it deadlocks on Python 2.7) so, we # need to get the library dir during module loading.
Example #10
Source File: site.py From pmatic with GNU General Public License v2.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path import os if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #11
Source File: site.py From ironpython3 with Apache License 2.0 | 6 votes |
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE user_base = getuserbase() # this will also set USER_BASE if USER_SITE is not None: return USER_SITE from sysconfig import get_path if sys.platform == 'darwin': from sysconfig import get_config_var if get_config_var('PYTHONFRAMEWORK'): USER_SITE = get_path('purelib', 'osx_framework_user') return USER_SITE USER_SITE = get_path('purelib', '%s_user' % os.name) return USER_SITE
Example #12
Source File: __init__.py From Ansible with MIT License | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #13
Source File: __init__.py From python2017 with MIT License | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #14
Source File: py31compat.py From planespotter with MIT License | 5 votes |
def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") return get_python_lib(name == 'platlib')
Example #15
Source File: __init__.py From planespotter with MIT License | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #16
Source File: bdist_egg.py From Flask-P2P with MIT License | 5 votes |
def _get_purelib(): return get_path("purelib")
Example #17
Source File: py31compat.py From Flask-P2P with MIT License | 5 votes |
def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") return get_python_lib(name=='platlib')
Example #18
Source File: __init__.py From python with Apache License 2.0 | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #19
Source File: setup.py From kitty with GNU General Public License v3.0 | 5 votes |
def get_python_flags(cflags: List[str]) -> List[str]: cflags.extend('-I' + x for x in get_python_include_paths()) libs: List[str] = [] libs += (sysconfig.get_config_var('LIBS') or '').split() libs += (sysconfig.get_config_var('SYSLIBS') or '').split() fw = sysconfig.get_config_var('PYTHONFRAMEWORK') if fw: for var in 'data include stdlib'.split(): val = sysconfig.get_path(var) if val and '/{}.framework'.format(fw) in val: fdir = val[:val.index('/{}.framework'.format(fw))] if os.path.isdir( os.path.join(fdir, '{}.framework'.format(fw)) ): framework_dir = fdir break else: raise SystemExit('Failed to find Python framework') ldlib = sysconfig.get_config_var('LDLIBRARY') if ldlib: libs.append(os.path.join(framework_dir, ldlib)) else: ldlib = sysconfig.get_config_var('LIBDIR') if ldlib: libs += ['-L' + ldlib] ldlib = sysconfig.get_config_var('VERSION') if ldlib: libs += ['-lpython' + ldlib + sys.abiflags] libs += (sysconfig.get_config_var('LINKFORSHARED') or '').split() return libs
Example #20
Source File: setup.py From kitty with GNU General Public License v3.0 | 5 votes |
def get_python_include_paths() -> List[str]: ans = [] for name in sysconfig.get_path_names(): if 'include' in name: ans.append(name) def gp(x: str) -> Optional[str]: return sysconfig.get_path(x) return sorted(frozenset(filter(None, map(gp, sorted(ans)))))
Example #21
Source File: bdist_egg.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def _get_purelib(): return get_path("purelib")
Example #22
Source File: py31compat.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") return get_python_lib(name == 'platlib')
Example #23
Source File: __init__.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #24
Source File: __main__.py From passa with ISC License | 5 votes |
def get_site_packages(): prefixes = {sys.prefix, sysconfig.get_config_var('prefix')} try: prefixes.add(sys.real_prefix) except AttributeError: pass form = sysconfig.get_path('purelib', expand=False) py_version_short = '{0[0]}.{0[1]}'.format(sys.version_info) return { form.format(base=prefix, py_version_short=py_version_short) for prefix in prefixes }
Example #25
Source File: __init__.py From syntheticmass with Apache License 2.0 | 5 votes |
def get_stdlib(): paths = [ sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib"), ] return set(filter(bool, paths))
Example #26
Source File: py31compat.py From syntheticmass with Apache License 2.0 | 5 votes |
def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") return get_python_lib(name=='platlib')
Example #27
Source File: bdist_egg.py From stopstalk-deployment with MIT License | 5 votes |
def _get_purelib(): return get_path("purelib")
Example #28
Source File: bdist_egg.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def _get_purelib(): return get_path("purelib")
Example #29
Source File: py31compat.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") return get_python_lib(name == 'platlib')
Example #30
Source File: bdist_egg.py From planespotter with MIT License | 5 votes |
def _get_purelib(): return get_path("purelib")