3 ]D@s2dZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z ddl ZddlmZddlmZmZddlmZd d lmZd d d ddddgZejjZdZdZdgZGdddeZGdddeZ ej!Z"ddZ#dd Z$ej%j$je$_ej&ej%j'Z(Gddde(Z'ddZ)ej*fddZ+ej,dS) z@Extensions to the 'distutils' for large or complex distributionsN) convert_path) fnmatchcase)filtermap) Extension) DistributionFeature)Require)monkeysetuprrCommandrr find_packagesTz lib2to3.fixesc@sHeZdZdZedfd fddZeddZedd Zed d Z d S) PackageFinderzI Generate a list of all Python packages found within a directory .*cCs&t|jt||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)clswhereexcludeincluder9/tmp/pip-build-8jg9gmni/setuptools/setuptools/__init__.pyfind's zPackageFinder.findc csxtj|ddD]\}}}|dd}g|dd<xp|D]h}tjj||} tjj| |} | jtjjd} d|ks8|j|  r~q8|| r||  r| V|j|q8WqWdS)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_pathpackagerrrr>s   z!PackageFinder._find_packages_itercCstjjtjj|dS)z%Does a directory look like a package?z __init__.py)rr!isfiler")r!rrrr&Zsz!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))patN)r).0r0)namerr esz@PackageFinder._build_filter....)any)r2)patterns)r2resz-PackageFinder._build_filter..r)r5r)r5rr_szPackageFinder._build_filterN)r) __name__ __module__ __qualname____doc__ classmethodrr staticmethodr&rrrrrr"s   rc@seZdZeddZdS)PEP420PackageFindercCsdS)NTr)r!rrrr&isz'PEP420PackageFinder._looks_like_packageN)r7r8r9r<r&rrrrr=hsr=cCs@tjjtdd|jD}|jdd|jr<|j|jdS)Ncss"|]\}}|dkr||fVqdS)dependency_linkssetup_requiresN)r>r?r)r1kvrrrr3usz*_install_setup_requires..T)Zignore_option_errors) distutilscorerdictitemsparse_config_filesr?Zfetch_build_eggs)attrsdistrrr_install_setup_requiresqs  rIcKst|tjjf|S)N)rIrBrCr )rGrrrr ~sc@s(eZdZejZdZddZdddZdS) r FcKstj||t|j|dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)_Command__init__varsupdate)selfrHkwrrrrKs zCommand.__init__rcKs tj|||}t|j||S)N)rJreinitialize_commandrLrM)rNcommandreinit_subcommandsrOcmdrrrrPszCommand.reinitialize_commandN)r)r7r8r9rJr:Zcommand_consumes_argumentsrKrPrrrrr scCs&ddtj|ddD}ttjj|S)z% Find all files under 'path' css,|]$\}}}|D]}tjj||VqqdS)N)rr!r")r1baser)r*filerrrr3sz#_find_all_simple..T)r)rr rr!r/)r!resultsrrr_find_all_simplesrWcCs6t|}|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) rWrcurdir functoolspartialr!r#rr)r+r*Zmake_relrrrfindalls   r\)-r:rrZdistutils.corerBdistutils.filelistdistutils.utilrfnmatchrZsetuptools.extern.six.movesrrZsetuptools.version setuptoolsZsetuptools.extensionrZsetuptools.distrrZsetuptools.dependsr r __all__version __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesobjectrr=rrrIr rCZ get_unpatchedr rJrWrYr\Z patch_allrrrrs:      F