File "util.cpython-37.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/util.cpython-37.pyc
File size: 50.15 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

B

:a@sddlZddlmZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZyddlZWnek
rdZYnXddlZddlZddlZddlZddlZyddlZWnek
rddlZYnXddlZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0e
1e2Z3e
4dZ5e
4dZ6e
4d	Z7e
4d
Z8e
4dZ9e
4dZ:e
4d
Z;e
4dZ<ddZ=ddZ>ddZ?ddZ@ddZAdddZBddZCddZDdd ZEejFd!d"ZGejFd#d$ZHejFdd&d'ZIGd(d)d)eJZKd*d+ZLGd,d-d-eJZMd.d/ZNGd0d1d1eJZOe
4d2e
jPZQd3d4ZRdd5d6ZSd7d8ZTd9d:ZUd;d<ZVd=d>ZWd?d@ZXe
4dAe
jYZZe
4dBZ[ddCdDZ\e
4dEZ]dFdGZ^dHdIZ_dJdKZ`dLZadMdNZbdOdPZcGdQdRdReJZdGdSdTdTeJZeGdUdVdVeJZfdWZgddYdZZhd[d\Zid]ZjGd^d_d_eJZke
4d`Zle
4daZme
4dbZndcddZdedfZoerddglmpZqmrZrmsZsGdhdidie$jtZtGdjdkdkeqZpGdldmdmepe'ZuGdndodoe%jvZverGdpdqdqe%jwZwGdrdsdse%jxZxdtduZyGdvdwdweJZzGdxdydyezZ{Gdzd{d{ezZ|Gd|d}d}e(Z}Gd~ddeJZ~ddZGdddeJZddZddZddZddddZddZdS)N)deque)iglob)DistlibException)string_types	text_typeshutil	raw_inputStringIOcache_from_sourceurlopenurljoinhttplib	xmlrpclib	splittypeHTTPHandlerBaseConfiguratorvalid_ident	ContainerconfigparserURLErrorZipFilefsdecodeunquoteurlparsez^([\w\.-]+)\s*z^([\w\.*+-]+)\s*z^(<=?|>=?|={2,3}|[~!]=)\s*z*^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*z^or\b\s*z	^and\b\s*z(\S+)\s*z(([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)cs6ddfddfddfdd|S)	ae
    Parse a marker string and return a dictionary containing a marker expression.

    The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in
    the expression grammar, or strings. A string contained in quotes is to be
    interpreted as a literal string, and a string not contained in quotes is a
    variable (such as os_name).
    cSs0t|}|r,|d}||d}n|s:tdn|d}|dkrVtd|d|d}|dd}|g}x|r|d|krPqv|d|kr|||dd}qvt|}|std|||d||d}qvWd|}td|||d|}|dd	}||fS)	Nrzunexpected end of inputz'"zinvalid expression: %srzerror in string literal: %szunterminated string: %s)

IDENTIFIERmatchgroupsendSyntaxErrorreplaceappendSTRING_CHUNKjoinlstrip)	remainingmresultqZoqpartssr,=/opt/alt/python37/lib/python3.7/site-packages/distlib/util.py
marker_varAs:






z parse_marker.<locals>.marker_varcs|rR|ddkrR|dd\}}|ddkr@td||dd}n^|\}}xL|rt|}|stP|d}||d}|\}}|||d}q`W|}||fS)Nr(r)zunterminated parenthesis: %s)oplhsrhs)r%r 	MARKER_OPrrr)r&r(r2r'r1r3)markerr.r,r-marker_expres 
z!parse_marker.<locals>.marker_exprcsV|\}}x@|rLt|}|s"P||d}|\}}d||d}qW||fS)Nand)r1r2r3)ANDrr)r&r2r'r3)r6r,r-
marker_andxs
z parse_marker.<locals>.marker_andcsV|\}}x@|rLt|}|s"P||d}|\}}d||d}qW||fS)Nor)r1r2r3)ORrr)r&r2r'r3)r9r,r-r5s
zparse_marker.<locals>.markerr,)Z
marker_stringr,)r5r9r6r.r-parse_marker8s
	$r<cCs2|}|r|drdSt|}|s4td||d}||d}d}}}}|r<|ddkr<|dd}|dkrtd||d|}	||dd}g}xx|	r0t|	}|std	|	|	|d|	|d}	|	sP|	dd
krtd|	|	dd}	qW|s<d}|r|ddkr|dd}t
|}|s|td
||d}t|}
|
jr|
j
std|||d}ndd}|ddkr||\}}n|dd}|dkrtd||d|}	||dd}t|	rB||	\}}nXt|	}|s^td|	|d}
|	|d}	|	rtd|	d|
fg}|r|ddkrtd||dd}t|\}}|r|ddkrtd||s|}nd|ddd|Df}t||||||dS)z
    Parse a requirement passed in as a string. Return a Container
    whose attributes contain the various parts of the requirement.
    #Nzname expected: %sr[]rzunterminated extra: %szmalformed extra: %s,zcomma expected in extras: %s@zinvalid URI: %szInvalid URL: %scSst|}d}|rg}x|d}||d}t|}|sNtd||d}|||f||d}|r|ddkrP|dd}|sPt|}|std|qW|sd}||fS)z|
                Return a list of operator, version tuples if any are
                specified, else None.
                Nrzinvalid version: %sr@rzinvalid constraint: %s)
COMPARE_OPrrrVERSION_IDENTIFIERr r"r%)Z
ver_remainingr'versionsr1vr,r,r-get_versionss0


z'parse_requirement.<locals>.get_versionsr/r0zunterminated parenthesis: %szinvalid constraint: %sz~=;zinvalid requirement: %szunexpected trailing data: %sz%s %sz, cSsg|]}d|qS)z%s %sr,).0Zconr,r,r-
<listcomp>	sz%parse_requirement.<locals>.<listcomp>)nameextrasZconstraintsr5urlZrequirement)strip
startswithrrr rrfindr%r"	NON_SPACErschemenetlocrBrCr<r$r)reqr&r'ZdistnamerKZ	mark_exprrDuriir+trF_rEZrsr,r,r-parse_requirements


 


rXcCsdd}i}x|D]\}}}tj||}xt|D]t}tj||}	x`t|	D]T}
|||
}|dkrt||dqP|||
}|tjjdd}
|
d|||<qPWq4WqW|S)z%Find destinations for resources filescSsD|tjjd}|tjjd}||s.t|t|ddS)N/)r!ospathseprNAssertionErrorlenr%)rootr[r,r,r-get_rel_pathsz)get_resources_dests.<locals>.get_rel_pathNrY)rZr[r$rpopr!r\rstrip)Zresources_rootZrulesr`ZdestinationsbasesuffixdestprefixZabs_baseZabs_globZabs_pathZ
resource_fileZrel_pathZrel_destr,r,r-get_resources_destss

rgcCs(ttdrd}ntjttdtjk}|S)NZreal_prefixTbase_prefix)hasattrsysrfgetattr)r(r,r,r-in_venv(s
rlcCstj}t|tst|}|S)N)rj
executable
isinstancerr)r(r,r,r-get_executable2s
rocCsR|}xHt|}|}|s|r|}|r|d}||kr8P|rd|||f}qW|S)Nrz	%c: %s
%s)r	lower)promptZ
allowed_charsZerror_promptdefaultpr+cr,r,r-proceedDsrucCs<t|tr|}i}x |D]}||kr||||<qW|S)N)rnrsplit)dkeysr(keyr,r,r-extract_by_keyTs

rzcCstjddkrtd|}|}t|}yrt|}|ddd}xR|D]F\}}x<|D]0\}}d||f}t	|}	|	dk	st
|	||<qdWqRW|Stk
r|ddYnXdd	}
t
}y|
||Wn<t
jk
r|t|}t|}|
||YnXi}xb|D]V}i||<}xB||D]4\}
}d|
|f}t	|}	|	dk	spt
|	||
<qFWq*W|S)
Nrzutf-8
extensionszpython.exportsexportsz%s = %scSs$t|dr||n
||dS)N	read_file)rir~readfp)cpstreamr,r,r-read_streamqs
z!read_exports.<locals>.read_stream)rjversion_infocodecs	getreaderreadr
jsonloaditemsget_export_entryr]	ExceptionseekrConfigParserMissingSectionHeaderErrorclosetextwrapdedentsections)rdataZjdatar(groupentrieskrEr+entryrrryrJvaluer,r,r-read_exports]sD

rcCstjddkrtd|}t}x||D]p\}}||x\|D]P}|j	dkr`|j
}nd|j
|j	f}|jrd|d|jf}|
||j|qJWq.W||dS)Nrr{zutf-8z%s:%sz%s [%s]z, )rjrr	getwriterrrradd_sectionvaluesrdrfflagsr$setrJwrite)r}rrrrErr+r,r,r-
write_exportss

rc	cs$t}z
|VWdt|XdS)N)tempfilemkdtemprrmtree)Ztdr,r,r-tempdirs
rc	cs.t}zt|dVWdt|XdS)N)rZgetcwdchdir)rwcwdr,r,r-rs


rc	cs.t}zt|dVWdt|XdS)N)socketZgetdefaulttimeoutZsetdefaulttimeout)ZsecondsZctor,r,r-socket_timeouts


rc@seZdZddZdddZdS)cached_propertycCs
||_dS)N)func)selfrr,r,r-__init__szcached_property.__init__NcCs,|dkr|S||}t||jj||S)N)robject__setattr____name__)robjclsrr,r,r-__get__s

zcached_property.__get__)N)r
__module____qualname__rrr,r,r,r-rsrcCstjdkr|S|s|S|ddkr.td||ddkrFtd||d}xtj|krj|tjqRW|svtjStjj|S)aReturn 'pathname' as a name that will work on the native filesystem.

    The path is split on '/' and put back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    rYrzpath '%s' cannot be absolutezpath '%s' cannot end with '/')rZr\
ValueErrorrvcurdirremover[r$)pathnamepathsr,r,r-convert_paths


rc@seZdZd$ddZddZddZdd	Zd%ddZd&ddZddZ	ddZ
ddZddZddZ
d'ddZddZddZd d!Zd"d#Zd
S)(FileOperatorFcCs||_t|_|dS)N)dry_runrensured_init_record)rrr,r,r-rszFileOperator.__init__cCsd|_t|_t|_dS)NF)recordr
files_writtendirs_created)rr,r,r-rszFileOperator._init_recordcCs|jr|j|dS)N)rradd)rr[r,r,r-record_as_writtenszFileOperator.record_as_writtencCsHtj|s tdtj|tj|s0dSt|jt|jkS)aTell if the target is newer than the source.

        Returns true if 'source' exists and is more recently modified than
        'target', or if 'source' exists and 'target' doesn't.

        Returns false if both exist and 'target' is the same age or younger
        than 'source'. Raise PackagingFileError if 'source' does not exist.

        Note that this test is not very accurate: files created in the same
        second will have the same "age".
        zfile '%r' does not existT)rZr[existsrabspathstatst_mtime)rsourcetargetr,r,r-newerszFileOperator.newerTcCs|tj|td|||jsd}|rdtj|rDd|}n tj|rdtj	|sdd|}|rtt
|dt|||
|dS)z8Copy a file respecting dry-run and force flags.
        zCopying %s to %sNz%s is a symlinkz%s is a non-regular filez which would be overwritten)
ensure_dirrZr[dirnameloggerinforislinkrisfilerrcopyfiler)rinfileoutfilecheckmsgr,r,r-	copy_files
zFileOperator.copy_fileNcCstj|rt|tj|td|||jsv|dkrJt	|d}nt
j	|d|d}zt||Wd|
X||dS)NzCopying stream %s to %swbw)encoding)rZr[isdirr]rrrrropenrrcopyfileobjrr)rZinstreamrrZ	outstreamr,r,r-copy_streams
zFileOperator.copy_streamc	Cs\|tj||jsNtj|r.t|t|d}||WdQRX|	|dS)Nr)
rrZr[rrrrrrr)rr[rfr,r,r-write_binary_file's
zFileOperator.write_binary_filecCs||||dS)N)rencode)rr[rrr,r,r-write_text_file0szFileOperator.write_text_filecCsrtjdkstjdkrntjdkrnxN|D]F}|jr<td|q$t|j|B|@}td||t||q$WdS)Nposixjavazchanging mode of %szchanging mode of %s to %o)	rZrJ_namerrrrst_modechmod)rbitsmaskfilesrmoder,r,r-set_mode3s
zFileOperator.set_modecCs|dd|S)Nimi)r)r+rr,r,r-<lambda>?zFileOperator.<lambda>cCs|tj|}||jkrxtj|sx|j|tj|\}}||t	d||j
sft||jrx|j
|dS)NzCreating %s)rZr[rrrrrvrrrrmkdirrr)rr[rwrr,r,r-rAs

zFileOperator.ensure_dirc	Cst||}td|||js|s0|||rX|s:d}n||sHt|t|d}i}|rvtt	drvt	j
j|d<t	j|||df||
||S)NzByte-compiling %s to %sPycInvalidationModeinvalidation_modeT)rrrrrrNr]r^ri
py_compilerCHECKED_HASHcompiler)	rr[optimizeforcerfZhashed_invalidationZdpathZdiagpathZcompile_kwargsr,r,r-byte_compileMs
zFileOperator.byte_compilecCstj|rtj|r^tj|s^td||js@t	||j
r||jkr|j|nPtj|rpd}nd}td|||jst||j
r||j
kr|j
|dS)NzRemoving directory tree at %slinkfilezRemoving %s %s)rZr[rrrrdebugrrrrrrr)rr[r+r,r,r-ensure_removed^s"



zFileOperator.ensure_removedcCsHd}x>|sBtj|r&t|tj}Ptj|}||kr<P|}qW|S)NF)rZr[raccessW_OKr)rr[r(parentr,r,r-is_writablesszFileOperator.is_writablecCs"|js
t|j|jf}||S)zV
        Commit recorded changes, turn off recording, return
        changes.
        )rr]rrr)rr(r,r,r-commits
zFileOperator.commitcCs|jsx(t|jD]}tj|rt|qWt|jdd}xN|D]F}t	|}|r|dgksdt
tj||d}t|t|qDW|
dS)NT)reverse__pycache__r)rlistrrZr[rrsortedrlistdirr]r$rmdirr)rrdirsrwZflistsdr,r,r-rollbacks


zFileOperator.rollback)F)T)N)FFNF)rrrrrrrrrrrrZset_executable_moderrrrrrr,r,r,r-rs 


	

rcCsb|tjkrtj|}nt|}|dkr,|}n2|d}t||d}x|D]}t||}qLW|S)N.r)rjmodules
__import__rvrkra)module_nameZdotted_pathmodr(r*rsr,r,r-resolves


rc@s6eZdZddZeddZddZddZej	Z	d	S)
ExportEntrycCs||_||_||_||_dS)N)rJrfrdr)rrJrfrdrr,r,r-rszExportEntry.__init__cCst|j|jS)N)rrfrd)rr,r,r-rszExportEntry.valuecCsd|j|j|j|jfS)Nz<ExportEntry %s = %s:%s %s>)rJrfrdr)rr,r,r-__repr__s
zExportEntry.__repr__cCsDt|tsd}n0|j|jko>|j|jko>|j|jko>|j|jk}|S)NF)rnrrJrfrdr)rotherr(r,r,r-__eq__s
zExportEntry.__eq__N)
rrrrrrrrr__hash__r,r,r,r-rs

rz(?P<name>(\w|[-.+])+)
                      \s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
                      \s*(\[\s*(?P<flags>[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
                      c
Cst|}|s0d}d|ks"d|krtd|n|}|d}|d}|d}|dkrf|d}}n"|dkrztd||d\}}|d	}	|	dkrd|ksd|krtd|g}	nd
d|	dD}	t||||	}|S)
Nr>r?zInvalid specification '%s'rJcallable:rrrcSsg|]}|qSr,)rM)rHrr,r,r-rIsz$get_export_entry.<locals>.<listcomp>r@)ENTRY_REsearchr	groupdictcountrvr)
Z
specificationr'r(rwrJr[Zcolonsrfrdrr,r,r-rs2


rcCs|dkrd}tjdkr.dtjkr.tjd}ntjd}tj|rft|tj}|st	
d|n<yt|d}Wn(tk
rt	j
d	|dd
d}YnX|st
}t	
d|tj||S)
a
    Return the default base location for distlib caches. If the directory does
    not exist, it is created. Use the suffix provided for the base directory,
    and default to '.distlib' if it isn't provided.

    On Windows, if LOCALAPPDATA is defined in the environment, then it is
    assumed to be a directory, and will be the parent directory of the result.
    On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home
    directory - using os.expanduser('~') - will be the parent directory of
    the result.

    The result is just the directory '.distlib' in the parent directory as
    determined above, or with the name specified with ``suffix``.
    Nz.distlibntZLOCALAPPDATAz
$localappdata~z(Directory exists but is not writable: %sTzUnable to create %s)exc_infoFz#Default location unusable, using %s)rZrJenvironr[
expandvars
expanduserrrrrwarningmakedirsOSErrorrrr$)rdr(Zusabler,r,r-get_cache_bases&

r&cCsBtjtj|\}}|r(|dd}|tjd}||dS)a
    Convert an absolute path to a directory name for use in a cache.

    The algorithm used is:

    #. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
    #. Any occurrence of ``os.sep`` is replaced with ``'--'``.
    #. ``'.cache'`` is appended.
    rz---z--z.cache)rZr[
splitdriverr!r\)r[rwrsr,r,r-path_to_cache_dirs

r(cCs|ds|dS|S)NrY)endswith)r+r,r,r-ensure_slash$s
r*cCs`d}}d|kr>|dd\}}d|kr.|}n|dd\}}|rJt|}|rVt|}|||fS)NrArr)rsplitrvr)rRusernamepasswordrfr,r,r-parse_credentials*sr.cCstd}t||S)N)rZumask)r(r,r,r-get_process_umask9s

r1cCs>d}d}x$t|D]\}}t|tsd}PqW|dk	s:t|S)NTF)	enumeraternrr])seqr(rUr+r,r,r-is_string_sequence>s
r4z3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z
-py(\d\.?\d?)cCsd}d}t|dd}t|}|r@|d}|d|}|rt|t|dkrtt	|d|}|r|
}|d|||dd|f}|dkrt|}|r|d|d|f}|S)zw
    Extract name, version, python version from a filename (no extension)

    Return name, version, pyver or None
    N -rz\br{)rr!PYTHON_VERSIONrrstartr^rerescaperPROJECT_NAME_AND_VERSION)filenameZproject_namer(Zpyverr'nr,r,r-split_filenameMs"


r>z-(?P<name>[\w .-]+)\s*\(\s*(?P<ver>[^\s)]+)\)$cCs:t|}|std||}|d|dfS)z
    A utility method used to get name and version from a string.

    From e.g. a Provides-Dist value.

    :param p: A value in a form 'foo (1.0)'
    :return: The name and version as a tuple.
    z$Ill-formed name/version string: '%s'rJZver)NAME_VERSION_RErrrrMrp)rsr'rwr,r,r-parse_name_and_versionis
	
r@cCst}t|pg}t|pg}d|kr8|d||O}x|D]x}|dkrV||q>|dr|dd}||krtd|||kr||q>||krtd|||q>W|S)N*r6rzundeclared extra: %s)rrrrNrr#)Z	requestedZ	availabler(rZunwantedr,r,r-
get_extrasxs&


rCc
Csi}yNt|}|}|d}|ds8td|ntd|}t	|}Wn0t
k
r}ztd||Wdd}~XYnX|S)NzContent-Typezapplication/jsonz(Unexpected response for JSON request: %szutf-8z&Failed to get external data for %s: %s)rrgetrNrrrrrrr	exception)rLr(Zrespheadersctreaderer,r,r-_get_external_datas

 rJz'https://www.red-dove.com/pypi/projects/cCs*d|d|f}tt|}t|}|S)Nz%s/%s/project.jsonr)upperr
_external_data_base_urlrJ)rJrLr(r,r,r-get_project_datas
rMcCs(d|d||f}tt|}t|S)Nz%s/%s/package-%s.jsonr)rKr
rLrJ)rJversionrLr,r,r-get_package_datas
rOc@s(eZdZdZddZddZddZdS)	Cachez
    A class implementing a cache for resources that need to live in the file system
    e.g. shared libraries. This class was moved from resources to here because it
    could be used by other modules, e.g. the wheel module.
    cCsPtj|st|t|jd@dkr6td|tjtj	||_
dS)zu
        Initialise an instance.

        :param base: The base directory where the cache should be located.
        ?rzDirectory '%s' is not privateN)rZr[rr$rrrr#rnormpathrc)rrcr,r,r-rs

zCache.__init__cCst|S)zN
        Converts a resource prefix to a directory name in the cache.
        )r()rrfr,r,r-
prefix_to_dirszCache.prefix_to_dirc	Csg}xt|jD]r}tj|j|}y>tj|s@tj|rLt|ntj|rbt	
|Wqtk
r||YqXqW|S)z"
        Clear the cache.
        )
rZrrcr[r$rrrrrrrr")rZnot_removedfnr,r,r-clearszCache.clearN)rrr__doc__rrSrUr,r,r,r-rPsrPc@s:eZdZdZddZdddZddZd	d
ZddZd
S)
EventMixinz1
    A very simple publish/subscribe system.
    cCs
i|_dS)N)_subscribers)rr,r,r-rszEventMixin.__init__TcCsD|j}||krt|g||<n"||}|r6||n
||dS)a`
        Add a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be added (and called when the
                           event is published).
        :param append: Whether to append or prepend the subscriber to an
                       existing subscriber list for the event.
        N)rXrr"
appendleft)revent
subscriberr"subssqr,r,r-rs
zEventMixin.addcCs,|j}||krtd||||dS)z
        Remove a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be removed.
        zNo subscribers: %rN)rXrr)rrZr[r\r,r,r-rszEventMixin.removecCst|j|dS)z
        Return an iterator for the subscribers for an event.
        :param event: The event to return subscribers for.
        r,)iterrXrD)rrZr,r,r-get_subscribersszEventMixin.get_subscribersc	Ospg}xT||D]F}y||f||}Wn"tk
rJtdd}YnX||qWtd|||||S)a^
        Publish a event and return a list of values returned by its
        subscribers.

        :param event: The event to publish.
        :param args: The positional arguments to pass to the event's
                     subscribers.
        :param kwargs: The keyword arguments to pass to the event's
                       subscribers.
        z"Exception during event publicationNz/publish %s: args = %s, kwargs = %s, result = %s)r_rrrEr"r)rrZargskwargsr(r[rr,r,r-publish
s

zEventMixin.publishN)T)	rrrrVrrrr_rbr,r,r,r-rWs
rWc@s^eZdZddZddZdddZdd	Zd
dZdd
ZddZ	e
ddZe
ddZdS)	SequencercCsi|_i|_t|_dS)N)_preds_succsr_nodes)rr,r,r-r(szSequencer.__init__cCs|j|dS)N)rfr)rnoder,r,r-add_node-szSequencer.add_nodeFcCs||jkr|j||rx&t|j|dD]}|||q.Wx&t|j|dD]}|||qVWx&t|jD]\}}|sz|j|=qzWx&t|jD]\}}|s|j|=qWdS)Nr,)rfrrrdrDrerr)rrgZedgesrsr+rrEr,r,r-remove_node0s
zSequencer.remove_nodecCs<||kst|j|t||j|t|dS)N)r]rd
setdefaultrrre)rpredsuccr,r,r-r@sz
Sequencer.addcCs||ksty|j|}|j|}Wn tk
rDtd|YnXy||||Wn$tk
rtd||fYnXdS)Nz%r not a successor of anythingz%r not a successor of %r)r]rdreKeyErrorrr)rrkrlpredsZsuccsr,r,r-rEs

zSequencer.removecCs||jkp||jkp||jkS)N)rdrerf)rstepr,r,r-is_stepRszSequencer.is_stepcCs||std|g}g}t}||xd|r|d}||krd||kr||||q0|||||j|d}|	|q0Wt
|S)NzUnknown: %rrr,)rprrr"rarrrdrDextendreversed)rfinalr(Ztodoseenrornr,r,r-	get_stepsVs"





zSequencer.get_stepscsVdggiig|jfddxD]}|kr:|q:WS)Nrcsd|<d|<dd7<|y|}Wntk
rVg}YnXxR|D]J}|kr|t|||<q^|kr^t|||<q^W||krg}x }||||krPqWt|}|dS)Nrr)r"rminratuple)rgZ
successorsZ	successorZconnected_componentZ	component)graphindex
index_counterlowlinksr(stack
strongconnectr,r-r}zs.



z3Sequencer.strong_connections.<locals>.strongconnect)re)rrgr,)rxryrzr{r(r|r}r-strong_connectionsos"
zSequencer.strong_connectionscCsrdg}x8|jD].}|j|}x|D]}|d||fq"WqWx|jD]}|d|qHW|dd|S)Nzdigraph G {z  %s -> %s;z  %s;}
)rdr"rfr$)rr(rlrnrkrgr,r,r-dots


z
Sequencer.dotN)F)
rrrrrhrirrrprupropertyr~rr,r,r,r-rc's

3rc)z.tar.gzz.tar.bz2z.tarz.zipz.tgzz.tbzz.whlTc
sXfdd}tjtd}|dkr|dr>d}nH|drRd}d}n4|drfd	}d
}n |drzd}d
}ntd|z|dkrt|d
}|r|}xD|D]}||qWn.t	||}|r|
}x|D]}||qW|dkr6tjddkr6x.|
D]"}	t|	jts|	jd|	_qW|Wd|rR|XdS)NcsRt|ts|d}tjtj|}|rB|tjkrNt	d|dS)Nzutf-8zpath outside destination: %r)
rnrdecoderZr[rr$rNr\r)r[rs)dest_dirplenr,r-
check_paths


zunarchive.<locals>.check_path)z.zipz.whlzip)z.tar.gzz.tgzZtgzzr:gz)z.tar.bz2z.tbzZtbzzr:bz2z.tartarrBzUnknown format for %rrr{zutf-8)rZr[rr^r)rrnamelisttarfilerZgetnamesrjrZ
getmembersrnrJrr
extractallr)
Zarchive_filenamerformatrrarchivernamesrJtarinfor,)rrr-	unarchivesH






rc	Cst}t|}t|db}xZt|D]L\}}}x@|D]8}tj||}||d}	tj|	|}
|||
q8Wq(WWdQRX|S)z*zip a directory tree into a BytesIO objectrN)	ioBytesIOr^rrZwalkr[r$r)	directoryr(Zdlenzfr_r	rrJZfullZrelrer,r,r-zip_dirs
r)rKMGTPc@sreZdZdZdddZddZdd	Zd
dZdd
Ze	ddZ
e	ddZddZe	ddZ
e	ddZdS)ProgressUNKNOWNrdcCs<|dks||kst||_|_||_d|_d|_d|_dS)NrF)r]rvcurmaxstartedelapseddone)rZminvalZmaxvalr,r,r-rszProgress.__init__cCsV|j|kst|jdks&||jks&t||_t}|jdkrF||_n||j|_dS)N)rvr]rrtimerr)rZcurvalZnowr,r,r-update
s
zProgress.updatecCs |dkst||j|dS)Nr)r]rr)rZincrr,r,r-	incrementszProgress.incrementcCs||j|S)N)rrv)rr,r,r-r8szProgress.startcCs |jdk	r||jd|_dS)NT)rrr)rr,r,r-stops
z
Progress.stopcCs|jdkr|jS|jS)N)runknown)rr,r,r-maximum!szProgress.maximumcCsD|jrd}n4|jdkrd}n$d|j|j|j|j}d|}|S)Nz100 %z ?? %gY@z%3d %%)rrrrv)rr(rEr,r,r-
percentage%s
zProgress.percentagecCs:|dkr|jdks|j|jkr$d}ntdt|}|S)Nrz??:??:??z%H:%M:%S)rrrvrstrftimegmtime)rZdurationr(r,r,r-format_duration0szProgress.format_durationcCs|jrd}|j}n^d}|jdkr&d}nJ|jdks<|j|jkrBd}n.t|j|j}||j|j}|d|j}d|||fS)NZDonezETA rrrz%s: %s)rrrrrvfloatr)rrfrVr,r,r-ETA9s
zProgress.ETAcCsN|jdkrd}n|j|j|j}xtD]}|dkr6P|d}q(Wd||fS)Nrgig@@z%d %sB/s)rrrvUNITS)rr(Zunitr,r,r-speedLs

zProgress.speedN)rr)rrrrrrrr8rrrrrrrr,r,r,r-rs

	rz\{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$cCs<t|rd}t||t|r4d}t||t|S)zAExtended globbing function that supports ** and {opt1,opt2,opt3}.z7invalid glob %r: recursive glob "**" must be used alonez2invalid glob %r: mismatching set marker '{' or '}')_CHECK_RECURSIVE_GLOBrr_CHECK_MISMATCH_SET_iglob)	path_globrr,r,r-ras

rccst|d}t|dkrpt|dks,t||\}}}x|dD](}x"td|||fD]
}|Vq\WqBWnd|krxt|D]
}|VqWn|dd\}}|dkrd}|dkrd}n|d}|d	}xHt	|D]:\}}}	tj
|}x"ttj
||D]}
|
VqWqWdS)
Nrr{r@rz**rrArY\)	RICH_GLOBrvr^r]rr$	std_iglobr%rZrr[rR)rZrich_path_globrfrrditemr[ZradicaldirrrTr,r,r-rls*


r)HTTPSHandlermatch_hostnameCertificateErrorc@seZdZdZdZddZdS)HTTPSConnectionNTcCst|j|jf|j}t|ddr0||_|t	tj
}ttdrV|jtj
O_|jrl||j|ji}|jrtj|_|j|jdttddr|j|d<|j|f||_|jr|jry$t|j|jtd|jWn0tk
r|jtj|jYnXdS)NZ_tunnel_hostFOP_NO_SSLv2)ZcafileZHAS_SNIZserver_hostnamezHost verified: %s)rZcreate_connectionhostZporttimeoutrksockZ_tunnelsslZ
SSLContextZPROTOCOL_SSLv23rioptionsrZ	cert_fileZload_cert_chainZkey_fileca_certsZ
CERT_REQUIREDZverify_modeZload_verify_locationsZwrap_socketcheck_domainrZgetpeercertrrrshutdownZ	SHUT_RDWRr)rrcontextrar,r,r-connects0


zHTTPSConnection.connect)rrrrrrr,r,r,r-rsrc@s&eZdZd	ddZddZddZdS)
rTcCst|||_||_dS)N)BaseHTTPSHandlerrrr)rrrr,r,r-rs
zHTTPSHandler.__init__cOs$t||}|jr |j|_|j|_|S)a
            This is called to create a connection instance. Normally you'd
            pass a connection class to do_open, but it doesn't actually check for
            a class, and just expects a callable. As long as we behave just as a
            constructor would have, we should be OK. If it ever changes so that
            we *must* pass a class, we'll create an UnsafeHTTPSConnection class
            which just sets check_domain to False in the class definition, and
            choose which one to pass to do_open.
            )rrr)rr`rar(r,r,r-_conn_makers


zHTTPSHandler._conn_makerc
CsVy||j|Stk
rP}z$dt|jkr>td|jnWdd}~XYnXdS)Nzcertificate verify failedz*Unable to verify server certificate for %s)Zdo_openrrstrreasonrr)rrSrIr,r,r-
https_openszHTTPSHandler.https_openN)T)rrrrrrr,r,r,r-rs
rc@seZdZddZdS)HTTPSOnlyHandlercCstd|dS)NzAUnexpected HTTP request on what should be a secure connection: %s)r)rrSr,r,r-	http_openszHTTPSOnlyHandler.http_openN)rrrrr,r,r,r-rsrc@seZdZdddZddZdS)	TransportrcCs||_tj||dS)N)rrrr)rruse_datetimer,r,r-rszTransport.__init__cCsD||\}}}|jr$||jdkr:||_|t|f|_|jdS)Nrr)
get_host_info_connection_extra_headersrZHTTPConnection)rrhehZx509r,r,r-make_connections
zTransport.make_connectionN)r)rrrrrr,r,r,r-rs
rc@seZdZdddZddZdS)
SafeTransportrcCs||_tj||dS)N)rrrr)rrrr,r,r-rszSafeTransport.__init__cCs\||\}}}|si}|j|d<|jr6||jdkrR||_|tj|df|f|_|jdS)Nrrr)rrrrrr)rrrrrar,r,r-rs

zSafeTransport.make_connectionN)r)rrrrrr,r,r,r-rs
rc@seZdZddZdS)ServerProxycKst|dd|_}|dk	r^t|d}|dd}|dkr@t}nt}|||d|d<}||_tjj	||f|dS)NrrrZhttps)r	transport)
rarrrDrrrrrr)rrTrarrQrZtclsrVr,r,r-rszServerProxy.__init__N)rrrrr,r,r,r-rsrcKs6tjddkr|d7}nd|d<d|d<t||f|S)Nrr{brnewlinezutf-8r)rjrr)rTrrar,r,r-	_csv_opens

rc@s4eZdZedededdZddZddZd	S)
CSVBaser@"r)	delimiterZ	quotecharZlineterminatorcCs|S)Nr,)rr,r,r-	__enter__(szCSVBase.__enter__cGs|jdS)N)rr)rrr,r,r-__exit__+szCSVBase.__exit__N)rrrrdefaultsrrr,r,r,r-r!s
rc@s(eZdZddZddZddZeZdS)	CSVReadercKs\d|kr4|d}tjddkr,td|}||_nt|dd|_tj|jf|j|_dS)Nrrr{zutf-8r[rB)	rjrrrrrcsvrHr)rrarr,r,r-r0szCSVReader.__init__cCs|S)Nr,)rr,r,r-__iter__;szCSVReader.__iter__cCsJt|j}tjddkrFx,t|D] \}}t|ts"|d||<q"W|S)Nrr{zutf-8)nextrHrjrr2rnrr)rr(rUrr,r,r-r>s

zCSVReader.nextN)rrrrrr__next__r,r,r,r-r/src@seZdZddZddZdS)	CSVWritercKs$t|d|_tj|jf|j|_dS)Nr)rrrwriterr)rrTrar,r,r-rIszCSVWriter.__init__cCsRtjddkrBg}x*|D]"}t|tr0|d}||qW|}|j|dS)Nrr{zutf-8)rjrrnrrr"rwriterow)rrowrBrr,r,r-rMs


zCSVWriter.writerowN)rrrrrr,r,r,r-rHsrcsHeZdZeejZded<dfdd	ZddZdd	Zd
dZ	Z
S)
Configuratorinc_convertZincNcs"tt|||pt|_dS)N)superrrrZrrc)rconfigrc)	__class__r,r-r`szConfigurator.__init__c
sfddd}t|s*|}dd}dd}|r\tfdd|D}fd	dD}t|}|||}|rx$|D]\}}	t|||	qW|S)
Ncszt|ttfr*t|fdd|D}nLt|trld|krH|}qvi}x(|D]}||||<qRWn
|}|S)Ncsg|]}|qSr,r,)rHrU)convertr,r-rIgszBConfigurator.configure_custom.<locals>.convert.<locals>.<listcomp>z())rnrrwtypedictconfigure_customr)or(r)rrr,r-res


z.Configurator.configure_custom.<locals>.convertz()rz[]r,csg|]}|qSr,r,)rHr)rr,r-rIzsz1Configurator.configure_custom.<locals>.<listcomp>cs$g|]}t|r||fqSr,)r)rHr)rrr,r-rI{s)rarrrwrrsetattr)
rrrtpropsr`rrar(r=rEr,)rrrr-rds


zConfigurator.configure_customcCs4|j|}t|tr0d|kr0|||j|<}|S)Nz())rrnrr)rryr(r,r,r-__getitem__s
zConfigurator.__getitem__c	CsFtj|stj|j|}tj|ddd}t|}WdQRX|S)z*Default converter for the inc:// protocol.rBzutf-8)rN)	rZr[isabsr$rcrrrr)rrrr(r,r,r-rs
zConfigurator.inc_convert)N)rrrrrZvalue_convertersrrrr
__classcell__r,r,)rr-r[s
rc@s*eZdZdZd
ddZddZdd	ZdS)SubprocessMixinzC
    Mixin for running subprocesses and capturing their output
    FNcCs||_||_dS)N)verboseprogress)rrrr,r,r-rszSubprocessMixin.__init__cCsn|j}|j}xT|}|sP|dk	r0|||q|sBtjdntj|dtjqW|dS)z
        Read lines from a subprocess' output stream and either pass to a progress
        callable (if specified) or write progress information to sys.stderr.
        Nrzutf-8)	rrreadlinerjstderrrrflushr)rrrrrr+r,r,r-rHszSubprocessMixin.readercKstj|ftjtjd|}tj|j|jdfd}|tj|j|jdfd}||	|
|
|jdk	r|ddn|jrt
jd|S)N)stdoutrr)rr`rzdone.mainzdone.
)
subprocessPopenPIPE	threadingThreadrHrr8rwaitr$rrrjr)rcmdrarsZt1Zt2r,r,r-run_commands
zSubprocessMixin.run_command)FN)rrrrVrrHrr,r,r,r-rs
rcCstdd|S)z,Normalize a python package name a la PEP 503z[-_.]+r6)r9subrp)rJr,r,r-normalize_namesrc@s.eZdZdZdZd
ddZddZdd	ZdS)
PyPIRCFilezhttps://upload.pypi.org/legacy/pypiNcCs.|dkrtjtjdd}||_||_dS)Nrz.pypirc)rZr[r$r"r<rL)rrTrLr,r,r-rszPyPIRCFile.__init__c
Csi}tj|jr|jp|j}t}||j|	}d|kr2|
dd}dd|dD}|gkr~d|kr|dg}nx|D]}d|i}|
|d|d<xHd	|jfd
|jfdfD].\}}	|
||r|
||||<q|	||<qW|dkr||jdfkr|j|d	<q|d|kr|d	|kri}qWnRd|krd}|
|d	r\|
|d	}n|j}|
|d|
|d
|||jd}|S)N	distutilsz
index-serverscSs g|]}|dkr|qS)r)rM)rHserverr,r,r-rIsz#PyPIRCFile.read.<locals>.<listcomp>rrrr,
repositoryrealm)r-Nzserver-loginr-)r,r-rrr)rZr[rr<rLDEFAULT_REPOSITORYrRawConfigParserrrrDrv
DEFAULT_REALM
has_option)
rr(rrr
index_servers_serversrryrrr,r,r-rsN








zPyPIRCFile.readc	Cslt}|j}|||ds,|d|dd||dd|t|d}||WdQRXdS)Nrr,r-r)	rrr<rhas_sectionrrrr)rr,r-rrTrr,r,r-rs


zPyPIRCFile.update)NN)rrrrrrrrr,r,r,r-rs

:rcCst|jdS)zG
    Read the PyPI access configuration as supported by distutils.
    )rL)rrLr)ryr,r,r-_load_pypirc srcCst|j|jdS)N)rrr,r-)ryr,r,r-
_store_pypirc&srcCstjdkrFdtjkrdSdtjkr.dSdtjkr@dStjSdtjkrZtjdStjd	ksnttd
sttjSt\}}}}}|	dd}|	d
d	dd}|dddkrd||fS|dddkr(|ddkrd}dt
|dd|ddf}ddd}|d|tj7}n|dddkrLdd lm
}|S|dd!d"krd"}td#tj}||}|r|}n>|dd!d$krddl}	ddl}
|	|
j|||\}}}d%|||fS)&aReturn a string that identifies the current platform.  This is used mainly to
    distinguish platform-specific build directories and platform-specific built
    distributions.  Typically includes the OS name and version and the
    architecture (as supplied by 'os.uname()'), although the exact information
    included depends on the OS; eg. on Linux, the kernel version isn't
    particularly important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.

    ramd64z	win-amd64z(arm)z	win-arm32z(arm64)z	win-arm64_PYTHON_HOST_PLATFORMrunamerYrr5rWr6Nlinuxz%s-%ssunosr5solarisz%d.%sr{32bit64bit)ilz.%saix)aix_platformcygwinz[\d.]+darwinz%s-%s-%s)rZrJrjrNrpplatformr rir r!intmaxsizeZ_aix_supportr*r9rASCIIrr_osx_supportdistutils.sysconfigget_platform_osx	sysconfigget_config_vars)osnamerreleaserNmachinebitnessr*rel_rer'r2rr,r,r-get_host_platform.sL


 


r<win32z	win-amd64z	win-arm32)Zx86Zx64ZarmcCs2tjdkrtStjd}|tkr*tSt|S)NrZVSCMD_ARG_TGT_ARCH)rZrJr<r rD_TARGET_TO_PLAT)Zcross_compilation_targetr,r,r-get_platforms
r?)NN)r)N)N)NT)rcollectionsr
contextlibrZglobrrrrloggingrZrr9rrImportErrorrrjrrrrZdummy_threadingrrrcompatrrrr	r
rrr
rrrrrrrrrrrrr	getLoggerrrrrrCrBr4r;r8rPr#r<rXrgrlrorurzrrcontextmanagerrrrrrrrrrVERBOSErrr&r(r*r.r1r4Ir;r7r>r?r@rCrJrLrMrOrPrWrcZARCHIVE_EXTENSIONSrrrrrrrrrrrrrrrrrrrrrrrrrrrr<r>r?r,r,r,r-<module>s
\








Y}

	/
	8

)



,H
6]


!)7.QR