Your IP : 216.73.217.129
B
� f{ � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ dZ ee
�jjjd Zed Z
ed jd d
�Ze�d�dkZeedd
�dd�Zeedd
�dd�Zeed�dd�Zedkr�dZxe D ]Zee�s�dZq�W ee��dS )a
Compare checksums for wheels in :mod:`ensurepip` against the Cheeseshop.
When GitHub Actions executes the script, output is formatted accordingly.
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message
� N)�Path)�urlopen)ZpipZ
setuptoolsz
Lib/ensurepipZ_bundledz__init__.pyzutf-8)�encoding�GITHUB_ACTIONS�true)� file_path�message�returnc C s$ t rd| � d|� �}t|dd� d S )Nz::notice file=z::z
)�end)r �print)r r � r �J/opt/alt/python37/lib64/python3.7/Tools/scripts/verify_ensurepip_wheels.py�print_notice s r c C s$ t rd| � d|� �}t|dd� d S )Nz
::error file=z::z
)r
)r r )r r r r r
�print_error s r )�package_namer c C sz t t�| � d��d �}|s0tdd| � d�� dS td|� d�� t�d| �� � d �t�}|srt|d
| � d�� dS |d }yt d
| � d���
� }W n* ttfk
r� t|d| � d�� dS X t
�|�d | }xD|D ]&}|j|d kr�q�|d �dd�}P q�W t|d| � d�� dS t�|�� ��� }td|� �� td|� �� ||k�rdt|d| � d�� dS t|d| � d�� dS )Nz*.whl� zCould not find a z wheel on disk.FzVerifying checksum for �.�_z_VERSION = "([^"]+)zNo z, version found in Lib/ensurepip/__init__.py.� zhttps://pypi.org/pypi/z/jsonz"Could not fetch JSON metadata for Zreleases�filenameZdigests�sha256zNo digest for z found from PyPI.zExpected digest: zActual digest: z%Failed to verify the checksum of the z wheel.z*Successfully verified the checksum of the T)�next� WHEEL_DIRZglobr r �re�search�upper�ENSURE_PIP_INIT_PY_TEXTr �read�OSError�
ValueError�json�loads�name�get�hashlibr Z
read_bytesZ hexdigestr ) r Zpackage_pathZpackage_version_matchZpackage_versionZraw_textZ
release_filesZrelease_infoZexpected_digestZ
actual_digestr r r
�verify_wheel$ sJ
r% �__main__r )�__doc__r$ r �osr Zpathlibr Zurllib.requestr Z
PACKAGE_NAMES�__file__�parentZENSURE_PIP_ROOTr Z read_textr �getenvr �strr r �boolr% �__name__Zexit_statusr �
SystemExitr r r r
�<module> s( 9