U Wzf_@sTdZddlmZddlZddlZddlZddlZddlZ ddl m Z ddl m Z ddlmZddlZddlmZdd lmZdd lmZdd lmZd d ddddddgZejjZdZdZdgZGdddZ Gddde Z!e j"Z#e!j"Z$ddZ%dd Z&e j'j&je&_e(e j'j)Z*Gddde*Z)ddZ+ej,fd d!Z-Gd"d#d#e.Z/e0dS)$z@Extensions to the 'distutils' for large or complex distributions fnmatchcaseN)DistutilsOptionError) convert_path)SetuptoolsDeprecationWarning) Extension) Distribution)Require)monkeysetupr Commandrr r find_packagesfind_namespace_packagesTz lib2to3.fixesc@sBeZdZdZedddZeddZed d Zed d Z d S) PackageFinderzI Generate a list of all Python packages found within a directory .*cCs&t|t||jd||j|S)a Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '*' can be used as a wildcard in the names, such that 'foo.*' will exclude all subpackages of 'foo' (but not 'foo' itself). 'include' is a sequence of package names to include. If it's specified, only the named packages will be included. If it's not specified, all found packages will be included. 'include' can contain shell style wildcard patterns just like 'exclude'. ez_setup *__pycache__)rr)list_find_packages_iterr _build_filter)clswhereexcludeincluderrk/private/var/folders/n9/53xbvtmd7sjg1q1l55xmpg58n4mgng/T/pip-unpacked-wheel-slp6y8a5/setuptools/__init__.pyfind-s  zPackageFinder.findc cstj|ddD]\}}}|dd}g|dd<|D]d}tj||} tj| |} | tjjd} d|ks4|| sxq4|| r|| s| V||q4qdS)zy All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter. T followlinksNr) oswalkpathjoinrelpathreplacesep_looks_like_packageappend) rrrrrootdirsfilesZall_dirsdir full_pathrel_pathpackagerrrrDs  z!PackageFinder._find_packages_itercCstjtj|dS)z%Does a directory look like a package?z __init__.py)r"r$isfiler%r$rrrr)`sz!PackageFinder._looks_like_packagecs fddS)z Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns. cstfddDS)Nc3s|]}t|dVqdS))patNr).0r4namerr ksz@PackageFinder._build_filter....)anyr6patternsr6rkz-PackageFinder._build_filter..rr:rr:rreszPackageFinder._build_filterN)rrr) __name__ __module__ __qualname____doc__ classmethodrr staticmethodr)rrrrrr(s   rc@seZdZeddZdS)PEP420PackageFindercCsdS)NTrr3rrrr)osz'PEP420PackageFinder._looks_like_packageN)r>r?r@rCr)rrrrrDnsrDcCs>Gdddtjj}||}|jdd|jr:||jdS)Nc@s eZdZdZddZddZdS)z4_install_setup_requires..MinimalDistributionzl A minimal version of a distribution for supporting the fetch_build_eggs interface. cs6d}fddt|t@D}tjj||dS)N)Zdependency_linkssetup_requirescsi|]}||qSrr)r5kattrsrr szQ_install_setup_requires..MinimalDistribution.__init__..)set distutilscorer __init__)selfrHZ_inclfilteredrrGrrMs  z=_install_setup_requires..MinimalDistribution.__init__cSsdS)zl Disable finalize_options to avoid building the working set. Ref #2158. Nr)rNrrrfinalize_optionsszE_install_setup_requires..MinimalDistribution.finalize_optionsN)r>r?r@rArMrPrrrrMinimalDistribution{srQT)Zignore_option_errors)rKrLr parse_config_filesrEZfetch_build_eggs)rHrQdistrrr_install_setup_requiresxs  rTcKst|tjjf|SN)rTrKrLr rGrrrr sc@s:eZdZejZdZddZd ddZddZd d d Z dS)r FcKst||t||dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)_CommandrMvarsupdate)rNrSkwrrrrMs zCommand.__init__NcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))getattrsetattr isinstancestrr)rNoptionwhatdefaultvalrrr_ensure_stringlikes   zCommand._ensure_stringlikecCspt||}|dkrdSt|tr6t||td|n6t|trTtdd|D}nd}|sltd||fdS)zEnsure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"]. Nz,\s*|\s+css|]}t|tVqdSrU)r\r])r5vrrrr8sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rZr\r]r[resplitrallr)rNr^raokrrrensure_string_lists   zCommand.ensure_string_listrcKs t|||}t|||SrU)rVreinitialize_commandrWrX)rNcommandreinit_subcommandsrYcmdrrrriszCommand.reinitialize_command)N)r) r>r?r@rVrAZcommand_consumes_argumentsrMrbrhrirrrrr s  cCs&ddtj|ddD}ttjj|S)z% Find all files under 'path' css,|]$\}}}|D]}tj||VqqdSrU)r"r$r%)r5baser,r-filerrrr8sz#_find_all_simple..Tr )r"r#filterr$r2)r$resultsrrr_find_all_simples rqcCs6t|}|tjkr.tjtjj|d}t||}t|S)z Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. )start) rqr"curdir functoolspartialr$r&mapr)r.r-Zmake_relrrrfindalls   rwc@seZdZdZdS)sicz;Treat this string as-is (https://en.wikipedia.org/wiki/Sic)N)r>r?r@rArrrrrxsrx)1rAfnmatchrrtr"rdZ_distutils_hack.overrideZ_distutils_hackdistutils.corerKdistutils.errorsrdistutils.utilrZ_deprecation_warningrZsetuptools.version setuptoolsZsetuptools.extensionrZsetuptools.distr Zsetuptools.dependsr r __all__version __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesrrDrrrrTr rLZ get_unpatchedr rVrqrsrwr]rxZ patch_allrrrrsP        F 2