AlkantarClanX12

Your IP : 3.12.73.149


Current Path : /lib/python3.6/site-packages/pip/utils/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/pip/utils/__pycache__/outdated.cpython-36.pyc

3

�Pfe�@s�ddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZmZddlmZddlmZmZddlmZmZdd	lmZd
Zeje�ZGdd�de�ZGd
d�de�Z dd�Z!dd�Z"dd�Z#dS)�)�absolute_importN)�lockfile)�version)�
total_seconds�WINDOWS)�PyPI)�USER_CACHE_DIR�running_under_virtualenv)�
ensure_dir�get_installed_version)�check_path_ownerz%Y-%m-%dT%H:%M:%SZc@seZdZdd�Zdd�ZdS)�VirtualenvSelfCheckStatecCs\tjjtjd�|_y&t|j��}tj|�|_	WdQRXWnt
tfk
rVi|_	YnXdS)Nzpip-selfcheck.json)�os�path�join�sys�prefix�statefile_path�open�json�load�state�IOError�
ValueError)�self�	statefile�r�/usr/lib/python3.6/outdated.py�__init__sz!VirtualenvSelfCheckState.__init__c
Cs:t|jd��$}tj|jt�|d�|ddd�WdQRXdS)N�w)�
last_check�pypi_versionT�,�:)�	sort_keys�
separators)r"r#)rrr�dump�strftime�SELFCHECK_DATE_FMT)rr!�current_timerrrr�save$szVirtualenvSelfCheckState.saveN)�__name__�
__module__�__qualname__rr*rrrrr
s
r
c@seZdZdd�Zdd�ZdS)�GlobalSelfCheckStatecCsbtjjtd�|_y,t|j��}tj|�tj	|_
WdQRXWn ttt
fk
r\i|_
YnXdS)Nzselfcheck.json)rrrrrrrrrrrrr�KeyError)rrrrrr3s zGlobalSelfCheckState.__init__cCs�ttjj|j��sdSttjj|j��tj|j��ztjj|j�rft	|j��}t
j|�}WdQRXni}|jt
�|d�|tj<t	|jd��}t
j||ddd�WdQRXWdQRXdS)N)r r!rTr"r#)r$r%)r"r#)rrr�dirnamerr
rZLockFile�existsrrrr'r(rrr&)rr!r)rrrrrr*=s
zGlobalSelfCheckState.saveN)r+r,r-rr*rrrrr.2s
r.cCst�rt�St�SdS)N)r	r
r.rrrr�load_selfcheck_statefileXsr2cCsFddl}y"|jd�}|jd�o*d|jd�kS|jk
r@dSXdS)z�Checks whether pip 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.
    rN�pipZ	INSTALLERF)�
pkg_resourcesZget_distributionZhas_metadataZget_metadata_linesZDistributionNotFound)r4Zdistrrr�pip_installed_by_pip_s

r5c
CsFtd�}|dkrdStj|�}d}�y�t�}tjj�}d|jkrxd|jkrxtjj|jdt�}t	||�dkrx|jd}|dkr�|j
tjdd	id
�}|j
�dd�tt|j�d
�tjd�D�d}|j||�tj|�}||k�r|j|jk�rt��rt�rd}	nd}	tjd|||	�Wn$tk
�r@tjddd�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.
    r3Nr r!���<ZAcceptzapplication/json)ZheaderscSsg|]}tj|�js|�qSr)�packaging_version�parseZ
is_prerelease)�.0�vrrr�
<listcomp>�sz%pip_version_check.<locals>.<listcomp>Zreleases)�key�z
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 pipT)�exc_info�i`'i�:	���)rr9r:r2�datetimeZutcnowrZstrptimer(r�getrZpip_json_urlZraise_for_status�sorted�listrr*Zbase_versionr5r�loggerZwarning�	Exception�debug)
ZsessionZinstalled_versionZpip_versionr!rr)r ZrespZremote_versionZpip_cmdrrr�pip_version_checknsL




rJ)$Z
__future__rrCrZloggingZos.pathrrZpip._vendorrZpip._vendor.packagingrr9Z
pip.compatrrZ
pip.modelsrZ
pip.locationsrr	Z	pip.utilsr
rZpip.utils.filesystemrr(Z	getLoggerr+rG�objectr
r.r2r5rJrrrr�<module>s&
&