3 ”Reˆƒã@sDddlmZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z ddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZdd lmZ ddl!m"Z#ddl$m%Z%ddl$m&Z'ddl(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?m@Z@mAZAddlBmCZCddlDmEZEmFZFddlGmHZHddlImJZJddlKmLZLeH�rddlMmNZNmOZOmPZPmQZQmRZRmSZSmTZTddlmUZUdd lVmWZWdd!lXmYZYdd"lZm[Z[ej\e]ƒZ^d#d$„Z_Gd%d&„d&e`ƒZad'd(„ZbdS))é)Úabsolute_importN)Ú pkg_resourcesÚsix)Ú Requirement)Úcanonicalize_name)ÚVersion)Úparse)ÚPep517HookCaller)ÚNoOpBuildEnvironment)ÚInstallationError)Ú get_scheme)ÚLink)Úgenerate_metadata)Úinstall_editable)ÚLegacyInstallFailure)Úinstall)Ú install_wheel)Úload_pyproject_tomlÚmake_pyproject_path)ÚUninstallPathSet)Ú deprecated)Údirect_url_from_link)ÚHashes)Ú indent_log) Úask_path_existsÚ backup_dirÚ display_pathÚdist_in_install_pathÚdist_in_site_packagesÚdist_in_usersiteÚget_distributionÚget_installed_versionÚhide_urlÚredact_auth_from_url)Ú get_metadata)Ú TempDirectoryÚ tempdir_kinds)ÚMYPY_CHECK_RUNNING)Úrunning_under_virtualenv)Úvcs)ÚAnyÚDictÚIterableÚListÚOptionalÚSequenceÚUnion)ÚBuildEnvironment)Ú Distribution)Ú SpecifierSet)ÚMarkercCs†|jtjƒ}tjj|ƒ\}}tj||ƒ}|jdƒrJtj}tjj |ƒd}n.|jdƒsXt ‚tj }tjj |ƒdjdƒd}||||d�S)zQReturn a pkg_resources.Distribution for the provided metadata directory. z .egg-inforz .dist-infoú-)Ú project_nameÚmetadata) ÚrstripÚosÚsepÚpathÚsplitrÚ PathMetadataÚendswithr2ÚsplitextÚAssertionErrorÚDistInfoDistribution)Úmetadata_directoryÚdist_dirÚbase_dirÚ dist_dir_namer7Údist_clsÚ dist_name©rHúŒ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/req/req_install.pyÚ _get_distEs   rJc @s\eZdZdZdddddddddfdf dd„Zdd„Zdd „Zd d „Zed d „ƒZ edd„ƒZ edd„ƒZ edd„ƒZ dEdd„Z edd„ƒZdFdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zed%d&„ƒZed'd(„ƒZed)d*„ƒZed+d,„ƒZd-d.„Zd/d0„Zd1d2„Zed3d4„ƒZd5d6„Zd7d8„ZdGd9d:„ZdHd;d<„Z dId=d>„Z!d?d@„Z"dAdB„Z#dJdCdD„Z$dS)KÚInstallRequirementzÆ Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. FNcCs„|dkst|tƒst|ƒ‚||_||_| |_||_d|_d|_|jrj|sLt‚|j rjt j j t j j |jƒƒ|_|dkr†|r†|jr†t|jƒ}||_|_d|_d|_|jr¶|jj r¶|jj|_| rÂ| |_n |rÚdd„|jDƒ|_ntƒ|_|dkrô|rô|j}||_d|_d|_d|_d|_|�r|ng|_| �r,| ng|_| �r<| ni|_d|_ | |_!d|_"||_#t$ƒ|_%d|_&d|_'g|_(d|_)||_*dS)NFcSsh|]}tj|ƒ’qSrH)rÚ safe_extra)Ú.0ÚextrarHrHrIú šsz.InstallRequirement.__init__..)+Ú isinstancerr@ÚreqÚ comes_fromÚ constraintÚeditableÚlegacy_install_reasonÚ source_dirÚis_filer9r;ÚnormpathÚabspathÚ file_pathÚurlr ÚlinkÚ original_linkÚoriginal_link_is_in_wheel_cacheÚlocal_file_pathÚextrasÚsetÚmarkerÚmarkersÚ satisfied_byÚshould_reinstallÚ_temp_build_dirÚinstall_succeededÚinstall_optionsÚglobal_optionsÚ hash_optionsÚpreparedÚ user_suppliedÚsuccessfully_downloadedÚisolatedr Ú build_envrBÚpyproject_requiresÚrequirements_to_checkÚpep517_backendÚ use_pep517)ÚselfrQrRrTr\rcrsrnrhrirjrSr`rlrHrHrIÚ__init__gsZ     zInstallRequirement.__init__cCs¢|jr.t|jƒ}|jrF|djt|jjƒƒ7}n|jrBt|jjƒ}nd}|jdk rf|djt|jjƒƒ7}|j ržt |j t j ƒr‚|j }n |j j ƒ}|rž|dj|ƒ7}|S)Nz from {}zz in {}z (from {}))rQÚstrr\Úformatr#r[rdrÚlocationrRrPrÚ string_typesÚ from_path)rtÚsrRrHrHrIÚ__str__Ús    zInstallRequirement.__str__cCsdj|jjt|ƒ|jƒS)Nz<{} object: {} editable={!r}>)rwÚ __class__Ú__name__rvrT)rtrHrHrIÚ__repr__ïszInstallRequirement.__repr__cs>t|ƒ‰tˆƒ}‡fdd„t|ƒDƒ}dj|jjdj|ƒd�S)z>An un-tested helper for getting state, for debugging. c3s|]}dj|ˆ|ƒVqdS)z{}={!r}N)rw)rMÚattr)Ú attributesrHrIú üsz2InstallRequirement.format_debug..z<{name} object: {{{state}}}>z, )ÚnameÚstate)ÚvarsÚsortedrwr}r~Újoin)rtÚnamesr„rH)r�rIÚ format_debugôs zInstallRequirement.format_debugcCs"|jdkrdStjtj|jjƒƒS)N)rQrÚ ensure_strrÚ safe_namerƒ)rtrHrHrIrƒs zInstallRequirement.namecCs|jjS)N)rQÚ specifier)rtrHrHrIrŒ szInstallRequirement.specifiercCs$|j}t|ƒdko"tt|ƒƒjdkS)z„Return whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. éú==ú===>r�rŽ)rŒÚlenÚnextÚiterÚoperator)rtÚ specifiersrHrHrIÚ is_pinneds zInstallRequirement.is_pinnedcCs t|jƒS)N)r!rƒ)rtrHrHrIÚinstalled_versionsz$InstallRequirement.installed_versioncs0|sd}ˆjdk r(t‡fdd„|DƒƒSdSdS)NÚc3s|]}ˆjjd|iƒVqdS)rNN)rcÚevaluate)rMrN)rtrHrIr‚(sz3InstallRequirement.match_markers..T)r—)rcÚany)rtÚextras_requestedrH)rtrIÚ match_markers s   z InstallRequirement.match_markerscCs t|jƒS)z©Return whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. )Úboolrj)rtrHrHrIÚhas_hash_options-s z#InstallRequirement.has_hash_optionsTcCsB|jjƒ}|r|jn|j}|r:|jr:|j|jgƒj|jƒt|ƒS)a§Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() ) rjÚcopyr\r]ÚhashÚ setdefaultÚ hash_nameÚappendr)rtÚtrust_internetÚ good_hashesr\rHrHrIÚhashes8s   zInstallRequirement.hashescCsR|jdkrdSt|jƒ}|jrNt|jtjƒr4|j}n |jjƒ}|rN|d|7}|S)z@Format a nice indicator to show where this "comes from" Nz->)rQrvrRrPrryrz)rtr{rRrHrHrIrzNs    zInstallRequirement.from_pathcCs¼|dk s t‚|jdk r*|jjs"t‚|jjS|jdkrLttjdd�|_|jjSt|jƒ}|rldj |t j ƒj ƒ}t jj|ƒsŽtjd|ƒt j|ƒt jj||ƒ}|r¤dnd}t||tjdd�jS)NT)ÚkindÚglobally_managedz{}_{}zCreating directory %sF)r;Údeleter¦r§)r@rfr;rQr%r&Ú REQ_BUILDrrƒrwÚuuidÚuuid4Úhexr9ÚexistsÚloggerÚdebugÚmakedirsr‡)rtÚ build_dirÚ autodeleteÚparallel_buildsÚdir_nameÚactual_build_dirÚ delete_argrHrHrIÚensure_build_location^s*         z(InstallRequirement.ensure_build_locationcCsn|jdkst‚|jdk st‚|jdk s*t‚tt|jdƒtƒrDd}nd}tdj|jd||jdgƒƒ|_dS)z3Set requirement after generating metadata. Nrz==z===r—ÚName) rQr@r7rVrPÚ parse_versionrrr‡)rtÚoprHrHrIÚ_set_requirement„sz#InstallRequirement._set_requirementcCsDt|jdƒ}t|jjƒ|kr"dStjd|j||jƒt|ƒ|_dS)Nr¸zeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)rr7rQrƒr®Úwarningr)rtÚ metadata_namerHrHrIÚwarn_on_mismatching_namešsz+InstallRequirement.warn_on_mismatching_namecCs¦|jdkrdSt|jjƒ}|s"dS|j}|jjj|dd�sˆd|_|rxt|ƒrTd|_q†t ƒr†t |ƒr†t dj |j |jƒƒ‚q¢t|ƒr¢d|_n|jrœd|_d|_n||_dS)z¬Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. NT)Ú prereleaseszVWill not install to the user site because it will lack sys.path precedence to {} in {})rQr rƒÚparsed_versionrŒÚcontainsrdrrer(rr rwr6rxrrT)rtÚ use_user_siteÚ existing_distÚexisting_versionrHrHrIÚcheck_if_existsªs,  z"InstallRequirement.check_if_existscCs|js dS|jjS)NF)r\Úis_wheel)rtrHrHrIrÆÏszInstallRequirement.is_wheelcCstjj|j|jr|jjpdƒS)Nr—)r9r;r‡rVr\Úsubdirectory_fragment)rtrHrHrIÚunpacked_source_directory×sz,InstallRequirement.unpacked_source_directorycCsH|jstdj|ƒƒ‚tjj|jdƒ}tjrDt |tj ƒrD|j t j ƒƒ}|S)NzNo source dir for {}zsetup.py)rVr@rwr9r;r‡rÈrÚPY2rPÚ text_typeÚencodeÚsysÚgetfilesystemencoding)rtÚsetup_pyrHrHrIÚ setup_py_pathÞs z InstallRequirement.setup_py_pathcCs|jstdj|ƒƒ‚t|jƒS)NzNo source dir for {})rVr@rwrrÈ)rtrHrHrIÚpyproject_toml_pathêsz&InstallRequirement.pyproject_toml_pathcCs^t|j|j|jt|ƒƒ}|dkr*d|_dSd|_|\}}}}||_||_t|j||d�|_ dS)aALoad the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. NFT)Ú backend_path) rrsrÐrÏrvrqrpr rÈrr)rtÚpyproject_toml_dataÚrequiresÚbackendÚcheckrÑrHrHrIrðs   z&InstallRequirement.load_pyproject_tomlcCsV|js8|jst‚t|j|j|j|j|jp2dj|j ƒd�S|j dk sFt‚t |j|j d�S)zKInvokes metadata generator functions, with the required arguments. zfrom {})rorÏrVrnÚdetailsN)rorÔ) rsrÈr@Úgenerate_metadata_legacyrorÏrnrƒrwr\rrr)rtrHrHrIÚ_generate_metadata s z%InstallRequirement._generate_metadatac CsJ|js t‚tƒ�|jƒ|_WdQRX|js6|jƒn|jƒ|jƒdS)z³Ensure that project metadata is available. Under PEP 517, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. N) rVr@rrØrBrƒr»r¾Úassert_source_matches_version)rtrHrHrIÚprepare_metadata"s  z#InstallRequirement.prepare_metadatacCst|dƒst|jƒƒ|_|jS)NÚ _metadata)Úhasattrr$Úget_distrÛ)rtrHrHrIr76s zInstallRequirement.metadatacCs t|jƒS)N)rJrB)rtrHrHrIrÝ>szInstallRequirement.get_distcCsR|js t‚|jd}|jjr8||jjkr8tjd||ƒntjdt|jƒ||ƒdS)NÚversionz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s) rVr@r7rQrŒr®r¼r¯r)rtrÞrHrHrIrÙBs  z0InstallRequirement.assert_source_matches_versioncCs |jdkr|j|||d�|_dS)aAEnsure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir N)r²r³)rVr·)rtÚ parent_dirr²r³rHrHrIÚensure_has_source_dirUs  z(InstallRequirement.ensure_has_source_dircCs|jstjd|jƒdS|js"t‚|js,t‚|jjdkrCannot update repository at %s; repository location is unknownÚfileú+zbad url: {self.link.url!r}r�z5This form of VCS requirement is being deprecated: {}.zgit+git@zmgit+https://git@example.com/..., git+ssh://git@example.com/..., or the insecure git+git://git@example.com/...z21.0i‚)Úgone_inÚissue)r[rz+Unexpected version control type (in {}): {})r\r®r¯rVrTr@Úschemer[rwÚlocalsr<r)Ú get_backendÚis_vcsÚ startswithrr"ÚobtainÚexport)rtrêÚvc_typer[Ú vcs_backendÚreasonÚ replacementÚ hidden_urlrHrHrIÚupdate_editablems8      z"InstallRequirement.update_editablecCsR|js t‚t|jjƒ}|s,tjd|jƒdStjd|ƒtj|ƒ}|j ||ƒ|S)a¥ Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. z#Skipping %s as it is not installed.NzFound existing installation: %s) rQr@r rƒr®r¼ÚinforÚ from_distÚremove)rtÚ auto_confirmÚverboseÚdistÚuninstalled_pathsetrHrHrIÚ uninstall™s     zInstallRequirement.uninstallcCs.dd„}tjj||ƒ}|||ƒ}|jd|S)NcSsL|j|tjjƒs$tdjftƒŽƒ‚|t|ƒdd…}|jtjjdƒ}|S)Nz2name {name!r} doesn't start with prefix {prefix!r}r�ú/) rér9r;r:r@rwrær�Úreplace)rƒÚprefixrHrHrIÚ_clean_zip_nameµs  z=InstallRequirement._get_archive_name.._clean_zip_namerú)r9r;r‡rƒ)rtr;Ú parentdirÚrootdirrýrƒrHrHrIÚ_get_archive_name²s  z$InstallRequirement._get_archive_namecCs´|js t‚d}dj|j|jdƒ}tjj||ƒ}tjj|ƒrÈt djt |ƒƒdƒ}|dkr^d }nj|dkr‚t j d t |ƒƒtj |ƒnF|dkr¶t|ƒ}t j d t |ƒt |ƒƒtj||ƒn|dkrÈtjdƒ|sÐd Stj|dtjdd�}|�²tjjtjj|jƒƒ}x”tj|ƒD]†\} } } x>| D]6} |j| | |d�} tj| dƒ}d|_|j|dƒ�qWx8| D]0}|j|| |d�}tjj| |ƒ}|j||ƒ�q\W�q WWd QRXt jdt |ƒƒd S)z}Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. Tz {}-{}.ziprÞz8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort ÚiÚwÚbÚaFz Deleting %szBacking up %s to %sr�N)Ú allowZip64)rþrÿrúiíér—zSaved %s)rrrréÿÿÿÿií) rVr@rwrƒr7r9r;r‡r­rrr®r¼rôrÚshutilÚmoverÌÚexitÚzipfileÚZipFileÚ ZIP_DEFLATEDÚnormcaserYrÈÚwalkrÚZipInfoÚ external_attrÚwritestrÚwriterò)rtr±Úcreate_archiveÚ archive_nameÚ archive_pathÚresponseÚ dest_fileÚ zip_outputÚdirÚdirpathÚdirnamesÚ filenamesÚdirnameÚ dir_arcnameÚzipdirÚfilenameÚ file_arcnamerHrHrIÚarchiveÃsV         "zInstallRequirement.archivec Cs”t|j||||j|d�} |dk r$|ng}|jr^t||||||j|j|j|j|jd� d|_dS|j r¸|j snt ‚d} |j rŠt |j |j|jƒ} t|j|j | t|jƒ||| |jd�d|_dSt|ƒ|j}t|ƒ|j}y8t|||||||| |j|j|j|j|jt|jƒd�} WnRtk �rB} zd|_tj| jŽWYdd} ~ Xntk �r^d|_‚YnX| |_| �r�|jdk�r�tdj|jƒd d dd �dS) N)ÚuserÚhomeÚrootrnrü)rür%rÂrƒrÏrnrorÈT)råÚreq_descriptionÚ pycompileÚwarn_script_locationÚ direct_urlÚ requested)rhrir&r%rürÂr(rårÏrnÚreq_namerorÈr'Fi° zg{} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.z+to fix the wheel build issue reported abovez21.0)rîrïrãrä) r rƒrnrTÚinstall_editable_legacyrÏrorÈrgrÆr_r@r]rrVr^rrvrQrlÚlistrirhÚinstall_legacyrrÚreraiseÚparentÚ ExceptionrUrrw) rtrhrir&r%rür)rÂr(rår*ÚsuccessÚexcrHrHrIrs’     zInstallRequirement.install)N)T)FF)T)FF)NNNNTFT)%r~Ú __module__Ú __qualname__Ú__doc__rur|rr‰ÚpropertyrƒrŒr•r–r›r�r¥rzr·r»r¾rÅrÆrÈrÏrÐrrØrÚr7rÝrÙràrñrùrr#rrHrHrHrIrK`sd e    &%      , @rKcCs>d}|jsd}n|jrd}n |jr&d}|r:tddddd�|S) Nr—z3Unnamed requirements are not allowed as constraintsz$Links are not allowed as constraintszConstraints cannot have extrasaConstraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms.z,replacing the constraint with a requirement.i )rîrïrãrä)rƒr\r`r)rQÚproblemrHrHrIÚcheck_invalid_constraint_typemsr:)cÚ __future__rÚloggingr9rrÌrªr Ú pip._vendorrrZ"pip._vendor.packaging.requirementsrZpip._vendor.packaging.utilsrÚpip._vendor.packaging.versionrrr¹Úpip._vendor.pep517.wrappersr Úpip._internal.build_envr Úpip._internal.exceptionsr Úpip._internal.locationsr Úpip._internal.models.linkr Ú'pip._internal.operations.build.metadatarÚ.pip._internal.operations.build.metadata_legacyr×Ú0pip._internal.operations.install.editable_legacyrr-Ú'pip._internal.operations.install.legacyrrr/Ú&pip._internal.operations.install.wheelrÚpip._internal.pyprojectrrÚpip._internal.req.req_uninstallrÚpip._internal.utils.deprecationrÚ&pip._internal.utils.direct_url_helpersrÚpip._internal.utils.hashesrÚpip._internal.utils.loggingrÚpip._internal.utils.miscrrrrrrr r!r"r#Úpip._internal.utils.packagingr$Úpip._internal.utils.temp_dirr%r&Úpip._internal.utils.typingr'Úpip._internal.utils.virtualenvr(Úpip._internal.vcsr)Útypingr*r+r,r-r.r/r0r1Zpip._vendor.pkg_resourcesr2Z pip._vendor.packaging.specifiersr3Zpip._vendor.packaging.markersr4Ú getLoggerr~r®rJÚobjectrKr:rHrHrHrIÚsd                     0    $