/usr/local/lib/python3.6/site-packages/distlib/__pycache__
NameSizeModeActions
compat.cpython-36.pyc315800644editdlrm
database.cpython-36.pyc430950644editdlrm
index.cpython-36.pyc170910644editdlrm
locators.cpython-36.pyc385820644editdlrm
manifest.cpython-36.pyc103070644editdlrm
markers.cpython-36.pyc52970644editdlrm
metadata.cpython-36.pyc276730644editdlrm
resources.cpython-36.pyc108460644editdlrm
scripts.cpython-36.pyc115000644editdlrm
util.cpython-36.pyc518470644editdlrm
version.cpython-36.pyc208310644editdlrm
wheel.cpython-36.pyc277940644editdlrm
__init__.cpython-36.pyc9970644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/distlib/__pycache__/util.cpython-36.pyc (51847B)
3 0Dgz@sddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl 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/e j0e1Z2e j3dZ4e j3dZ5e j3d Z6e j3d Z7e j3d Z8e j3d Z9e j3d Z:e j3dZ;ddZddZ?ddZ@dddZAddZBddZCdd ZDejEd!d"ZFejEd#d$ZGejEdd&d'ZHGd(d)d)eIZJd*d+ZKGd,d-d-eIZLd.d/ZMGd0d1d1eIZNe j3d2e jOZPd3d4ZQdd5d6ZRdd8d9ZSd:d;ZTdd?ZVd@dAZWe j3dBe jXZYe j3dCZZddDdEZ[e j3dFZ\dGdHZ]dIdJZ^dKdLZ_dMZ`dNdOZadPdQZbGdRdSdSeIZcGdTdUdUeIZdGdVdWdWeIZedZfdd_d`ZgdadbZhdZiGdidjdjeIZje j3dkZke j3dlZle j3dmZmdndoZdpdqZnerddrlmoZpmqZqmrZrGdsdtdte$jsZsGdudvdvepZoGdwdxdxeoe&ZtGdydzdze%juZuerGd{d|d|e%jvZvGd}d~d~e%jwZwddZxGdddeIZyGdddeyZzGdddeyZ{Gddde'Z|GdddeIZ}ddZ~GdddeIZddZddZddZddddZddZdS)N)deque)iglob)DistlibException) string_types text_typeshutil raw_inputStringIOcache_from_sourceurlopenurljoinhttplib xmlrpclib HTTPHandlerBaseConfigurator valid_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). cSs2tj|}|r.|jd}||jd}n|s.marker_varcs|rR|ddkrR|ddj\}}|ddkr@td||ddj}n^|\}}xL|rtj|}|stP|jd}||jd}|\}}|||d}q`W|}||fS)Nr(r)zunterminated parenthesis: %s)oplhsrhs)r$r MARKER_OPrrr)r%r'r2r&r1r3)markerr.r,r- marker_exprds       z!parse_marker..marker_exprcsV|\}}x@|rLtj|}|s"P||jd}|\}}d||d}qW||fS)Nand)r1r2r3)ANDrr)r%r2r&r3)r6r,r- marker_andws   z parse_marker..marker_andcsV|\}}x@|rLtj|}|s"P||jd}|\}}d||d}qW||fS)Nor)r1r2r3)ORrr)r%r2r&r3)r9r,r-r5s   zparse_marker..markerr,) marker_stringr,)r5r9r6r.r- parse_marker6s $ r=cCs2|j}| s|jdrdStj|}|s6td||jd}||jd}d}}}}|op|ddkr<|jdd}|dkrtd||d|} ||ddj}g}xx| r0tj| }|std | |j |jd| |jd} | sP| dd krtd | | ddj} qW|s.get_versionsr/r0zunterminated parenthesis: %szinvalid constraint: %sz~=;zinvalid requirement: %szunexpected trailing data: %sz%s %sz, cSsg|] }d|qS)z%s %sr,).0conr,r,r- sz%parse_requirement..)nameextras constraintsr5url requirement)strip startswithrrrrrfindr$r! NON_SPACErschemenetlocrCrDr=r#r)reqr%r&distnamerN mark_exprrFuriir+trH_rGrsr,r,r-parse_requirements                           r`cCsdd}i}x|D]\}}}tjj||}xt|D]t}tjj||} x`t| D]T} ||| } |dkrt|j| dqP||| } |jtjjdjd} | d| || <qPWq4WqW|S)z%Find destinations for resources filescSsD|jtjjd}|jtjjd}|j|s.t|t|djdS)N/)r ospathseprSAssertionErrorlenr$)rootrcr,r,r- get_rel_pathsz)get_resources_dests..get_rel_pathNra)rbrcr#rpopr rdrstrip)resources_rootrulesrh destinationsbasesuffixdestprefixabs_baseabs_globabs_path resource_filerel_pathrel_destr,r,r-get_resources_dests s  rxcCs(ttdrd}ntjttdtjk}|S)N real_prefixT base_prefix)hasattrsysrqgetattr)r'r,r,r-in_venv&s r~cCstj}t|tst|}|S)N)r| executable isinstancerr)r'r,r,r-get_executable0s  rcCsT|}xJt|}|}| r |r |}|r|dj}||kr:P|rd|||f}qW|S)Nrz %c: %s %s)r lower)prompt allowed_chars error_promptdefaultpr+cr,r,r-proceedBs  rcCs<t|tr|j}i}x |D]}||kr||||<qW|S)N)rrsplit)dkeysr'keyr,r,r-extract_by_keyRs  rcCstjddkrtjd|}|j}t|}yrtj|}|ddd}xR|jD]F\}}x<|jD]0\}}d||f}t |} | dk st | ||<qdWqRW|St k r|j ddYnXdd } t j} y| | |Wn<t jk r|jtj|}t|}| | |YnXi}xb| jD]V} i|| <}xB| j| D]4\} }d| |f}t |} | dk spt | || <qFWq*W|S) Nrzutf-8 extensionszpython.exportsexportsz%s = %scSs$t|dr|j|n |j|dS)N read_file)r{rreadfp)cpstreamr,r,r- read_streamps  z!read_exports..read_stream)r| version_infocodecs getreaderreadr jsonloaditemsget_export_entryre Exceptionseekr ConfigParserMissingSectionHeaderErrorclosetextwrapdedentsections)rdatajdatar'groupentrieskrGr+entryrrrrMvaluer,r,r- read_exports\sD      rcCstjddkrtjd|}tj}x||jD]p\}}|j|x\|jD]P}|j dkr`|j }nd|j |j f}|j rd|dj |j f}|j ||j|qJWq.W|j|dS)Nrrzutf-8z%s:%sz%s [%s]z, )r|rr getwriterrrr add_sectionvaluesrorqflagsr#setrMwrite)rrrrrGrr+r,r,r- write_exportss  rc cs$tj}z |VWdtj|XdS)N)tempfilemkdtemprrmtree)tdr,r,r-tempdirs rc cs.tj}ztj|dVWdtj|XdS)N)rbgetcwdchdir)rcwdr,r,r-rs   rc cs.tj}ztj|dVWdtj|XdS)N)socketgetdefaulttimeoutsetdefaulttimeout)secondsctor,r,r-socket_timeouts   rc@seZdZddZdddZdS)cached_propertycCs ||_dS)N)func)selfrr,r,r-__init__szcached_property.__init__NcCs,|dkr |S|j|}tj||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||jd}xtj|krj|jtjqRW|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. rarzpath '%s' cannot be absoluterzpath '%s' cannot end with '/')rbrd ValueErrorrcurdirremovercr#)pathnamepathsr,r,r- convert_paths       rc@seZdZd$ddZddZddZdd Zd%d d Zd&ddZddZ ddZ ddZ ddZ ddZ d'ddZddZddZd d!Zd"d#Zd S)( FileOperatorFcCs||_t|_|jdS)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|jj|dS)N)rradd)rrcr,r,r-record_as_writtenszFileOperator.record_as_writtencCsHtjj|s tdtjj|tjj|s0dStj|jtj|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)rbrcexistsrabspathstatst_mtime)rsourcetargetr,r,r-newers  zFileOperator.newerTcCs|jtjj|tjd|||jsd}|rftjj|rDd|}n"tjj|rftjj | rfd|}|rvt |dt j |||j |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_dirrbrcdirnameloggerinforislinkrisfilerrcopyfiler)rinfileoutfilecheckmsgr,r,r- copy_file s    zFileOperator.copy_fileNc Cstjj| st|jtjj|tjd|||jsx|dkrLt |d}nt j |d|d}zt j ||Wd|j X|j|dS)NzCopying stream %s to %swbw)encoding)rbrcisdirrerrrrropenrr copyfileobjrr)rinstreamrr outstreamr,r,r- copy_streams  zFileOperator.copy_streamc Cs\|jtjj||jsNtjj|r.tj|t|d}|j|WdQRX|j |dS)Nr) rrbrcrrrrrrr)rrcrfr,r,r-write_binary_file)s   zFileOperator.write_binary_filecCs|j||j|dS)N)rencode)rrcrrr,r,r-write_text_file2szFileOperator.write_text_filecCsrtjdkstjdkrntjdkrnxN|D]F}|jrAszFileOperator.cCs~tjj|}||jkrztjj| rz|jj|tjj|\}}|j|tj d||j shtj ||j rz|j j|dS)Nz Creating %s)rbrcrrrrrrrrrmkdirrr)rrcrrr,r,r-rCs    zFileOperator.ensure_dirc Cst|| }tjd|||js|s0|j||rX|s:d}n|j|sHt|t|d}i}|rtt drt |t j s~t j j }||d<t j |||df||j||S)NzByte-compiling %s to %sPycInvalidationModeinvalidation_modeT)r rrrrrSrerfr{ py_compilerr  CHECKED_HASHcompiler) rrcoptimizeforcerqhashed_invalidationdpathdiagpathcompile_kwargsr,r,r- byte_compileOs    zFileOperator.byte_compilecCstjj|rtjj|r`tjj| r`tjd||jsBtj ||j r||j kr|j j |nPtjj|rrd}nd}tjd|||jstj ||j r||j kr|j j |dS)NzRemoving directory tree at %slinkfilezRemoving %s %s)rbrcrrrrdebugrrrrrrr)rrcr+r,r,r-ensure_removedbs"       zFileOperator.ensure_removedcCsHd}x>|sBtjj|r&tj|tj}Ptjj|}||kr)rMrqror)rr,r,r-__repr__szExportEntry.__repr__cCsDt|tsd}n0|j|jko>|j|jko>|j|jko>|j|jk}|S)NF)rr4rMrqror)rotherr'r,r,r-__eq__s  $ zExportEntry.__eq__N) rrrrrrr5r7r__hash__r,r,r,r-r4s  r4z(?P([^\[]\S*)) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? c Cstj|}|s0d}d|ks"d|krtd|n|j}|d}|d}|jd}|dkrf|d}}n"|dkrztd||jd\}}|d } | dkrd|ksd|krtd|g} nd d | jd D} t|||| }|S) Nr?r@zInvalid specification '%s'rMcallable:rrrcSsg|] }|jqSr,)rR)rJrr,r,r-rLsz$get_export_entry..rA)ENTRY_REsearchr groupdictcountrr4) specificationr&r'rrMrccolonsrqrorr,r,r-rs2    rc Cs|dkr d}tjdkr.dtjkr.tjjd}n tjjd}tjj|rftj|tj}|st j d|n|jdd\}}d|kr.|}n|jdd\}}|rJt|}|rVt|}|||fS)NrBrr:)rsplitrr)rWusernamepasswordrqr,r,r-parse_credentials/srUcCstjd}tj||S)N)rbumask)r'r,r,r-get_process_umask>s  rXcCs>d}d}x$t|D]\}}t|tsd}PqW|dk s:t|S)NTF) enumeraterrre)seqr'r\r+r,r,r-is_string_sequenceDs  r[z3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z -py(\d\.?\d?)cCsd}d}t|jdd}tj|}|r@|jd}|d|j}|rt|t|dkrtjtj |d|}|r|j }|d|||dd|f}|dkrt j|}|r|jd|jd|f}|S)zw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None N -rz\br) rr PYTHON_VERSIONr<rstartrfrerescaperPROJECT_NAME_AND_VERSION)filename project_namer'pyverr&nr,r,r-split_filenameTs"   rgz-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$cCs:tj|}|std||j}|djj|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'rMver)NAME_VERSION_RErrr=rRr)rr&rr,r,r-parse_name_and_versionrs  rjcCst}t|pg}t|pg}d|kr8|jd||O}x|D]x}|dkrV|j|q>|jdr|dd}||krtjd|||kr|j|q>||krtjd||j|q>W|S)N*r]rzundeclared extra: %s)rrrrSrrH) requested availabler'runwantedr,r,r- get_extrass&        rpcCsi}yNt|}|j}|jd}|jds8tjd|ntjd|}tj |}Wn0t k r}ztj d||WYdd}~XnX|S)Nz Content-Typezapplication/jsonz(Unexpected response for JSON request: %szutf-8z&Failed to get external data for %s: %s) r rgetrSrrrrrrr exception)rPr'respheadersctreaderer,r,r-_get_external_datas   rxz'https://www.red-dove.com/pypi/projects/cCs*d|dj|f}tt|}t|}|S)Nz%s/%s/project.jsonr)upperr _external_data_base_urlrx)rMrPr'r,r,r-get_project_datas r{cCs(d|dj||f}tt|}t|S)Nz%s/%s/package-%s.jsonr)ryr rzrx)rMversionrPr,r,r-get_package_datas r}c@s*eZdZdZddZd ddZddZd S) 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. cCsPtjj|stj|tj|jd@dkr6tjd|tjjtjj ||_ dS)zu Initialise an instance. :param base: The base directory where the cache should be located. ?rzDirectory '%s' is not privateN) rbrcrrIrrrrHrnormpathrn)rrnr,r,r-rs    zCache.__init__TcCs t||dS)zN Converts a resource prefix to a directory name in the cache. )rN)rO)rrqrNr,r,r- prefix_to_dirszCache.prefix_to_dirc Csg}xtj|jD]r}tjj|j|}y>tjj|s@tjj|rLtj|ntjj|rbt j |Wqt k r|j |YqXqW|S)z" Clear the cache. ) rbr&rnrcr#rrrrrrrr!)r not_removedfnr,r,r-clears  z Cache.clearN)T)rrr__doc__rrrr,r,r,r-r~s r~c@s:eZdZdZddZdddZddZd d Zd d 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|j|n |j|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)rrr! appendleft)revent subscriberr!subssqr,r,r-rs  zEventMixin.addcCs,|j}||krtd|||j|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)rrr)rrrrr,r,r-r s zEventMixin.removecCst|jj|fS)z Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. )iterrrq)rrr,r,r-get_subscribersszEventMixin.get_subscribersc Ospg}xT|j|D]F}y||f||}Wn"tk rJtjdd}YnX|j|qWtjd|||||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)rrrrrr!r)rrargskwargsr'rrr,r,r-publishs   zEventMixin.publishN)T) rrrrrrrrrr,r,r,r-rs   rc@s^eZdZddZddZdddZdd Zd d Zd d ZddZ e ddZ e ddZ dS) SequencercCsi|_i|_t|_dS)N)_preds_succsr_nodes)rr,r,r-r:szSequencer.__init__cCs|jj|dS)N)rr)rnoder,r,r-add_node?szSequencer.add_nodeFcCs||jkr|jj||rx&t|jj|fD]}|j||q.Wx&t|jj|fD]}|j||qVWx&t|jjD]\}}|sz|j|=qzWx&t|jjD]\}}|s|j|=qWdS)N)rrrrrqrr$r)rredgesrr+rrGr,r,r- remove_nodeBs   zSequencer.remove_nodecCs<||ks t|jj|tj||jj|tj|dS)N)rer setdefaultrrr)rpredsuccr,r,r-rRs z Sequencer.addcCs||ks ty|j|}|j|}Wn tk rDtd|YnXy|j||j|Wn$tk rtd||fYnXdS)Nz%r not a successor of anythingz%r not a successor of %r)rerrKeyErrorrr)rrrpredssuccsr,r,r-rWs   zSequencer.removecCs||jkp||jkp||jkS)N)rrr)rstepr,r,r-is_stepdszSequencer.is_stepcCs|j|std|g}g}t}|j|xd|r|jd}||krd||kr|j||j|q0|j||j||jj|f}|j |q0Wt |S)Nz Unknown: %rr) rrrr!rirrrrqextendreversed)rfinalr'todoseenrrr,r,r- get_stepsgs"        zSequencer.get_stepscsVdggiig|jfddxD]}|kr:|q:WS)Nrc sd|<d|<dd7<j|y |}Wntk rVg}YnXxR|D]J}|kr|t|||<q^|kr^t|||<q^W||krg}x j}|j|||krPqWt|}j|dS)Nrr)r!rminrituple)r successors successorconnected_component component)graphindex index_counterlowlinksr'stack strongconnectr,r-rs.       z3Sequencer.strong_connections..strongconnect)r)rrr,)rrrrr'rrr-strong_connectionss#  zSequencer.strong_connectionscCsrdg}x8|jD].}|j|}x|D]}|jd||fq"WqWx|jD]}|jd|qHW|jddj|S)Nz digraph G {z %s -> %s;z %s;} )rr!rr#)rr'rrrrr,r,r-dots     z Sequencer.dotN)F) rrrrrrrrrrpropertyrrr,r,r,r-r8s   4r.tar.gz.tar.bz2.tar.zip.tgz.tbz.whlc sffdd}tjjtd}|dkr|jdr>d}nH|jdrRd}d }n4|jdrfd }d }n |jdrzd}d}n td|z|dkrt|d}|r|j}xD|D] }||qWn.tj ||}|r|j }x|D] }||qW|dkr6t j ddkr6x.|j D]"} t| jts| jjd| _qWdd} | |_|jWd|r`|jXdS)NcsTt|ts|jd}tjjtjj|}|j sD|tjkrPt d|dS)Nzutf-8zpath outside destination: %r) rrdecoderbrcrr#rSrdr)rcr)dest_dirplenr,r- check_paths   zunarchive..check_path.zip.whlzip.tar.gz.tgztgzzr:gz.tar.bz2.tbztbzzr:bz2z.tartarrnzUnknown format for %rrrzutf-8cSsBy tj||Stjk r<}ztt|WYdd}~XnXdS)z9Run tarfile.tar_filter, but raise the expected ValueErrorN)tarfileZ tar_filterZ FilterErrorrstr)memberrcexcr,r,r-extraction_filters z$unarchive..extraction_filter)rr)rr)rr)rbrcrrfrPrrnamelistrrgetnamesr|r getmembersrrMrrr extractallr) archive_filenamerformatrrarchiver namesrMtarinforr,)rrr- unarchivesL           rc Cstj}t|}t|db}xZtj|D]L\}}}x@|D]8}tjj||}||d} tjj| |} |j|| q8Wq(WWdQRX|S)z*zip a directory tree into a BytesIO objectrN) ioBytesIOrfrrbwalkrcr#r) directoryr'dlenzfrgr(rrMfullrelrpr,r,r-zip_dir s   rrKMGTPc@sreZdZdZdddZddZdd Zd d Zd d Ze ddZ e ddZ ddZ e ddZ e ddZdS)ProgressUNKNOWNrdcCs<|dks||kst||_|_||_d|_d|_d|_dS)NrF)rercurmaxstartedelapseddone)rminvalmaxvalr,r,r-r$s  zProgress.__init__cCsV|j|kst|jdks&||jks&t||_tj}|jdkrF||_n ||j|_dS)N)rrerrtimerr)rcurvalnowr,r,r-update,s zProgress.updatecCs |dks t|j|j|dS)Nr)rerr)rincrr,r,r- increment6s zProgress.incrementcCs|j|j|S)N)rr)rr,r,r-r_:s zProgress.startcCs |jdk r|j|jd|_dS)NT)rrr)rr,r,r-stop>s  z Progress.stopcCs|jdkr|jS|jS)N)runknown)rr,r,r-maximumCszProgress.maximumcCsD|jr d}n4|jdkrd}n$d|j|j|j|j}d|}|S)Nz100 %z ?? %gY@z%3d %%)rrrr)rr'rGr,r,r- percentageGs zProgress.percentagecCs:|dkr|jdks|j|jkr$d}ntjdtj|}|S)Nrz??:??:??z%H:%M:%S)rrrrstrftimegmtime)rdurationr'r,r,r-format_durationRszProgress.format_durationcCs|jrd}|j}n^d}|jdkr&d}nJ|jdks<|j|jkrBd}n.t|j|j}||j|j}|d|j}d||j|fS)NDonezETA rrz%s: %sr)rrrrrfloatr)rrqr]r,r,r-ETA[s z Progress.ETAcCsN|jdkrd}n|j|j|j}xtD]}|dkr6P|d}q(Wd||fS)Nrgig@@z%d %sB/s)rrrUNITS)rr'unitr,r,r-speedns   zProgress.speedN)rr)rrrrrrrr_rrrrrrrr,r,r,r-r!s     rz \{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$cCs<tj|rd}t||tj|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_GLOBr<r_CHECK_MISMATCH_SET_iglob) path_globrr,r,r-rs    rc cstj|d}t|dkrpt|dks,t||\}}}x|jdD](}x"tdj|||fD] }|Vq\WqBWnd|krxt|D] }|VqWn|jdd\}}|dkrd}|dkrd}n|jd}|jd }xHtj |D]:\}}} tj j |}x"ttj j||D] } | VqWqWdS) NrrrArz**r-rkra\) RICH_GLOBrrfrer r# std_iglobr$rbrrcr) r rich_path_globrqrroitemrcradicaldirrrr,r,r-r s*       r ) HTTPSHandlermatch_hostnameCertificateErrorc@seZdZdZdZddZdS)HTTPSConnectionNTc Cs tj|j|jf|j}t|ddr0||_|jtj tj }t tdrV|j tj O_ t|ddrr|j|j|ji}|jrtj|_|j|jdttddr|j|d<|j|f||_|jo|jry$t|jj|jtjd|jWn0tk r|jjtj|jjYnXdS) N _tunnel_hostF OP_NO_SSLv2 cert_file)cafileHAS_SNIserver_hostnamezHost verified: %s)rcreate_connectionhostporttimeoutr}sock_tunnelssl SSLContextPROTOCOL_SSLv23r{optionsrload_cert_chainrkey_fileca_certs CERT_REQUIRED verify_modeload_verify_locations wrap_socket check_domainr getpeercertrrrshutdown SHUT_RDWRr)rr"contextrr,r,r-connects0       zHTTPSConnection.connect)rrrr*r/r4r,r,r,r-rsrc@s&eZdZd ddZddZddZdS) rTcCstj|||_||_dS)N)BaseHTTPSHandlerrr*r/)rr*r/r,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. )rr*r/)rrrr'r,r,r- _conn_makers zHTTPSHandler._conn_makercCsVy|j|j|Stk rP}z&dt|jkr>td|jnWYdd}~XnXdS)Nzcertificate verify failedz*Unable to verify server certificate for %s)do_openr6rrreasonrr)rrXrwr,r,r- https_opens zHTTPSHandler.https_openN)T)rrrrr6r9r,r,r,r-rs rc@seZdZddZdS)HTTPSOnlyHandlercCstd|dS)NzAUnexpected HTTP request on what should be a secure connection: %s)r)rrXr,r,r- http_openszHTTPSOnlyHandler.http_openN)rrrr;r,r,r,r-r:sr:c@seZdZdddZddZdS) TransportrcCs||_tjj||dS)N)r!rr<r)rr! use_datetimer,r,r-r szTransport.__init__cCsF|j|\}}}|j s&||jdkr<||_|tj|f|_|jdS)Nrr) get_host_info _connection_extra_headersrHTTPConnection)rrhehx509r,r,r-make_connection s zTransport.make_connectionN)r)rrrrrEr,r,r,r-r<s r<c@seZdZdddZddZdS) SafeTransportrcCs||_tjj||dS)N)r!rrFr)rr!r=r,r,r-rszSafeTransport.__init__cCs^|j|\}}}|si}|j|d<|j s8||jdkrT||_|tj|df|f|_|jdS)Nr!rr)r>r!r?r@rr)rrrBrCrr,r,r-rEs zSafeTransport.make_connectionN)r)rrrrrEr,r,r,r-rFs rFc@seZdZddZdS) ServerProxycKst|jdd|_}|dk r^t|d}|jdd}|dkr@t}nt}|||d|d<}||_tjj ||f|dS)Nr!rr=https)r= transport) rir!rrqrFr<rIrrGr)rr[rr!rVr=tclsr]r,r,r-r*s  zServerProxy.__init__N)rrrrr,r,r,r-rG(srGcKs6tjddkr|d7}nd|d<d|d<t||f|S)Nrrbrnewlinezutf-8r)r|rr)rr rr,r,r- _csv_openAs  rMc@s4eZdZedededdZddZddZd S) CSVBaserA"r) delimiter quotecharlineterminatorcCs|S)Nr,)rr,r,r- __enter__SszCSVBase.__enter__cGs|jjdS)N)rr)rrDr,r,r-__exit__VszCSVBase.__exit__N)rrrrdefaultsrSrTr,r,r,r-rNLs  rNc@s(eZdZddZddZddZeZdS) CSVReadercKs\d|kr4|d}tjddkr,tjd|}||_nt|dd|_tj|jf|j|_dS)Nrrrzutf-8rcrn) r|rrrrrMcsvrvrU)rrrr,r,r-r\szCSVReader.__init__cCs|S)Nr,)rr,r,r-__iter__gszCSVReader.__iter__cCsJt|j}tjddkrFx,t|D] \}}t|ts"|jd||<q"W|S)Nrrzutf-8)nextrvr|rrYrrr)rr'r\rr,r,r-rYjs   zCSVReader.nextN)rrrrrXrY__next__r,r,r,r-rVZs rVc@seZdZddZddZdS) CSVWritercKs$t|d|_tj|jf|j|_dS)Nr)rMrrWwriterrU)rrrr,r,r-rws zCSVWriter.__init__cCsRtjddkrBg}x*|D]"}t|tr0|jd}|j|qW|}|jj|dS)Nrrzutf-8)r|rrrrr!r\writerow)rrowrnrr,r,r-r]{s   zCSVWriter.writerowN)rrrrr]r,r,r,r-r[usr[csHeZdZeejZded<d fdd ZddZdd Zd d Z Z S) Configurator inc_convertincNcs"tt|j||ptj|_dS)N)superr_rrbrrn)rconfigrn) __class__r,r-rszConfigurator.__init__c sfddjd}t|s*j|}jdd}jdf}|r\tfdd|D}fddD}t|}|||}|rx$|jD]\}} t||| qW|S) Ncszt|ttfr*t|fdd|D}nLt|trld|krHj|}qvi}x(|D]}||||<qRWn j|}|S)Ncsg|] }|qSr,r,)rJr\)convertr,r-rLszBConfigurator.configure_custom..convert..z())rr$rtypedictconfigure_customre)or'r)rerr,r-res    z.Configurator.configure_custom..convertz()r-z[]csg|] }|qSr,r,)rJri)rer,r-rLsz1Configurator.configure_custom..cs$g|]}t|r||fqSr,)r)rJr)rcrer,r-rLs)rir9r3rrgrsetattr) rrcrpropsrrrr'rfrGr,)rcrerr-rhs     zConfigurator.configure_customcCs4|j|}t|tr0d|kr0|j||j|<}|S)Nz())rcrrgrh)rrr'r,r,r- __getitem__s zConfigurator.__getitem__c CsFtjj|stjj|j|}tj|ddd}tj|}WdQRX|S)z*Default converter for the inc:// protocol.rnzutf-8)rN) rbrcisabsr#rnrrrr)rrrr'r,r,r-r`s  zConfigurator.inc_convert)N) rrrrgrvalue_convertersrrhrlr` __classcell__r,r,)rdr-r_s   r_c@s*eZdZdZd ddZddZdd ZdS) SubprocessMixinzC Mixin for running subprocesses and capturing their output FNcCs||_||_dS)N)verboseprogress)rrqrrr,r,r-rszSubprocessMixin.__init__cCsn|j}|j}xT|j}|sP|dk r0|||q|sBtjjdntjj|jdtjjqW|jdS)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) rrrqreadliner|stderrrrflushr)rrr3rrrqr+r,r,r-rvs zSubprocessMixin.readercKstj|ftjtjd|}tj|j|jdfd}|jtj|j|jdfd}|j|j |j |j |j dk r|j ddn|j rt jjd|S)N)stdoutrtrv)rrrtzdone.mainzdone. ) subprocessPopenPIPE threadingThreadrvrvr_rtwaitr#rrrqr|r)rcmdrrt1t2r,r,r- run_commands  zSubprocessMixin.run_command)FN)rrrrrrvrr,r,r,r-rps rpcCstjdd|jS)z,Normalize a python package name a la PEP 503z[-_.]+r])r`subr)rMr,r,r-normalize_namesrc@s.eZdZdZdZd ddZddZdd ZdS) PyPIRCFilezhttps://upload.pypi.org/legacy/pypiNcCs.|dkrtjjtjjdd}||_||_dS)NrCz.pypirc)rbrcr#rGrcrP)rrrPr,r,r-rszPyPIRCFile.__init__c Csi}tjj|jr|jp|j}tj}|j|j|j }d|kr2|j dd}dd|j dD}|gkr~d|kr|dg}nx|D]}d|i}|j |d|d<xHd |jfd |j fdfD].\}} |j ||r|j ||||<q| ||<qW|dkr||jdfkr|j|d <q|d|kr|d |kri}qWnRd |krd }|j |d r\|j |d }n|j}|j |d|j |d |||j d }|S)N distutilsz index-serverscSs g|]}|jdkr|jqS)r)rR)rJserverr,r,r-rLsz#PyPIRCFile.read..rrrrS repositoryrealmrTz server-login)rSrTrrr)rTN)rbrcrrcrPDEFAULT_REPOSITORYrRawConfigParserrrrqr DEFAULT_REALM has_option) rr'rrcr index_servers_serversrrrr,r,r-r sF             zPyPIRCFile.readc Csltj}|j}|j||jds,|jd|jdd||jdd|t|d}|j|WdQRXdS)NrrSrTr) rrrcr has_sectionrrrr)rrSrTrcrrr,r,r-rBs    zPyPIRCFile.update)NN)rrrrrrrrr,r,r,r-rs  5rcCst|jdjS)zG Read the PyPI access configuration as supported by distutils. )rP)rrPr)rr,r,r- _load_pypircOsrcCstj|j|jdS)N)rrrSrT)rr,r,r- _store_pypircVsrc CstjdkrFdtjjkrdSdtjjkr.dSdtjjkr@dStjSdtjkrZtjdStjd kspttd  rvtjStj\}}}}}|jj d d }|j d dj d d}|dddkrd||fS|dddkr*|ddkrd}dt |dd|ddf}ddd}|d|tj 7}n|dddkrNdd l m }|S|dd!d"krd"}tjd#tj}|j|}|r|j}nd|dd!d$krddl} ydd%lm} Wntk rddl} YnX| j| 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'. rAamd64z win-amd64z(arm)z win-arm32z(arm64)z win-arm64_PYTHON_HOST_PLATFORMrunamerarr\r^r]Nlinuxz%s-%ssunosr5solarisz%d.%sr32bit64bit)ilz.%saix) aix_platformcygwinz[\d.]+darwin) sysconfigz%s-%s-%s)rbrMr|r|rplatformrEr{rr intmaxsize _aix_supportrr`rASCIIrr _osx_supportrr ImportErrorget_platform_osxget_config_vars) osnamerreleaser|machinebitnessrrel_rer&rrr,r,r-get_host_platform`sP         rwin32z win-amd64z win-arm32)x86x64armcCs2tjdkrtStjjd}|tkr*tSt|S)NrAVSCMD_ARG_TGT_ARCH)rbrMrrErq_TARGET_TO_PLAT)cross_compilation_targetr,r,r- get_platforms   r)NN)r)N)T)N)rrrrrrr)NT)rrrrrr)r collectionsr contextlibrWglobrrrrloggingrbrr`rr$rrxr|rrrr{dummy_threadingrrrcompatrrrr r r r r rrrrrrrrrrrr getLoggerrrrrrDrCr4r;r8rUr"r=r`rxr~rrrrrcontextmanagerrrrrrrrr3r4VERBOSEr;rrLrOrQrUrXr[Irbr^rgrirjrprxrzr{r}r~rrARCHIVE_EXTENSIONSrrrrrr r r rr5rrrr:r<rFrGrMrNrVr[r_rprrrrrrrr,r,r,r-s      X         Z|   /   ;  )     ,I D^    !*  8.M T