U ÀÒ.eþã@s^ddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZmZdd lmZm Z m!Z!dd l"m#Z#ddl$m%Z%e%�rddl&Z&ddl&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.dZ/e 0e1¡Z2ddd„Z3dd„Z4Gdd„de5ƒZ6dd„Z7dd„Z8dS)é)Úabsolute_importN)Ú pkg_resources)Úversion)Ú ensure_binary)Ú LinkCollector)Ú PackageFinder)Ú SearchScope)ÚSelectionPreferences)ÚWINDOWS)Úadjacent_tmp_fileÚcheck_path_ownerÚreplace)Ú ensure_dirÚget_installed_versionÚredact_auth_from_url)Ú get_installer)ÚMYPY_CHECK_RUNNING)ÚValues)ÚAnyÚDictÚTextÚUnion)Ú PipSessionz%Y-%m-%dT%H:%M:%SZFcCs`|jg|j}|jr8|s8t dd dd„|Dƒ¡¡g}|jp@g}tj||d�}t ||d�}|S)z¶ :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. zIgnoring indexes: %sú,css|]}t|ƒVqdS©N)r)Ú.0Zurl©rúE/usr/lib/python3.8/site-packages/pip/_internal/self_outdated_check.pyÚ @sz&make_link_collector..)Ú find_linksÚ index_urls)ÚsessionÚ search_scope) Z index_urlZextra_index_urlsZno_indexÚloggerÚdebugÚjoinrrÚcreater)r!ÚoptionsÚsuppress_no_indexr rr"Úlink_collectorrrrÚmake_link_collector1s  þ ÿ r*cCst|ƒ}t |¡ ¡}|Sr)rÚhashlibZsha224Z hexdigest)ÚkeyZ key_bytesÚnamerrrÚ_get_statefile_namePsr.c@s(eZdZdd„Zedd„ƒZdd„ZdS)ÚSelfCheckStatec Csni|_d|_|rjtj |dt|jƒ¡|_z&t|jƒ�}t  |¡|_W5QRXWnt t t fk rhYnXdS)NZ selfcheck) ÚstateÚstatefile_pathÚosÚpathr%r.r,ÚopenÚjsonÚloadÚIOErrorÚ ValueErrorÚKeyError)ÚselfÚ cache_dirZ statefilerrrÚ__init__Xsÿ zSelfCheckState.__init__cCstjSr)ÚsysÚprefix)r:rrrr,jszSelfCheckState.keyc Cs¦|js dSttj |j¡ƒs dSttj |j¡ƒ|j| t¡|dœ}t j |ddd�}t |jƒ�}|  t |ƒ¡W5QRXzt|j|jƒWntk r YnXdS)N)r,Ú last_checkÚ pypi_versionT)rú:)Z sort_keysZ separators)r1r r2r3Údirnamerr,ÚstrftimeÚSELFCHECK_DATE_FMTr5Údumpsr Úwriterr r-ÚOSError)r:r@Ú current_timer0ÚtextÚfrrrÚsavens û zSelfCheckState.saveN)Ú__name__Ú __module__Ú __qualname__r<Úpropertyr,rKrrrrr/Ws r/cCs6zt |¡}dt|ƒkWStjk r0YdSXdS)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. ÚpipFN)rZget_distributionrZDistributionNotFound)ZpkgZdistrrrÚwas_installed_by_pip’s  rQcCsXtdƒ}|sdSt |¡}d}�zt|jd�}tj ¡}d|jkrzd|jkrztj |jdt ¡}||  ¡dkrz|jd}|dkrÚt ||dd�}t d d d �} t j|| d �} |  d¡j} | dkrÄWdSt| jƒ}| ||¡t |¡} || koþ|j| jkoþtdƒ} | �s WdSt�rd }nd}t d |||¡Wn$tk �rRtjddd�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. rPN)r;r?r@i€: T)r'r(F)Z allow_yankedZallow_all_prereleases)r)Úselection_prefsz python -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)rÚpackaging_versionÚparser/r;ÚdatetimeZutcnowr0ÚstrptimerDZ total_secondsr*r rr&Zfind_best_candidateÚbest_candidateÚstrrrKZ base_versionrQr r#ZwarningÚ Exceptionr$)r!r'Zinstalled_versionZ pip_versionr@r0rHr?r)rRÚfinderrXZremote_versionZlocal_version_is_olderZpip_cmdrrrÚpip_self_version_check sp   þ ýþþ     ÿýüþr\)F)9Z __future__rrVr+r5ZloggingZos.pathr2r=Z pip._vendorrZpip._vendor.packagingrrTZpip._vendor.sixrZpip._internal.collectorrZpip._internal.indexrZ!pip._internal.models.search_scoperZ$pip._internal.models.selection_prefsr Zpip._internal.utils.compatr Zpip._internal.utils.filesystemr r r Zpip._internal.utils.miscrrrZpip._internal.utils.packagingrZpip._internal.utils.typingrZoptparserÚtypingrrrrZpip._internal.network.sessionrrDZ getLoggerrLr#r*r.Úobjectr/rQr\rrrrÚs>              ý ;