Ë Z´oÁÜœŒúãóâ—ddlZddlZddlZddlZddlZddlZ ddlmZddl m Z ddl m Z mZmZmZmZmZddlmZmZej,e«ZdZdZGd „d e«Zy#e$r ddl mZYŒMwxYw) éN)ÚThreadé)ÚDistlibException)ÚHTTPBasicAuthHandlerÚRequestÚHTTPPasswordMgrÚurlparseÚ build_openerÚ string_types)Úzip_dirÚ ServerProxyzhttps://pypi.org/pypiÚpypicóš—eZdZdZdZdd„Zd„Zd„Zd„Zd„Z d „Z d „Z dd „Z dd „Z dd „Z dd„Zd„Z dd„Z dd„Zdd„Zd„Zd„Zdd„Zy)Ú PackageIndexzc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$NcóÒ—|xst|_|j«t|j«\}}}}}}|s|s|s|dvrt d|jz«‚d|_d|_d|_d|_ttjd«5}dD]+} tj| dg||¬«} | dk(r | |_nŒ-ddd«y#t$rYŒBwxYw#1swYyxYw) z” Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. )ÚhttpÚhttpszinvalid repository: %sNÚw)ÚgpgÚgpg2z --version©ÚstdoutÚstderrr)Ú DEFAULT_INDEXÚurlÚread_configurationr rÚpassword_handlerÚ ssl_verifierrÚgpg_homeÚopenÚosÚdevnullÚ subprocessÚ check_callÚOSError) ÚselfrÚschemeÚnetlocÚpathÚparamsÚqueryÚfragÚsinkÚsÚrcs ú2/usr/lib/python3.12/site-packages/distlib/index.pyÚ__init__zPackageIndex.__init__%sñ€ðÒ'œ-ˆŒØ ×ÑÔ!Ü4<¸T¿X¹XÓ4FÑ1ˆ�˜˜f e¨TÙ ‘U™d fÐ4EÑ&EÜ"Ð#;¸d¿h¹hÑ#FÓGÐ GØ $ˆÔØ ˆÔ؈ŒØˆŒ Ü ”"—*‘*˜cÔ " dó%�ðÜ#×.Ñ.°°;Ð/?ÈØ6:ô<�Bà˜Q’wØ#$˜œÙðð %÷#Ð "øôòÙðú÷#Ð "ús0ÂCÂ&CÃCà CÃCÃCÃCÃC&có—ddlm}|«S)zs Get the distutils command for interacting with PyPI configurations. :return: the command. r)Ú_get_pypirc_command)Úutilr3)r&Úcmds r0r3z PackageIndex._get_pypirc_commandBs€õ 5Ù‹uˆ ócóè—ddlm}||«}|jd«|_|jd«|_|jdd«|_|jd|j «|_y) zà Read the PyPI access configuration as supported by distutils. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. r)Ú _load_pypircÚusernameÚpasswordÚrealmrÚ repositoryN)r4r8Úgetr9r:r;r)r&r8Úcfgs r0rzPackageIndex.read_configurationJsY€õ 'Ù˜4Ó ˆØŸ™  Ó+ˆŒ ØŸ™  Ó+ˆŒ Ø—W‘W˜W fÓ-ˆŒ Ø—7‘7˜<¨¯©Ó2ˆ�r6có@—|j«ddlm}||«y)z” Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. r)Ú _store_pypircN)Úcheck_credentialsr4r@)r&r@s r0Úsave_configurationzPackageIndex.save_configurationWs€ð ×ÑÔ Ý'Ù�dÕr6có—|j� |j€ td«‚t«}t |j «\}}}}}}|j |j||j|j«t|«|_ y)zp Check that ``username`` and ``password`` have been set, and raise an exception if not. Nz!username and password must be set) r9r:rrr rÚ add_passwordr;rr)r&ÚpmÚ_r(s r0rAzPackageIndex.check_credentials`sq€ð �=‰=Ð  D§M¡MÐ$9Ü"Ð#FÓGÐ GÜ Ó ˆÜ (¨¯©Ó 2шˆ6�1�a˜˜AØ �‰˜Ÿ ™  F¨D¯M©M¸4¿=¹=ÔIÜ 4°RÓ 8ˆÕr6có:—|j«|j«|j«}d|d<|j|j «g«}|j |«d|d<|j|j «g«}|j |«S)aq Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. Úverifyú:actionÚsubmit)rAÚvalidateÚtodictÚencode_requestÚitemsÚ send_request)r&ÚmetadataÚdÚrequests r0ÚregisterzPackageIndex.registerls‰€ð ×ÑÔ Ø×ÑÔØ �O‰OÓ ˆØˆˆ)‰ Ø×%Ñ% a§g¡g£i°Ó4ˆØ ×ј'Ô"؈ˆ)‰ Ø×%Ñ% a§g¡g£i°Ó4ˆØ× Ñ  Ó)Ð)r6cóâ— |j«}|snK|jd«j«}|j|«tj |›d|›�«Œ^|j «y)ar Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. úutf-8z: N)ÚreadlineÚdecodeÚrstripÚappendÚloggerÚdebugÚclose)r&ÚnameÚstreamÚoutbufr.s r0Ú_readerzPackageIndex._reader€s]€ðØ—‘Ó!ˆAÙØØ—‘˜Ó!×(Ñ(Ó*ˆAØ �M‰M˜!Ô Ü �L‰L¢T©1Ð-Ô .ð ð � ‰ �r6c ó¼—|jdddg}|€ |j}|r|jd|g«|�|jgd¢«tj«}t j j|t j j|«dz«}|jddd |d ||g«tjd d j|««||fS) a‰ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. ú --status-fdÚ2ú--no-ttyú --homedir)z--batchz--passphrase-fdÚ0z.ascz --detach-signz--armorz --local-userz--outputú invoking: %sÚ ) rrÚextendÚtempfileÚmkdtempr!r)ÚjoinÚbasenamerZr[)r&ÚfilenameÚsignerÚ sign_passwordÚkeystorer5ÚtdÚsfs r0Úget_sign_commandzPackageIndex.get_sign_command’sÁ€ð�x‰x˜¨¨ZÐ8ˆØ Ð Ø—}‘}ˆHÙ Ø �J‰J˜  XÐ.Ô /Ø Ð $Ø �J‰JÒ:Ô ;Ü × Ñ Ó ˆÜ �W‰W�\‰\˜"œbŸg™g×.Ñ.¨xÓ8¸6ÑAÓ BˆØ � ‰ �O Y°Ø˜J¨¨Hð6ô 7ä� ‰ �^ S§X¡X¨c£]Ô3Ø�Bˆwˆr6có^—tjtjdœ}|�tj|d<g}g}tj|fi|¤Ž}t|jd|j |f¬«}|j «t|jd|j|f¬«}|j «|�5|jj|«|jj«|j«|j«|j«|j||fS)aæ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``. rÚstdinr)ÚtargetÚargsr)r#ÚPIPEÚPopenrr`rÚstartrrvÚwriter\ÚwaitrlÚ returncode) r&r5Ú input_dataÚkwargsrrÚpÚt1Út2s r0Ú run_commandzPackageIndex.run_command®sæ€ô!—o‘oÜ —o‘oñ ˆð Ð !Ü(Ÿo™oˆF�7‰OØˆØˆÜ × Ñ ˜SÑ + FÑ +ˆô˜4Ÿ<™<¨x¸¿¹À6Ð.JÔ KˆØ �‰Œ Ü ˜4Ÿ<™<¨x¸¿¹À6Ð.JÔ KˆØ �‰Œ Ø Ð !Ø �G‰G�M‰M˜*Ô %Ø �G‰G�M‰MŒOà �‰ŒØ �‰Œ Ø �‰Œ Ø�|‰|˜V VÐ+Ð+r6có¤—|j||||«\}}|j||jd««\}}} |dk7rtd|z«‚|S)aR Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The absolute pathname of the file where the signature is stored. rUrz&sign command failed with error code %s)rtr„Úencoder) r&rnrorprqr5Úsig_filer/rrs r0Ú sign_filezPackageIndex.sign_fileÑso€ð×-Ñ-¨h¸À Ø.6ó8‰ ˆˆXà!×-Ñ-¨cØ.;×.BÑ.BÀ7Ó.KóMшˆF�Fà �Š7Ü"ð$-Ø/1ñ$2ó3ð 3àˆr6c ó$—|j«tjj|«st d|z«‚|j «|j «}d} |r6|jstjd«n|j||||«} t|d«5} | j«} ddd«tj «j«} tj | «j«} |j#dd||| | dœ«dtjj%|«| fg}| rˆt| d«5} | j«}ddd«|j'd tjj%| «f«t)j*tjj-| ««|j/|j1«|«}|j3|«S#1swY�ŒFxYw#1swYŒªxYw) a´ Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The HTTP response received from PyPI upon submission of the request. z not found: %sNz)no signing program available - not signedÚrbÚ file_uploadÚ1)rIÚprotocol_versionÚfiletypeÚ pyversionÚ md5_digestÚ sha256_digestÚcontentÚ gpg_signature)rAr!r)ÚexistsrrKrLrrZÚwarningrˆr ÚreadÚhashlibÚmd5Ú hexdigestÚsha256ÚupdatermrYÚshutilÚrmtreeÚdirnamerMrNrO)r&rPrnrorprŽr�rqrQr‡ÚfÚ file_datar�r‘ÚfilesÚsig_datarRs r0Ú upload_filezPackageIndex.upload_fileès¢€ð. ×ÑÔ Ü�w‰w�~‰~˜hÔ'Ü" ?°XÑ#=Ó>Ð >Ø×ÑÔØ �O‰OÓ ˆØˆÙ Ø—8’8Ü—‘ÐJÕKàŸ>™>¨(°F¸MØ*2ó4�ä �(˜DÔ ! QØŸ™›ˆI÷"ä—[‘[ Ó+×5Ñ5Ó7ˆ ÜŸ™ yÓ1×;Ñ;Ó=ˆ Ø �‰Ø$Ø #Ø Ø"Ø$Ø*ñ  ô ðœRŸW™W×-Ñ-¨hÓ7¸ÐCÐDˆÙ Ü�h Ô%¨ØŸ6™6›8�÷&à �L‰L˜/¬2¯7©7×+;Ñ+;¸HÓ+EØ!ð#ô $ä �M‰Mœ"Ÿ'™'Ÿ/™/¨(Ó3Ô 4Ø×%Ñ% a§g¡g£i°Ó7ˆØ× Ñ  Ó)Ð)÷)"Ñ !ú÷&Ð%úsÂ$G9Å HÇ9HÈHcóü—|j«tjj|«st d|z«‚tjj |d«}tjj |«st d|z«‚|j«|j|j}}t|«j«}dd|fd|fg}d||fg}|j||«} |j| «S)a2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. znot a directory: %rz index.htmlz not found: %r)rIÚ doc_uploadr]Úversionr’)rAr!r)Úisdirrrlr”rKr]r¦r ÚgetvaluerMrO) r&rPÚdoc_dirÚfnr]r¦Úzip_dataÚfieldsr¡rRs r0Úupload_documentationz!PackageIndex.upload_documentation!sá€ð ×ÑÔ Ü�w‰w�}‰}˜WÔ%Ü"Ð#8¸7Ñ#BÓCÐ CÜ �W‰W�\‰\˜' <Ó 0ˆÜ�w‰w�~‰~˜bÔ!Ü" ?°RÑ#7Ó8Ð 8Ø×ÑÔØ Ÿ ™  x×'7Ñ'7ˆgˆÜ˜7Ó#×,Ñ,Ó.ˆØ+ؘ4�. 9¨gÐ"6ð8ˆà˜T 8Ð,Ð-ˆØ×%Ñ% f¨eÓ4ˆØ× Ñ  Ó)Ð)r6cóÞ—|jdddg}|€ |j}|r|jd|g«|jd||g«tj ddj |««|S)a| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. rbrcrdrez--verifyrgrh)rrrirZr[rl)r&Úsignature_filenameÚ data_filenamerqr5s r0Úget_verify_commandzPackageIndex.get_verify_command=sh€ð�x‰x˜¨¨ZÐ8ˆØ Ð Ø—}‘}ˆHÙ Ø �J‰J˜  XÐ.Ô /Ø � ‰ �JÐ 2°MÐBÔCÜ� ‰ �^ S§X¡X¨c£]Ô3؈ r6có®—|js td«‚|j|||«}|j|«\}}}|dvrtd|z«‚|dk(S)a6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. z0verification unavailable because gpg unavailable)rrz(verify command failed with error code %sr)rrr±r„)r&r¯r°rqr5r/rrs r0Úverify_signaturezPackageIndex.verify_signatureUso€ð�xŠxÜ"ð$1ó2ð 2à×%Ñ%Ð&8¸-Ø&.ó0ˆà!×-Ñ-¨cÓ2шˆF�FØ �VÑ Ü"Ð#MÐPRÑ#RÓSÐ SØ�Q‰wˆr6c ón—|€d}tjd«nKt|ttf«r|\}}nd}t t |««}tjd|z«t|d«5}|jt|««} |j«} d} d} d} d} d | vrt| d «} |r || | | « |j| «}|snD| t|«z } |j|«|r|j|«| d z } |r || | | «ŒX |j!« ddd« dk\r | krt#d | | fz«‚|rB|j%«}||k7rt#›d |›d|›d|›�«‚tjd|«yy#|j!«wxYw#1swYŒ}xYw)a This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. NzNo digest specifiedr˜zDigest specified: %sÚwbi éÿÿÿÿrzcontent-lengthzContent-Lengthrz1retrieval incomplete: got only %d out of %d bytesz digest mismatch for z : expected z, got zDigest verified: %s)rZr[Ú isinstanceÚlistÚtupleÚgetattrr—r rOrÚinfoÚintr–Úlenr|r›r\rr™)r&rÚdestfileÚdigestÚ reporthookÚdigesterÚhasherÚdfpÚsfpÚheadersÚ blocksizeÚsizer–ÚblocknumÚblockÚactuals r0Ú download_filezPackageIndex.download_filemsÌ€ð, ˆ>؈HÜ �L‰LÐ.Õ /ä˜&¤4¬ -Ô0Ø!'‘�™à�Ø/”wœw¨Ó/Ó1ˆHÜ �L‰LÐ/°&Ñ8Ô 9ô�(˜DÔ ! Sð×#Ñ#¤G¨C£LÓ1ˆCð ØŸ(™(›*�Ø � Ø�Ø�Ø�Ø# wÑ.ܘwÐ'7Ñ8Ó9�DÙÙ˜x¨°DÔ9ØØŸH™H YÓ/�EÙ ØØœC ›JÑ&�DØ—I‘I˜eÔ$ÙØ Ÿ™¨Ô.Ø ‘M�HÙ!Ù" 8¨Y¸Ô=ððð— ‘ • ÷5"ð: �1Š9˜ šÜ"ØCؘ�,ñó ð ñ Ø×'Ñ'Ó)ˆFؘÒÜ&Ú7=ºxÚ7=¹vð(GóHðHô �L‰LÐ.°Õ 7ð øð— ‘ • ú÷5"Ð !ús%Á2F+ÂBFÄF+ÆF(Æ(F+Æ+F4cóÔ—g}|jr|j|j«|jr|j|j«t|Ž}|j |«S)zÝ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). )rrYrr r )r&ÚreqÚhandlersÚopeners r0rOzPackageIndex.send_requestºsX€ðˆØ × Ò Ø �O‰O˜D×1Ñ1Ô 2Ø × Ò Ø �O‰O˜D×-Ñ-Ô .ܘxÐ(ˆØ�{‰{˜3ÓÐr6c ó—g}|j}|D]^\}}t|ttf«s|g}|D];}|j d|zd|zj d«d|j d«f«Œ=Œ`|D]4\}} } |j d|zd|›d| ›d�j d«d| f«Œ6|j d|zdzdf«dj |«} d |z} | tt| ««d œ} t|j| | «S) a& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--z)Content-Disposition: form-data; name="%s"rUr6z&Content-Disposition: form-data; name="z "; filename="Ú"s smultipart/form-data; boundary=)z Content-typezContent-length) Úboundaryr·r¸r¹rir†rlÚstrr½rr)r&r¬r¡ÚpartsrÒÚkÚvaluesÚvÚkeyrnÚvalueÚbodyÚctrÅs r0rMzPackageIndex.encode_requestÊs€ðˆØ—=‘=ˆÛ‰IˆAˆvܘf¤t¬U mÔ4Ø ˜�ã�Ø— ‘ ؘHÑ$Ø@Øñß™˜w›ØØ—H‘H˜WÓ%ð 'õ(ñð  ó%*Ñ ˆC�˜5Ø �L‰LØ˜Ò â’xð!ß"(¡&¨£/ØØð õ ð%*ð � ‰ �e˜hÑ&¨Ñ.°Ð4Ô5à�|‰|˜EÓ"ˆØ .°Ñ 9ˆàÜ!¤# d£)›nñ ˆô�t—x‘x  wÓ/Ð/r6cóÄ—t|t«rd|i}t|jd¬«} |j ||xsd«|d««S#|d««wxYw)Nr]g@)ÚtimeoutÚandr\)r·r r rÚsearch)r&ÚtermsÚoperatorÚ rpc_proxys r0rßzPackageIndex.searchõs[€Ü �eœ\Ô *ؘU�OˆEÜ §¡°#Ô6ˆ ð !Ø×#Ñ# E¨8Ò+<°uÓ=à ‰I�gÓ Õ øÐ ‰I�gÓ Õ ús ­AÁA)N)NNÚsdistÚsourceN)NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rÒr1r3rrBrArSr`rtr„rˆr£r­r±r³rËrOrMrß©r6r0rrs‚„ñð A€Hóò:ò 3òò 9ò*ò(ó$ó8!,óFð.JNØCGó7*òr*ð:%)óð2#'óó0K8òZ ò )0ôV!r6r)r—Úloggingr!rœr#rjÚ threadingrÚ ImportErrorÚdummy_threadingÚrÚcompatrrrr r r r4r r Ú getLoggerrårZrÚ DEFAULT_REALMÚobjectrrér6r0ÚrósqðóÛÛ Û ÛÛð'Ý õ÷;÷;ç&à ˆ× Ñ ˜8Ó $€à'€ Ø€ ô_!�6õ_!øðò'ß&ð'úsšA Á A.Á-A.