3 (\@s~ddlmZddlZddlZddlZddlmZddlmZddl m Z m Z ddl m Z ejeZGdddeZd d ZdS) )absolute_importN)Command)ERROR) FAVORITE_HASH STRONG_HASHES) read_chunkscs8eZdZdZdZdZdZdZfddZdd Z Z S) HashCommandz Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. hashz%prog [options] ...z#Compute hashes of package archives.Tc sJtt|j|||jjdddtdtddjtd|jj d|jdS) Nz-az --algorithm algorithmstorez$The hash algorithm to use: one of %sz, )destchoicesactiondefaulthelpr) superr__init__cmd_opts add_optionrrjoinparserinsert_option_group)selfargskw) __class__n/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-build-k1a8l1r5/pip/pip/_internal/commands/hash.pyrszHashCommand.__init__cCsD|s|jjtjtS|j}x"|D]}tjd||t||q"WdS)Nz%s: --hash=%s:%s) r print_usagesysstderrrr loggerinfo _hash_of_file)roptionsrr pathrrrrun(s zHashCommand.run) __name__ __module__ __qualname____doc__nameusagesummaryZignore_require_venvrr& __classcell__rr)rrrs rc CsDt|d,}tj|}xt|D]}|j|q WWdQRX|jS)z!Return the hash digest of a file.rbN)openhashlibnewrupdate hexdigest)r%r archiver chunkrrrr#3s   r#) __future__rr1loggingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrZpip._internal.utils.hashesrrZpip._internal.utils.miscr getLoggerr'r!rr#rrrrs     $