a ReQ @ s d dl Z d dlZd dlZd dlZd dlZd dlZzd dlmZ W n ey^ d dl mZ Y n0 ddl mZ ddlm Z mZmZmZmZmZ ddlmZmZ eeZdZdZG d d d eZdS ) N)Thread )DistlibException)HTTPBasicAuthHandlerRequestHTTPPasswordMgrurlparsebuild_openerstring_types)zip_dirServerProxyzhttps://pypi.org/pypipypic @ s e Zd ZdZdZd*ddZdd Zdd Zd d Zdd Z dd Z dd Zd+ddZd,ddZ d-ddZd.ddZdd Zd/ddZd0d d!Zd1d"d#Zd$d% Zd&d' Zd2d(d)ZdS )3PackageIndexzc This class represents a package index compatible with PyPI, the Python Package Index. s. ----------ThIs_Is_tHe_distlib_index_bouNdaRY_$Nc C s |pt | _| t| j\}}}}}}|s<|s<|s<|dvrJtd| j d| _d| _d| _d| _t t jdZ}dD ]D} z,tj | dg||d} | dkr| | _W qW qt ty Y qt0 qtW d n1 s0 Y dS ) z Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. )httphttpszinvalid repository: %sNw)gpgZgpg2z --versionstdoutstderrr ) DEFAULT_INDEXurlread_configurationr r password_handlerssl_verifierr gpg_homeopenosdevnull subprocess check_callOSError)selfr schemenetlocpathparamsqueryfragZsinksrc r+ /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_vendor/distlib/index.py__init__$ s( zPackageIndex.__init__c C s ddl m} | S )zs Get the distutils command for interacting with PyPI configurations. :return: the command. r )_get_pypirc_command)utilr. )r" cmdr+ r+ r, r. A s z PackageIndex._get_pypirc_commandc C sN ddl m} || }|d| _|d| _|dd| _|d| j| _dS ) z Read the PyPI access configuration as supported by distutils. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. r )_load_pypircusernamepasswordrealmr repositoryN)r/ r1 getr2 r3 r4 r )r" r1 cfgr+ r+ r, r I s zPackageIndex.read_configurationc C s | ddlm} || dS )z Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. r ) _store_pypircN)check_credentialsr/ r8 )r" r8 r+ r+ r, save_configurationV s zPackageIndex.save_configurationc C s\ | j du s| jdu rtdt }t| j\}}}}}}|| j|| j | j t|| _ dS )zp Check that ``username`` and ``password`` have been set, and raise an exception if not. Nz!username and password must be set) r2 r3 r r r r add_passwordr4 r r )r" Zpm_r$ r+ r+ r, r9 _ s zPackageIndex.check_credentialsc C s\ | | | }d|d<