Your IP : 216.73.216.196


Current Path : /opt/alt/python33/lib/python3.3/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/wheel/__pycache__/install.cpython-33.pyc

�
�/6R�Fc@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	y
ej
ZWnek
r�ej
ZYnXddlmZddlmZmZmZmZmZmZddlmZddlmZddlmZdd	lmZdd
lmZddfZ ej!dej"�j#Z$dd
�a%Gdd�de&�Z'Gdd�de(�Z)Gdd�dej*�Z+dS(uD
Operations on existing wheel files, including basic installation. 
iN(ureify(uurlsafe_b64encodeu	from_jsonuurlsafe_b64decodeunativeubinaryuHashingFile(u
signatures(uread_pkg_info_bytes(uopen_for_csvi(u
get_supported(uget_install_pathsu�^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
    ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
    \.whl|\.dist-info)$cCsCyddlmaWn"tk
r8ddlmaYnXt|�S(u?Use parse_version from pkg_resources or distutils as available.i(u
parse_version(uLooseVersion(u
pkg_resourcesu
parse_versionuImportErrorudistutils.versionuLooseVersion(uversion((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu
parse_version*s

u
parse_versioncBs|EeZdZdS(uBadWheelFileN(u__name__u
__module__u__qualname__(u
__locals__((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuBadWheelFile3suBadWheelFilecBs�|EeZdZdZdZdZd6d7edd�Z	dd�Z
edd	��Zed
d��Z
edd
��Zedd��Zedd��ZeZedd��Zedd��Zedd��Zdd�Zdd�Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*d+��Zed,d-��Z d.d/�Z!ed0d1��Z"d7id2d3�Z#d6d4d5�Z$d6S(8u	WheelFileu�Parse wheel-specific attributes from a wheel (.whl) file and offer
    basic installation and verification support.
    
    WheelFile can be used to simply parse a wheel filename by avoiding the
    methods that require the actual file contents.uWHEELuRECORDcCs{||_||_||_||_tjj|�}t|�|_|j	d�sd|jdkrwtd|��ndS(u
        :param fp: A seekable file-like object or None to open(filename).
        :param append: Open archive in append mode.
        :param context: Function returning list of supported tags. Wheels
        must have the same context to be sortable.
        u.whluBad filename '%s'N(ufilenameufpuappenducontextuosupathubasenameu
WHEEL_INFO_REuparsed_filenameuendswithuNoneuBadWheelFile(uselfufilenameufpuappenducontextubasename((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__init__As				uWheelFile.__init__cCs|jS(N(ufilename(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__repr__UsuWheelFile.__repr__cCsd|jjd�S(Nu%s.dist-infounamever(uparsed_filenameugroup(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu
distinfo_nameXsuWheelFile.distinfo_namecCsd|jjd�S(Nu%s.dataunamever(uparsed_filenameugroup(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyudatadir_name\suWheelFile.datadir_namecCsd|j|jfS(Nu%s/%s(u
distinfo_nameuRECORD(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyurecord_name`suWheelFile.record_namecCsd|j|jfS(Nu%s/%s(u
distinfo_nameu
WHEEL_INFO(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuwheelinfo_namedsuWheelFile.wheelinfo_nameccs{|jj�}xe|djd�D]P}xG|djd�D]2}x)|djd�D]}|||fVqWWq=Wq#WdS(u�A wheel file is compatible with the Cartesian product of the
        period-delimited tags in its filename.
        To choose a wheel file among several candidates having the same
        distribution version 'ver', an installer ranks each triple of
        (pyver, abi, plat) that its Python installation can run, sorting
        the wheels by the best-ranked tag it supports and then by their
        arity which is just len(list(compatibility_tags)).
        upyveru.uabiuplatN(uparsed_filenameu	groupdictusplit(uselfutagsupyveruabiuplat((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyutagshs

uWheelFile.tagscCstt|j��S(u4The number of compatibility tags the wheel declares.(ulenulistucompatibility_tags(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuarityzsuWheelFile.aritycCs|j|j��S(uo
        Lowest index of any of this wheel's tags in self.context(), and the
        arity e.g. (0, 1)
        (ucompatibility_rankucontext(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuranksuWheelFile.rankcCs|jdtkS(Ni(uranku_big_number(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu
compatible�suWheelFile.compatiblecCsrg}x@|jD]5}y|j|j|��Wqtk
rDYqXqWt|�rht|�|jfStdfS(u�Rank the wheel against the supported tags. Smaller ranks are more
        compatible!

        :param supported: A list of compatibility tags that the current
            Python implemenation can run.
        i(ucompatibility_tagsuappenduindexu
ValueErrorulenuminuarityu_big_number(uselfu	supportedupreferencesutag((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyucompatibility_rank�s
	uWheelFile.compatibility_rankcCs"|j|kstd��|jS(Nucontext mismatch(ucontextuAssertionErroru
compatible(uselfux((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyusupports_current_python�su!WheelFile.supports_current_pythoncCsG|jjd�t|jjd��tdd�|jD��|jfS(Nunameuvercss|]}|VqdS(N((u.0ux((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu	<genexpr>�su&WheelFile._sort_key.<locals>.<genexpr>(uparsed_filenameugroupu
parse_versionutupleurankufilename(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu	_sort_key�suWheelFile._sort_keycCs|j|jkS(N(ufilename(uselfuother((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__eq__�suWheelFile.__eq__cCs|j|jkS(N(ufilename(uselfuother((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__ne__�suWheelFile.__ne__cCsV|j|jkr-tdj||���n|j|jkS|jjd�}|jjd�}||krw||kSt|jjd��}t|jjd��}||kr�||kS|j|jkr�tdj||���n|j}|j}|dkr*|dkr*||kr*||kS|dkrF|dkrFdS|j
|j
kS(Nu{0}.context != {1}.contextunameuverF(ucontextu	TypeErroruformatu	_sort_keyuparsed_filenameugroupu
parse_versionurankuNoneuFalseufilename(uselfuotherusnuonusvuovuscuoc((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__lt__�s(

		$
uWheelFile.__lt__cCs
||kS(N((uselfuother((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__gt__�suWheelFile.__gt__cCs||kp||kS(N((uselfuother((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__le__�suWheelFile.__le__cCs||kp||kS(N((uselfuother((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__ge__�suWheelFile.__ge__cCsYd}|jrd}nt|jr-|jn|j|�}|jsU|j|�n|S(Nurua(uappenduVerifyingZipFileufpufilenameuverify(uselfumodeuvzf((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuzipfile�s		$	uWheelFile.zipfilecCst|jj|j��S(u+Parse wheel metadata (the .data/WHEEL file)(uread_pkg_info_bytesuzipfileureaduwheelinfo_name(uself((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuparsed_wheel_info�suWheelFile.parsed_wheel_infocCsD|jd}ttt|jd���tkr@td��ndS(Nu
Wheel-Versionu.uWheel version is too high(uparsed_wheel_infoutupleumapuintusplituVERSION_TOO_HIGHu
ValueError(uselfuversion((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu
check_version�s
$uWheelFile.check_versioncCs|jjd�}t|�S(ul
        Consult distutils to get the install paths for our dist.  A dict with
        ('purelib', 'platlib', 'headers', 'scripts', 'data').
        
        We use the name from our filename as the dist name, which means headers
        could be installed in the wrong place if the filesystem-escaped name
        is different than the Name.  Who cares? 
        uname(uparsed_filenameugroupuget_install_paths(uselfuname((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu
install_paths�s
uWheelFile.install_pathscs��fdd�}�jddkr7|d�}n|d�}i}x�jj�D]}|j}|jd�r}qYn|jd�r�|d	d
�}n|jd�\}}	}
|	r|�jkr|
jd�\}}	}
|	stdj	|���n||�}nd}|}|}
t
jjt
jj
||
��}
|||
|
f||<qYW|s�xe|j�D]T\}}|j}|\}}}
}
t
jj|
�rqtd
j	||
���qqqqWntjjtj��}g}�jd}x�|j�D]w\}\}}}
}
|j}�jj|�}||krIqnt
jj|
�}t
jj|�s}t
j|�ntt|
d��}|dkr�|j�}|jd�r�d|tt
j�}n|j|�ntj||�t
jj |
|�}|j!t
j"d�|j#||j$�|j%f�|j&�|j&�|j'd?}|rt
j(|
|j'd?�qqWt
jj
|�j)�}t*j+t,|d��}x3t-|�D]%\}}}|j.|||f�q�W|j.�j)ddf�d
S(u7
        Install the wheel into site-packages.
        cs�j|�p�j|S(N(ugetu
install_paths(ukey(u	overridesuself(u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuget_pathsu#WheelFile.install.<locals>.get_pathuRoot-Is-Purelibutrueupurelibuplatlibu/u./iNuInvalid filename in wheel: {0}uuAWheel file {0} would overwrite {1}. Use force if this is intendedu/RECORDuwbuscriptss#!pythons#!iuw+(/uparsed_wheel_infouzipfileuinfolistufilenameuendswithu
startswithu	partitionudatadir_nameu
ValueErroruformatuosupathunormpathujoinuitemsuexistsusysu
executableuencodeugetfilesystemencodingu
distinfo_nameuopenudirnameuisdirumakedirsuHashingFileureadlineubinaryulinesepuwriteushutilucopyfileobjurelpathureplaceusepuappendudigestulengthucloseu
external_attruchmodurecord_nameucsvuwriteruopen_for_csvusorteduwriterow(uselfuforceu	overridesuget_pathurootu
name_transuinfounameubasedirusepufilenameukeyutargetudestuvukuexenameurecord_dataurecord_nameusourceuddirudestinationuhashbangureldestuattrsuwriterudigestulength((u	overridesuselfu>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuinstallsv	!	"
%	


uWheelFile.installcCs0d}|dkr|j}nd|_dj|jdf�}dj|jdf�}dj|jdf�}|j|d�|j|d�|j|d�|j|�}tt	j
|�j��}ytt
|j|���}Wntk
r�YnX|r`tj|�\}}	|	ddt
|�kr`d}
t|
j|	dt
|����q`ntjdd	�|j�D��}x�|D]�}|d
}
|d}|s�|
||fkr�tjjd|
�q�q�n|djd
d�\}}|dkstd��|j|
tt|���q�WdS(u	Configure the VerifyingZipFile `zipfile` by verifying its signature 
        and setting expected hashes for every hash in RECORD.
        Caller must complete the verification process by completely reading 
        every file in the archive (e.g. with extractall).u/uRECORDu
RECORD.jwsu
RECORD.p7suhashusha256=u8RECORD.sig claimed RECORD hash {0} != computed hash {1}.css|]}t|�VqdS(N(unative(u.0ur((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu	<genexpr>�su#WheelFile.verify.<locals>.<genexpr>iiu%s has no hash!
u=usha256uUnsupported hash algorithmNT(uNoneuzipfileuTrueustrictujoinu
distinfo_nameuset_expected_hashureaduurlsafe_b64encodeuhashlibusha256udigestu	from_jsonunativeuKeyErroru
signaturesuverifyuBadWheelFileuformatucsvureaderu
splitlinesusysustderruwriteusplituAssertionErroruurlsafe_b64decodeubinary(uselfuzipfileusigurecord_nameusig_nameusmime_sig_nameurecordu
record_digestuheadersupayloadumsgureaderurowufilenameuhashualgoudata((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuverifypsB	
"


uWheelFile.verifyNF(%u__name__u
__module__u__qualname__u__doc__u
WHEEL_INFOuRECORDuNoneuFalseu
get_supportedu__init__u__repr__upropertyu
distinfo_nameudatadir_nameurecord_nameuwheelinfo_nameutagsucompatibility_tagsuarityuranku
compatibleucompatibility_rankusupports_current_pythonu	_sort_keyu__eq__u__ne__u__lt__u__gt__u__le__u__ge__ureifyuzipfileuparsed_wheel_infou
check_versionu
install_pathsuinstalluverify(u
__locals__((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu	WheelFile7s>

nu	WheelFilecBs\|EeZdZdZdejddd�Zdd�Zdddd�Z
d	d
�ZdS(
uVerifyingZipFileu�ZipFile that can assert that each of its extracted contents matches
    an expected sha256 hash. Note that each file must be completly read in 
    order for its hash to be checked.urcCs>tjj|||||�d|_i|_tj|_dS(NF(	uzipfileuZipFileu__init__uFalseustrictu_expected_hashesuhashlibusha256u_hash_algorithm(uselfufileumodeucompressionu
allowZip64((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu__init__�s		uVerifyingZipFile.__init__cCs||j|<dS(un
        :param name: name of zip entry
        :param hash: bytes of hash (or None for "don't care")
        N(u_expected_hashes(uselfunameuhash((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuset_expected_hash�su"VerifyingZipFile.set_expected_hashcs6tjj||||��t|tj�r9|j}n|}||jkr|j|dkr|j|�y
�j�Wn#t	k
r�t
jd��SYnX|j��t
�d�r�����fdd�}nd����fdd�}|�_n.|jr2||jkr2td�j��n�S(u#Return file-like object for 'name'.uRNeed ZipExtFile._update_crc to implement file hash verification (in Python >= 2.7)u_eofcsL�|��j|��jrH�j��krHtd�j��ndS(NuBad hash for file %r(uupdateu_eofudigestuBadWheelFileuname(udata(u_update_crc_origuefu
expected_hashurunning_hash(u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu_update_crc�s

u*VerifyingZipFile.open.<locals>._update_crccsO�|d|��j|�|rK�j��krKtd�j��ndS(NueofuBad hash for file %r(uupdateudigestuBadWheelFileuname(udataueof(u_update_crc_origuefu
expected_hashurunning_hash(u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu_update_crc�s
uNo expected hash for file %rN(uzipfileuZipFileuopenu
isinstanceuZipInfoufilenameu_expected_hashesuNoneu_update_crcuAttributeErroruwarningsuwarnu_hash_algorithmuhasattrustrictuBadWheelFileuname(uselfuname_or_infoumodeupwdunameu_update_crc((u_update_crc_origuefu
expected_hashurunning_hashu>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuopen�s(



	uVerifyingZipFile.opencCsj|jstd��n|j�j�}|j|j=|jj|jtj	�|jj
�d|_dS(u�Truncate the last file off this zipfile.
        Assumes infolist() is in the same order as the files (true for
        ordinary zip files created by Python)u7Attempt to pop from ZIP archive that was already closedNT(
ufpuRuntimeErroruinfolistupopu
NameToInfoufilenameuseeku
header_offsetuosuSEEK_SETutruncateuTrueu
_didModify(uselfulast((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyupop�s	

uVerifyingZipFile.popNF(u__name__u
__module__u__qualname__u__doc__uzipfileu
ZIP_STOREDuFalseu__init__uset_expected_hashuNoneuopenupop(u
__locals__((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyuVerifyingZipFile�s#uVerifyingZipFile(,u__doc__usysuwarningsuos.pathuosureuzipfileuhashlibucsvushutilumaxsizeu_big_numberu	NameErrorumaxintuwheel.decoratorureifyu
wheel.utiluurlsafe_b64encodeu	from_jsonuurlsafe_b64decodeunativeubinaryuHashingFileuwheelu
signaturesu
wheel.pkginfouread_pkg_info_bytesuopen_for_csvu
pep425tagsu
get_supportedupathsuget_install_pathsuVERSION_TOO_HIGHucompileuVERBOSEumatchu
WHEEL_INFO_REu
parse_versionu
ValueErroruBadWheelFileuobjectu	WheelFileuZipFileuVerifyingZipFile(((u>/opt/alt/python33/lib/python3.3/site-packages/wheel/install.pyu<module>s8

.	�g