U âQabsã@sˆdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZdd lmZmZddlZdd lmZdd lmZmZdd lmZdd lm Z e!Z"ddddddddgZ#eræe# $d¡ej%j&Z&dZ'dZ(dgZ)Gdd„dƒZ*Gdd„de*ƒZ+e*j,Z-e�r,e+j,Z.dd„Z/dd„Z0ej1j0je0_e  2ej1j3¡Z4Gd d„de4ƒZ3d!d"„Z5ej6fd#d$„Z7e  8¡dS)%z@Extensions to the 'distutils' for large or complex distributionséN)ÚDistutilsOptionError)Ú convert_path©Ú fnmatchcaseé)ÚSetuptoolsDeprecationWarning)ÚPY3Ú string_types)ÚfilterÚmap)Ú Extension)Ú DistributionÚFeature)ÚRequire)ÚmonkeyÚsetupr rÚCommandr rrÚ find_packagesÚfind_namespace_packagesTz lib2to3.fixesc@sBeZdZdZeddd„ƒZedd„ƒZed 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)ÚclsÚwhereÚexcludeÚincluderrú7/usr/lib/python3.8/site-packages/setuptools/__init__.pyÚfind4s  ýzPackageFinder.findc cs tj|dd�D]Œ\}}}|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) ÚosÚwalkÚpathÚjoinÚrelpathÚreplaceÚsepÚ_looks_like_packageÚappend) rr r!r"ÚrootÚdirsÚfilesZall_dirsÚdirÚ full_pathZrel_pathÚpackagerrr#rKs  z!PackageFinder._find_packages_itercCstj tj |d¡¡S)z%Does a directory look like a package?z __init__.py)r'r)Úisfiler*©r)rrr#r.gsz!PackageFinder._looks_like_packagecs ‡fdd„S)z� Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns. cst‡fdd„ˆDƒƒS)Nc3s|]}tˆ|d�VqdS))ÚpatNr)Ú.0r8©Únamerr#Ú rsz@PackageFinder._build_filter....)Úanyr:©Zpatternsr:r#Úróz-PackageFinder._build_filter..rr>rr>r#rlszPackageFinder._build_filterN)rrr) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú classmethodr$rÚ staticmethodr.rrrrr#r/s   rc@seZdZedd„ƒZdS)ÚPEP420PackageFindercCsdS)NTrr7rrr#r.vsz'PEP420PackageFinder._looks_like_packageN)rArBrCrFr.rrrr#rGusrGcCs@tj tdd„| ¡Dƒƒ¡}|jdd�|jr<| |j¡dS)Ncss"|]\}}|dkr||fVqdS))Zdependency_linksÚsetup_requiresNr)r9ÚkÚvrrr#r<„sÿz*_install_setup_requires..T)Zignore_option_errors)Ú distutilsÚcorer ÚdictÚitemsZparse_config_filesrHZfetch_build_eggs)ÚattrsÚdistrrr#Ú_install_setup_requires�s ÿ  rQcKst|ƒtjjf|ŽS©N)rQrKrLr)rOrrr#rŽsc@s:eZdZejZdZdd„Zd dd„Zdd„Zd d d „Z dS)rFcKst ||¡t|ƒ |¡dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)Ú_CommandÚ__init__ÚvarsÚupdate)ÚselfrPÚkwrrr#rTžs zCommand.__init__NcCsBt||ƒ}|dkr"t|||ƒ|St|tƒs>td|||fƒ‚|S)Nz'%s' must be a %s (got `%s`))ÚgetattrÚsetattrÚ isinstancer r)rWÚoptionZwhatÚdefaultÚvalrrr#Ú_ensure_stringlike¦s   ÿzCommand._ensure_stringlikecCspt||ƒ}|dkrdSt|tƒr6t||t d|¡ƒn6t|tƒrTtdd„|Dƒƒ}nd}|sltd||fƒ‚dS)zîEnsure 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|tƒVqdSrR)r[r )r9rJrrr#r<½sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rYr[r rZÚreÚsplitrÚallr)rWr\r^Úokrrr#Úensure_string_list°s   ÿÿzCommand.ensure_string_listrcKs t |||¡}t|ƒ |¡|SrR)rSÚreinitialize_commandrUrV)rWZcommandZreinit_subcommandsrXÚcmdrrr#reÅszCommand.reinitialize_command)N)r) rArBrCrSrDZcommand_consumes_argumentsrTr_rdrerrrr#r™s  cCs&dd„tj|dd�Dƒ}ttjj|ƒS)z% Find all files under 'path' css,|]$\}}}|D]}tj ||¡VqqdSrR)r'r)r*)r9Úbaser1r2Úfilerrr#r<Ïsþz#_find_all_simple..Tr%)r'r(r r)r6)r)Úresultsrrr#Ú_find_all_simpleËs þ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Ú functoolsÚpartialr)r+r r)r3r2Zmake_relrrr#Úfindall×s   ro)9rDr'ÚsysrmZdistutils.corerKZdistutils.filelistr`Zdistutils.errorsrZdistutils.utilrZfnmatchrZ_deprecation_warningrZsetuptools.extern.sixrr Zsetuptools.extern.six.movesr r Zsetuptools.versionZ setuptoolsZsetuptools.extensionr Zsetuptools.distr rZsetuptools.dependsrÚrÚtypeZ __metaclass__Ú__all__r/ÚversionÚ __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesrrGr$rrrQrrLZ get_unpatchedrrSrjrlroZ patch_allrrrr#Ús\       ý F  2