def get_repository_config(server_name): # we get a pypi repository alias but we need the url+username+password from pypirc # distutils does the translation, but we have to fool it a little from distutils.config import PyPIRCCommand from distutils.dist import Distribution pypirc = PyPIRCCommand(Distribution()) pypirc.repository = server_name return pypirc._read_pypirc()
def get_pypirc_credentials(index_server): """Acquire credentials from the user's pypirc file""" try: from distutils.dist import Distribution from distutils.config import PyPIRCCommand except ImportError: return get_pypirc_py24() p = PyPIRCCommand(Distribution()) p.repository = index_server return p._read_pypirc()