U Qabs@sdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZdd lmZmZddlZdd lmZdd lmZmZdd lmZdd lm Z e!Z"ddddddddgZ#ere#$dej%j&Z&dZ'dZ(dgZ)GdddZ*Gddde*Z+e*j,Z-er,e+j,Z.ddZ/ddZ0ej1j0je0_e 2ej1j3Z4Gd dde4Z3d!d"Z5ej6fd#d$Z7e 8dS)%z@Extensions to the 'distutils' for large or complex distributionsN)DistutilsOptionError) convert_path fnmatchcase)SetuptoolsDeprecationWarning)PY3 string_types)filtermap) Extension) DistributionFeature)Require)monkeysetupr rCommandr rr 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)clswhereexcludeincluderr7/usr/lib/python3.8/site-packages/setuptools/__init__.pyfind4s  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) rr r!r"rootdirsfilesZall_dirsdir full_pathZrel_pathpackagerrr#rKs  z!PackageFinder._find_packages_itercCstjtj|dS)z%Does a directory look like a package?z __init__.py)r'r)isfiler*r)rrr#r.gsz!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).0r8namerr# rsz@PackageFinder._build_filter....)anyr:Zpatternsr:r#rz-PackageFinder._build_filter..rr>rr>r#rlszPackageFinder._build_filterN)rrr) __name__ __module__ __qualname____doc__ classmethodr$r staticmethodr.rrrrr#r/s   rc@seZdZeddZdS)PEP420PackageFindercCsdS)NTrr7rrr#r.vsz'PEP420PackageFinder._looks_like_packageN)rArBrCrFr.rrrr#rGusrGcCs@tjtdd|D}|jdd|jr<||jdS)Ncss"|]\}}|dkr||fVqdS))Zdependency_linkssetup_requiresNr)r9kvrrr#r<sz*_install_setup_requires..T)Zignore_option_errors) distutilscorer dictitemsZparse_config_filesrHZfetch_build_eggs)attrsdistrrr#_install_setup_requiress   rQcKst|tjjf|SN)rQrKrLr)rOrrr#rsc@s:eZdZejZdZddZd ddZddZd d d Z dS)rFcKst||t||dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)_Command__init__varsupdate)selfrPkwrrr#rTs zCommand.__init__NcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))getattrsetattr isinstancer r)rWoptionZwhatdefaultvalrrr#_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|tVqdSrR)r[r )r9rJrrr#r<sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rYr[r rZresplitrallr)rWr\r^okrrr#ensure_string_lists   zCommand.ensure_string_listrcKs t|||}t|||SrR)rSreinitialize_commandrUrV)rWZcommandZreinit_subcommandsrXcmdrrr#reszCommand.reinitialize_command)N)r) rArBrCrSrDZcommand_consumes_argumentsrTr_rdrerrrr#rs  cCs&ddtj|ddD}ttjj|S)z% Find all files under 'path' css,|]$\}}}|D]}tj||VqqdSrR)r'r)r*)r9baser1r2filerrr#r<sz#_find_all_simple..Tr%)r'r(r r)r6)r)resultsrrr#_find_all_simples rjcCs6t|}|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) rjr'curdir functoolspartialr)r+r r)r3r2Zmake_relrrr#findalls   ro)9rDr'sysrmZdistutils.corerKZdistutils.filelistr`Zdistutils.errorsrZdistutils.utilrZfnmatchrZ_deprecation_warningrZsetuptools.extern.sixrr Zsetuptools.extern.six.movesr r Zsetuptools.versionZ setuptoolsZsetuptools.extensionr Zsetuptools.distr rZsetuptools.dependsrrtypeZ __metaclass____all__r/version __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesrrGr$rrrQrrLZ get_unpatchedrrSrjrlroZ patch_allrrrr#s\        F  2