Python pip.locations.distutils_scheme() Examples
The following are 23
code examples of pip.locations.distutils_scheme().
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
pip.locations
, or try the search function
.
Example #1
Source File: __init__.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def is_local(path): """ Return True if this is a path pip is allowed to modify. If we're in a virtualenv, sys.prefix points to the virtualenv's prefix; only sys.prefix is considered local. If we're not in a virtualenv, in general we can modify anything. However, if the OS vendor has configured distutils to install somewhere other than sys.prefix (which could be a subdirectory of sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal and the domain of the OS vendor. (In other words, everything _other than_ sys.prefix is considered local.) """ path = normalize_path(path) prefix = normalize_path(sys.prefix) if running_under_virtualenv(): return path.startswith(normalize_path(sys.prefix)) else: from pip.locations import distutils_scheme if path.startswith(prefix): for local_path in distutils_scheme("").values(): if path.startswith(normalize_path(local_path)): return True return False else: return True
Example #2
Source File: install.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #3
Source File: install.py From Hands-On-Deep-Learning-for-Games with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #4
Source File: install.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #5
Source File: install.py From PhonePi_SampleServer with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #6
Source File: install.py From Ansible with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #7
Source File: install.py From python2017 with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #8
Source File: __init__.py From pyslam with GNU General Public License v3.0 | 5 votes |
def get_include(*args, **kwargs): import os try: from pip import locations return os.path.dirname( locations.distutils_scheme('pybind11', *args, **kwargs)['headers']) except ImportError: return 'include'
Example #9
Source File: __init__.py From pyslam with GNU General Public License v3.0 | 5 votes |
def get_include(*args, **kwargs): import os try: from pip import locations return os.path.dirname( locations.distutils_scheme('pybind11', *args, **kwargs)['headers']) except ImportError: return 'include'
Example #10
Source File: __init__.py From pyslam with GNU General Public License v3.0 | 5 votes |
def get_include(*args, **kwargs): import os try: from pip import locations return os.path.dirname( locations.distutils_scheme('pybind11', *args, **kwargs)['headers']) except ImportError: return 'include'
Example #11
Source File: install.py From planespotter with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #12
Source File: install.py From python with Apache License 2.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #13
Source File: install.py From recruit with Apache License 2.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #14
Source File: install.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #15
Source File: __init__.py From coremltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_include(*args, **kwargs): import os try: from pip import locations return os.path.dirname( locations.distutils_scheme('pybind11', *args, **kwargs)['headers']) except ImportError: return 'include'
Example #16
Source File: test_prefix_deviation.py From pyang with ISC License | 5 votes |
def test_can_find_modules_when_prefix_differ(monkeypatch): """ context should find the default installed modules, without the help of environment variables, even of the pip install location differs from ``sys.prefix`` """ # store pip location. # monkeypatching sys.prefix will side_effect scheme. scheme = locations.distutils_scheme('pyang') monkeypatch.setattr( locations, 'distutils_scheme', lambda *_: scheme) # simulate #225 description monkeypatch.setattr(sys, 'prefix', '/usr') # remove obfuscation from env vars if os.environ.get('YANG_INSTALL'): del os.environ['YANG_INSTALL'] if os.environ.get('YANG_MODPATH'): del os.environ['YANG_MODPATH'] ctx = create_context() module = ctx.search_module(None, EXISTING_MODULE) assert module is not None
Example #17
Source File: install.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #18
Source File: install.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #19
Source File: install.py From vnpy_crypto with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #20
Source File: __init__.py From python-netsurv with MIT License | 5 votes |
def is_local(path): """ Return True if this is a path pip is allowed to modify. If we're in a virtualenv, sys.prefix points to the virtualenv's prefix; only sys.prefix is considered local. If we're not in a virtualenv, in general we can modify anything. However, if the OS vendor has configured distutils to install somewhere other than sys.prefix (which could be a subdirectory of sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal and the domain of the OS vendor. (In other words, everything _other than_ sys.prefix is considered local.) """ path = normalize_path(path) prefix = normalize_path(sys.prefix) if running_under_virtualenv(): return path.startswith(normalize_path(sys.prefix)) else: from pip.locations import distutils_scheme if path.startswith(prefix): for local_path in distutils_scheme("").values(): if path.startswith(normalize_path(local_path)): return True return False else: return True
Example #21
Source File: install.py From python-netsurv with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]
Example #22
Source File: __init__.py From python-netsurv with MIT License | 5 votes |
def is_local(path): """ Return True if this is a path pip is allowed to modify. If we're in a virtualenv, sys.prefix points to the virtualenv's prefix; only sys.prefix is considered local. If we're not in a virtualenv, in general we can modify anything. However, if the OS vendor has configured distutils to install somewhere other than sys.prefix (which could be a subdirectory of sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal and the domain of the OS vendor. (In other words, everything _other than_ sys.prefix is considered local.) """ path = normalize_path(path) prefix = normalize_path(sys.prefix) if running_under_virtualenv(): return path.startswith(normalize_path(sys.prefix)) else: from pip.locations import distutils_scheme if path.startswith(prefix): for local_path in distutils_scheme("").values(): if path.startswith(normalize_path(local_path)): return True return False else: return True
Example #23
Source File: install.py From python-netsurv with MIT License | 5 votes |
def get_lib_location_guesses(*args, **kwargs): scheme = distutils_scheme('', *args, **kwargs) return [scheme['purelib'], scheme['platlib']]