# Pastebin ZRpTQ6b8 # XXX: This is patched in the tests. def _iter_config_files(self): # type: () -> Iterable[Tuple[Kind, List[str]]] """Yields variant and configuration files associated with it. This should be treated like items of a dictionary. """ # SMELL: Move the conditions out of this function # environment variables have the lowest priority config_file = os.environ.get('PIP_CONFIG_FILE', None) if config_file is not None: yield kinds.ENV, [config_file] else: yield kinds.ENV, [] # at the base we have any global configuration yield kinds.GLOBAL, list(site_config_files) # per-user configuration next should_load_user_config = not self.isolated and not ( config_file and os.path.exists(config_file) ) if should_load_user_config: # The legacy config file is overridden by the new config file yield kinds.USER, [legacy_config_file, new_config_file] # finally virtualenv configuration first trumping others if running_under_virtualenv(): yield kinds.VENV, [venv_config_file]