3 ”Re{ã@s"ddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlmZddlmZddlmZddlmZmZmZdd lmZmZmZdd lmZdd lmZerèddl Z dd l!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'dZ(ej)e*ƒZ+dd„Z,Gdd„de-ƒZ.dd„Z/dd„Z0dS)é)Úabsolute_importN)Úversion)Ú ensure_binary)Ú LinkCollector)Ú PackageFinder)ÚSelectionPreferences)Úadjacent_tmp_fileÚcheck_path_ownerÚreplace)Ú ensure_dirÚget_distributionÚget_installed_version)Ú get_installer)ÚMYPY_CHECK_RUNNING)ÚAnyÚDictÚTextÚUnion)Ú PipSessionz%Y-%m-%dT%H:%M:%SZcCst|ƒ}tj|ƒjƒ}|S)N)rÚhashlibÚsha224Ú hexdigest)ÚkeyÚ key_bytesÚname©rú�/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/self_outdated_check.pyÚ_get_statefile_name*src@s(eZdZdd„Zedd„ƒZdd„ZdS)ÚSelfCheckStatecCsni|_d|_|rjtjj|dt|jƒƒ|_y&t|jƒ�}tj |ƒ|_WdQRXWnt t t fk rhYnXdS)NÚ selfcheck) ÚstateÚstatefile_pathÚosÚpathÚjoinrrÚopenÚjsonÚloadÚIOErrorÚ ValueErrorÚKeyError)ÚselfÚ cache_dirÚ statefilerrrÚ__init__2s zSelfCheckState.__init__cCstjS)N)ÚsysÚprefix)r+rrrrDszSelfCheckState.keycCs¦|js dSttjj|jƒƒs dSttjj|jƒƒ|j|jtƒ|dœ}t j |ddd�}t |jƒ�}|j t |ƒƒWdQRXyt|j|jƒWntk r YnXdS)N)rÚ last_checkÚ pypi_versionTú,ú:)Ú sort_keysÚ separators)r3r4)r!r r"r#Údirnamer rÚstrftimeÚSELFCHECK_DATE_FMTr&ÚdumpsrÚwriterr rÚOSError)r+r2Ú current_timer ÚtextÚfrrrÚsaveIs zSelfCheckState.saveN)Ú__name__Ú __module__Ú __qualname__r.Úpropertyrr@rrrrr1s rcCst|ƒ}|sdSdt|ƒkS)zµChecks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. FÚpip)r r)ÚpkgÚdistrrrÚwas_installed_by_pipmsrHc CsVtdƒ}|sdStj|ƒ}d}�y t|jd�}tjjƒ}d|jkrzd|jkrztjj|jdt ƒ}||j ƒdkrz|jd}|dkrÚt j ||d d �}t d d d �} tj || d �} | jdƒj} | dkrÄdSt| jƒ}|j||ƒtj|ƒ} || k�o|j| jk�otdƒ} | �sdSdjtjƒ}tjd|||ƒWn$tk �rPtjdd d�YnXdS)zÛCheck for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. rEN)r,r1r2ééé<T)ÚoptionsÚsuppress_no_indexF)Ú allow_yankedÚallow_all_prereleases)Úlink_collectorÚselection_prefsz {} -m pipz‰You are using pip version %s; however, version %s is available. You should consider upgrading via the '%s install --upgrade pip' command.z5There was an error checking the latest version of pip)Úexc_infoé¨i`'i€: )r Úpackaging_versionÚparserr,ÚdatetimeÚutcnowr Ústrptimer9Ú total_secondsrÚcreaterrÚfind_best_candidateÚbest_candidateÚstrrr@Ú base_versionrHÚformatr/Ú executableÚloggerÚwarningÚ ExceptionÚdebug)ÚsessionrLÚinstalled_versionÚ pip_versionr2r r=r1rPrQÚfinderr\Úremote_versionÚlocal_version_is_olderÚpip_cmdrrrÚpip_self_version_checkzsX          rl)1Ú __future__rrVrr&ÚloggingÚos.pathr"r/Zpip._vendor.packagingrrTZpip._vendor.sixrÚpip._internal.index.collectorrÚ"pip._internal.index.package_finderrÚ$pip._internal.models.selection_prefsrÚpip._internal.utils.filesystemrr r Úpip._internal.utils.miscr r r Úpip._internal.utils.packagingrÚpip._internal.utils.typingrÚoptparseÚtypingrrrrÚpip._internal.network.sessionrr9Ú getLoggerrArarÚobjectrrHrlrrrrÚs2          <