Y=@sddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z ejeZGdddeZd d ZdS) )absolute_importN)Command)ERROR) read_chunks) FAVORITE_HASH STRONG_HASHEScsFeZdZdZdZdZdZfddZddZS) 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.csqtt|j|||jjdddddtdddtd d d jt|jj d |jdS) Nz-az --algorithmdest algorithmchoicesactionstoredefaulthelpz$The hash algorithm to use: one of %sz, r) superr__init__cmd_opts add_optionrrjoinparserinsert_option_group)selfargskw) __class__0/tmp/pip-build-3puug3g5/pip/pip/commands/hash.pyrs  zHashCommand.__init__cCsZ|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&rr)rrrs  rc CsVt|d:}tj|}x!t|D]}|j|q.WWdQRX|jS)z!Return the hash digest of a file.rbN)openhashlibnewrupdate hexdigest)r%r archiver chunkrrrr#3s r#) __future__rr0loggingrpip.basecommandrpip.status_codesr pip.utilsrpip.utils.hashesrr getLoggerr'r!rr#rrrrs   #