R`i d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
mZ d dlm
Z
mZ d dlmZmZ ej$ e Z G d d e Zd
ededefd
Zy) N)Values)List)Command)ERRORSUCCESS)
FAVORITE_HASH
STRONG_HASHES)read_chunkswrite_outputc : e Zd ZdZdZdZd
dZdedee de
fd Zy)HashCommandz
Compute a hash of a local package archive.
These can be used with --hash in a requirements file to do repeatable
installs.
z%prog [options] ...TreturnNc
| j j dddt dt dj dj t | j j d| j y ) Nz-az--algorithm algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr )cmd_opts
add_optionr r formatjoinparserinsert_option_group)selfs /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/commands/hash.pyadd_optionszHashCommand.add_options s_
!!7>> -( !
''4==9 optionsargsc
|s/| j j t j t S |j
}|D ] }t
d||t || t S )Nz%s:
--hash=%s:%s) r print_usagesysstderrr r r
_hash_of_filer )r r! r" r paths r runzHashCommand.run( sT KK##CJJ/L%% D#T9mD)6T
r )r N)__name__
__module____qualname____doc__usageignore_require_venvr r r strintr) r r r
r
s7
)E:
6
c
s
r r
r( r r c t | d 5 }t j | }t | D ] }|j | ddd |j S # 1 sw Y j S xY w)z!Return the hash digest of a file.rbN)openhashlibnewr
update hexdigest)r( r archivehashchunks r r' r' 5 s`
dD W{{9% )EKK *
>>
>>s 7AA5)r6 loggingr% optparser typingr pip._internal.cli.base_commandr pip._internal.cli.status_codesr r pip._internal.utils.hashesr r pip._internal.utils.miscr
r getLoggerr* loggerr
r0 r' r2 r r rF sY
2 9 C > 8 $#' #L r