U n aI@sRddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZmZmZdd lmZmZmZdd l m!Z!dd l"m#Z#e#rddl$Z$ddl$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,dZ-e.e/Z0dddZ1ddZ2Gddde3Z4ddZ5ddZ6dS))absolute_importN) pkg_resources)version) ensure_binary) LinkCollector) PackageFinder) SearchScope)SelectionPreferences)adjacent_tmp_filecheck_path_ownerreplace) ensure_dirget_installed_versionredact_auth_from_url) get_installer)MYPY_CHECK_RUNNING)Values)AnyDictTextUnion) PipSessionz%Y-%m-%dT%H:%M:%SZFcCs`|jg|j}|jr8|s8tdddd|Dg}|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|VqdSN)r).0urlrbC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\self_outdated_check.py ?sz&make_link_collector..) find_links index_urls)session search_scope) index_urlextra_index_urlsno_indexloggerdebugjoinrrcreater)r!optionssuppress_no_indexr rr"link_collectorrrrmake_link_collector0s    r-cCst|}t|}|Sr)rhashlibsha224 hexdigest)key key_bytesnamerrr_get_statefile_nameOsr4c@s(eZdZddZeddZddZdS)SelfCheckStatec Csni|_d|_|rjtj|dt|j|_z&t|j}t ||_W5QRXWnt t t fk rhYnXdS)N selfcheck) statestatefile_pathospathr(r4r1openjsonloadIOError ValueErrorKeyError)self cache_dir statefilerrr__init__Ws zSelfCheckState.__init__cCstjSr)sysprefix)rArrrr1iszSelfCheckState.keyc Cs|js dSttj|js dSttj|j|j|t|d}t j |ddd}t |j}| t |W5QRXzt|j|jWntk rYnXdS)N)r1 last_check pypi_versionT)r:) sort_keys separators)r8r r9r:dirnamer r1strftimeSELFCHECK_DATE_FMTr<dumpsr writerr r3OSError)rArH current_timer7textfrrrsavems  zSelfCheckState.saveN)__name__ __module__ __qualname__rDpropertyr1rUrrrrr5Vs r5cCs6zt|}dt|kWStjk r0YdSXdS)zChecks 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)rget_distributionrDistributionNotFound)pkgdistrrrwas_installed_by_pips  r_cCsTtd}|sdSt|}d}z t|jd}tj}d|jkrzd|jkrztj|jdt }|| dkrz|jd}|dkrt ||dd}t d d d } t j|| d } | dj} | dkrWdSt| j}|||t|} || ko|j| jkotd} | s WdSd tj}td |||Wn$tk rNtjdddYnXdS)zCheck 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. rZN)rBrGrHi: T)r*r+F) allow_yankedallow_all_prereleases)r,selection_prefsz {} -m pipzYou 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)rpackaging_versionparser5rBdatetimeutcnowr7strptimerN total_secondsr-r rr)find_best_candidatebest_candidatestrrrU base_versionr_formatrE executabler&warning Exceptionr')r!r*installed_version pip_versionrHr7rRrGr,rbfinderrkremote_versionlocal_version_is_olderpip_cmdrrrpip_self_version_checksl          rx)F)7 __future__rrfr.r<loggingos.pathr9rE pip._vendorrZpip._vendor.packagingrrdZpip._vendor.sixrpip._internal.index.collectorr"pip._internal.index.package_finderr!pip._internal.models.search_scoper$pip._internal.models.selection_prefsr pip._internal.utils.filesystemr r r pip._internal.utils.miscr rrpip._internal.utils.packagingrpip._internal.utils.typingroptparsertypingrrrrpip._internal.network.sessionrrN getLoggerrVr&r-r4objectr5r_rxrrrrs<              ;