3 ]=@s~ddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z ejeZGdddeZd d ZdS) )absolute_importN)Command)ERROR) read_chunks) FAVORITE_HASH STRONG_HASHEScs4eZdZdZdZdZdZfddZddZZ 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.c 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__0/tmp/pip-build-8jg9gmni/pip/pip/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__nameusagesummaryrr& __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__rr1loggingrpip.basecommandrpip.status_codesr pip.utilsrpip.utils.hashesrr getLoggerr'r!rr#rrrrs     #