3 (\s@sdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZdd lmZmZddlZdd lmZdd lmZmZdd lmZdd lm Z e!Z"ddddddddgZ#ere#j$dej%j&Z&dZ'dZ(dgZ)GdddZ*Gddde*Z+e*j,Z-er,e+j,Z.ddZ/ddZ0ej1j0je0_e j2ej1j3Z4Gd dde4Z3d!d"Z5ej6fd#d$Z7e j8dS)%z@Extensions to the 'distutils' for large or complex distributionsN)DistutilsOptionError) convert_path) fnmatchcase)SetuptoolsDeprecationWarning)PY3 string_types)filtermap) Extension) DistributionFeature)Require)monkeysetupr r Commandr rr find_packagesfind_namespace_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)clswhereexcludeincluder o/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-rm6ck8ia/setuptools/setuptools/__init__.pyfind4s 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_pathpackager r r!rKs   z!PackageFinder._find_packages_itercCstjjtjj|dS)z%Does a directory look like a package?z __init__.py)r$r&isfiler')r&r r r!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))patN)r).0r5)namer r! rsz@PackageFinder._build_filter....)any)r7)patterns)r7r!rsz-PackageFinder._build_filter..r )r:r )r:r!rlszPackageFinder._build_filterN)r) __name__ __module__ __qualname____doc__ classmethodr"r staticmethodr+rr r r r!r/s   rc@seZdZeddZdS)PEP420PackageFindercCsdS)NTr )r&r r r!r+vsz'PEP420PackageFinder._looks_like_packageN)r<r=r>rAr+r r r r!rBusrBcCs@tjjtdd|jD}|jdd|jr<|j|jdS)Ncss"|]\}}|dkr||fVqdS)dependency_linkssetup_requiresN)rCrDr )r6kvr r r!r8sz*_install_setup_requires..T)Zignore_option_errors) distutilscorer dictitemsparse_config_filesrDZfetch_build_eggs)attrsdistr r r!_install_setup_requiress  rNcKst|tjjf|S)N)rNrGrHr)rLr r r!rsc@s:eZdZejZdZddZd ddZddZd d d Z dS)rFcKstj||t|j|dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)_Command__init__varsupdate)selfrMkwr r r!rPs zCommand.__init__NcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))getattrsetattr isinstancerr)rSoptionwhatdefaultvalr r r!_ensure_stringlikes   zCommand._ensure_stringlikecCspt||}|dkrdSt|tr6t||tjd|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|tVqdS)N)rWr)r6rFr r r!r8sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rUrWrrVresplitrallr)rSrXr[okr r r!ensure_string_lists   zCommand.ensure_string_listrcKs tj|||}t|j||S)N)rOreinitialize_commandrQrR)rScommandreinit_subcommandsrTcmdr r r!rbszCommand.reinitialize_command)N)r) r<r=r>rOr?Zcommand_consumes_argumentsrPr\rarbr r r r!rs  cCs&ddtj|ddD}ttjj|S)z% Find all files under 'path' css,|]$\}}}|D]}tjj||VqqdS)N)r$r&r')r6baser.r/filer r r!r8sz#_find_all_simple..T)r#)r$r%r r&r4)r&resultsr r r!_find_all_simplesricCs6t|}|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) rir$curdir functoolspartialr&r(r r)r0r/Zmake_relr r r!findalls   rn)9r?r$sysrldistutils.corerGdistutils.filelistr]distutils.errorsrdistutils.utilrfnmatchrZ_deprecation_warningrZsetuptools.extern.sixrrZsetuptools.extern.six.movesr r Zsetuptools.version setuptoolsZsetuptools.extensionr Zsetuptools.distr r Zsetuptools.dependsrrtype __metaclass____all__r,version __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesrrBr"rrrNrrHZ get_unpatchedrrOrirkrnZ patch_allr r r r!sP         F  2