????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/cache.pyc

�
}�\]c@sRdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZmZer�dd
lmZmZmZmZddlmZneje�Zdefd
��YZdefd��YZ de fd��YZ!defd��YZ"dS(sCache Management
i����N(tcanonicalize_name(tLink(t
expanduser(tpath_to_url(t
TempDirectory(tMYPY_CHECK_RUNNING(tInvalidWheelFilenametWheel(tOptionaltSettListtAny(t
FormatControltCachecBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s�An abstract class - provides cache directories for data from links


        :param cache_dir: The root of the cache.
        :param format_control: An object of FormatControl class to limit
            binaries being read from the cache.
        :param allowed_formats: which formats of files the cache should store.
            ('binary' and 'source' are the only allowed values)
    cCsntt|�j�|r%t|�nd|_||_||_ddh}|jj|�|ksjt	�dS(Ntsourcetbinary(
tsuperR
t__init__RtNonet	cache_dirtformat_controltallowed_formatstuniontAssertionError(tselfRRRt_valid_formats((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR$s		cCs�|jg}|jdk	rO|jdk	rO|jdj|j|jg��ndj|�}tj|j��j	�}|d |dd!|dd!|dg}|S(sEGet parts of part that must be os.path.joined with cache_dir
        t=t#iiiN(
turl_without_fragmentt	hash_nameRthashtappendtjointhashlibtsha224tencodet	hexdigest(Rtlinkt	key_partstkey_urlthashedtparts((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyt_get_cache_path_parts.s%(cCs�|jp|p|}|r"gSt|�}|jj|�}|jj|�sVgS|j|�}ytj|�SWn5t	k
r�}|j
t
jt
jhkr�gS�nXdS(N(
RRRtget_allowed_formatsRtintersectiontget_path_for_linktostlistdirtOSErrorterrnotENOENTtENOTDIR(RR%tpackage_namet
can_not_cachetcanonical_nametformatstrootterr((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyt_get_candidatesHs"
		cCs
t��dS(s>Return a directory to store cached items in for link.
        N(tNotImplementedError(RR%((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR-ascCs
t��dS(saReturns a link to a cached item if it exists, otherwise returns the
        passed link.
        N(R;(RR%R4((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pytgetgscCs4|j|�}tjj||�}tt|��S(N(R-R.tpathR RR(RR%t	candidateR8R=((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyt_link_for_candidatenscCsdS(N((R((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pytcleanupus(
t__name__t
__module__t__doc__RR*R:R-R<R?R@(((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR
s		
					tSimpleWheelCachecBs)eZdZd�Zd�Zd�ZRS(s+A cache of wheels for future installs.
    cCs#tt|�j||dh�dS(NR(RRDR(RRR((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR~scCs(|j|�}tjj|jd|�S(s�Return a directory to store cached wheels for link

        Because there are M wheels for any one sdist, we provide a directory
        to cache them in, and then consult that directory when looking up
        cache hits.

        We only insert things into the cache if they have plausible version
        numbers, so that we don't contaminate the cache with things that were
        not unique. E.g. ./package might have dozens of installs done for it
        and build a version of 0.0...and if we built and cached a wheel, we'd
        end up using the same wheel even if the source has been edited.

        :param link: The link of the sdist for which this will cache wheels.
        twheels(R*R.R=R R(RR%R)((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR-�scCs�g}xl|j||�D]X}yt|�}Wntk
rEqnX|j�sXqn|j|j�|f�qW|s|S|j|t|�d�S(Ni(R:RRt	supportedRtsupport_index_minR?tmin(RR%R4t
candidatest
wheel_nametwheel((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR<�s
(RARBRCRR-R<(((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyRDzs		tEphemWheelCachecBs eZdZd�Zd�ZRS(sGA SimpleWheelCache that creates it's own temporary cache directory
    cCsBtdd�|_|jj�tt|�j|jj|�dS(Ntkindsephem-wheel-cache(Rt	_temp_dirtcreateRRLRR=(RR((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR�s
cCs|jj�dS(N(RNR@(R((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR@�s(RARBRCRR@(((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyRL�s		t
WheelCachecBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s�Wraps EphemWheelCache and SimpleWheelCache into a single Cache

    This Cache allows for gracefully degradation, using the ephem wheel cache
    when a certain link is not found in the simple wheel cache first.
    cCsDtt|�j||dh�t||�|_t|�|_dS(NR(RRPRRDt_wheel_cacheRLt_ephem_cache(RRR((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR�scCs|jj|�S(N(RQR-(RR%((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR-�scCs|jj|�S(N(RRR-(RR%((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pytget_ephem_path_for_link�scCs=|jj||�}||kr9|jj||�}n|S(N(RQR<RR(RR%R4tretval((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR<�scCs|jj�|jj�dS(N(RQR@RR(R((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyR@�s
(RARBRCRR-RSR<R@(((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyRP�s				(#RCR1R!tloggingR.tpip._vendor.packaging.utilsRtpip._internal.models.linkRtpip._internal.utils.compatRtpip._internal.utils.miscRtpip._internal.utils.temp_dirRtpip._internal.utils.typingRtpip._internal.wheelRRttypingRR	R
Rtpip._internal.indexRt	getLoggerRAtloggertobjectR
RDRLRP(((s2/tmp/pip-install-ewDPok/pip/pip/_internal/cache.pyt<module>s&"a3