3 Bu_3@sddlmZddlZddlZddlZddlmZddlmZm Z ddl m Z m Z ddl mZmZddlmZerddlmZdd lmZejeZGd d d eZd d ZdS))absolute_importN)Command)ERRORSUCCESS) FAVORITE_HASH STRONG_HASHES) read_chunks write_output)MYPY_CHECK_RUNNING)Values)Listc@s(eZdZdZdZdZddZddZdS) 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:|jjdddtdtdjdjtd|jjd|jdS) Nz-az --algorithm algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr)cmd_opts add_optionrrformatjoinparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-1.el7.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/commands/hash.py add_optionsszHashCommand.add_optionscCsB|s|jjtjtS|j}x |D]}td||t||q"WtS)Nz%s: --hash=%s:%s) r print_usagesysstderrrrr _hash_of_filer)roptionsargsrpathrrrrun+s zHashCommand.runN)__name__ __module__ __qualname____doc__usageignore_require_venvrr&rrrrr s  r c CsDt|d,}tj|}xt|D]}|j|q WWdQRX|jS)z!Return the hash digest of a file.rbN)openhashlibnewrupdate hexdigest)r%rarchivehashchunkrrrr"8s   r") __future__rr/loggingr pip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.utils.hashesrrpip._internal.utils.miscrr pip._internal.utils.typingr optparser typingr getLoggerr'loggerr r"rrrrs      $