name = name.lower().replace('_', '-') if name.startswith('--'): name = name[2:] # only prefer long opts return name def _disassemble_key(name): # type: (str) -> List[str] return name.split(".", 1) # The kinds of configurations there are. kinds = enum( USER="******", # User Specific GLOBAL="global", # System Wide VENV="venv", # Virtual Environment Specific ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) class Configuration(object): """Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the
from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Any, Dict, Iterator, Optional, TypeVar, Union _T = TypeVar('_T', bound='TempDirectory') logger = logging.getLogger(__name__) # Kinds of temporary directories. Only needed for ones that are # globally-managed. tempdir_kinds = enum( BUILD_ENV="build-env", EPHEM_WHEEL_CACHE="ephem-wheel-cache", REQ_BUILD="req-build", ) _tempdir_manager = None # type: Optional[ExitStack] @contextmanager def global_tempdir_manager(): # type: () -> Iterator[None] global _tempdir_manager with ExitStack() as stack: old_tempdir_manager, _tempdir_manager = _tempdir_manager, stack try: yield
name = name.lower().replace('_', '-') if name.startswith('--'): name = name[2:] # only prefer long opts return name def _disassemble_key(name): # type: (str) -> List[str] return name.split(".", 1) # The kinds of configurations there are. kinds = enum( USER="******", # User Specific GLOBAL="global", # System Wide VENV="venv", # Virtual Environment Specific ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) class Configuration(object): """Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the
def _disassemble_key(name): # type: (str) -> List[str] if "." not in name: error_message = ( "Key does not contain dot separated section and key. " "Perhaps you wanted to use 'global.{}' instead?").format(name) raise ConfigurationError(error_message) return name.split(".", 1) # The kinds of configurations there are. kinds = enum( USER="******", # User Specific GLOBAL="global", # System Wide SITE="site", # [Virtual] Environment Specific ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf" def get_configuration_files(): global_config_files = [ os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip") ] site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) legacy_config_file = os.path.join(
# type: (str) -> List[str] <<<<<<< HEAD if "." not in name: error_message = ( "Key does not contain dot separated section and key. " "Perhaps you wanted to use 'global.{}' instead?" ).format(name) raise ConfigurationError(error_message) ======= >>>>>>> 71358189c5e72ee2ac9883b408a2f540a7f5745e return name.split(".", 1) # The kinds of configurations there are. kinds = enum( USER="******", # User Specific GLOBAL="global", # System Wide <<<<<<< HEAD SITE="site", # [Virtual] Environment Specific ======= VENV="venv", # Virtual Environment Specific >>>>>>> 71358189c5e72ee2ac9883b408a2f540a7f5745e ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) <<<<<<< HEAD CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf'