3 ”Re3ã@s®ddlmZddlZddlZddlZddlmZddlmZm Z ddl m Z m Z ddl mZmZddlmZerˆddlmZdd lmZejeƒZGd d „d eƒZd d „ZdS)é)Úabsolute_importN)ÚCommand)ÚERRORÚSUCCESS)Ú FAVORITE_HASHÚ STRONG_HASHES)Ú read_chunksÚ write_output)ÚMYPY_CHECK_RUNNING)ÚValues)ÚListc@s(eZdZdZdZdZdd„Zdd„ZdS) Ú 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] ...Tc Cs:|jjdddtdtdjdjtƒƒd�|jjd|jƒdS) Nz-az --algorithmÚ algorithmÚstorez$The hash algorithm to use: one of {}z, )ÚdestÚchoicesÚactionÚdefaultÚhelpr)Úcmd_optsÚ add_optionrrÚformatÚjoinÚparserÚinsert_option_group)Úself©rúŠ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/commands/hash.pyÚ add_optionsszHashCommand.add_optionscCsB|s|jjtjƒtS|j}x |D]}td||t||ƒƒq"WtS)Nz%s: --hash=%s:%s) rÚ print_usageÚsysÚstderrrrr Ú _hash_of_filer)rÚoptionsÚargsrÚpathrrrÚrun+s zHashCommand.runN)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚusageÚignore_require_venvrr&rrrrr s  r c CsDt|dƒ�,}tj|ƒ}xt|ƒD]}|j|ƒq WWdQRX|jƒS)z!Return the hash digest of a file.ÚrbN)ÚopenÚhashlibÚnewrÚupdateÚ hexdigest)r%rÚarchiveÚhashÚchunkrrrr"8s   r")Ú __future__rr/Úloggingr Úpip._internal.cli.base_commandrÚpip._internal.cli.status_codesrrÚpip._internal.utils.hashesrrÚpip._internal.utils.miscrr Úpip._internal.utils.typingr Úoptparser Útypingr Ú getLoggerr'Úloggerr r"rrrrÚs      $