3 ÄvhDã@s2dZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z ddl ZddlmZddlmZmZddlmZd d lmZd d d ddddgZejjZdZdZdgZGdd„deƒZGdd„deƒZ ej!Z"dd„Z#dd „Z$ej%j$je$_ej&ej%j'ƒZ(Gdd„de(ƒZ'dd„Z)ej*fdd„Z+ej,ƒdS) z@Extensions to the 'distutils' for large or complex distributionséN)Ú convert_path)Ú fnmatchcase)ÚfilterÚmap)Ú Extension)Ú DistributionÚFeature)ÚRequireé)ÚmonkeyÚsetuprrÚCommandrr Ú find_packagesTz lib2to3.fixesc@sHeZdZdZedfd fdd„ƒZedd„ƒZedd „ƒ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)ÚclsÚwhereÚexcludeÚinclude©rú/usr/lib/python3.6/__init__.pyÚfind's zPackageFinder.findc cs¬x¦tj|dd�D]”\}}}|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) ÚosÚwalkÚpathÚjoinÚrelpathÚreplaceÚsepÚ_looks_like_packageÚappend) rrrrÚrootÚdirsÚfilesZall_dirsÚdirÚ full_pathZrel_pathÚpackagerrrr>s   z!PackageFinder._find_packages_itercCstjjtjj|dƒƒS)z%Does a directory look like a package?z __init__.py)rr!Úisfiler")r!rrrr&Zsz!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))ÚpatN)r)Ú.0r/)Únamerrú esz@PackageFinder._build_filter....)Úany)r1)Úpatterns)r1rÚesz-PackageFinder._build_filter..r)r4r)r4rr_szPackageFinder._build_filterN)r) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú classmethodrrÚ staticmethodr&rrrrrr"s   rc@seZdZedd„ƒZdS)ÚPEP420PackageFindercCsdS)NTr)r!rrrr&isz'PEP420PackageFinder._looks_like_packageN)r6r7r8r;r&rrrrr<hsr<cCs@tjjtdd„|jƒDƒƒƒ}|jdd�|jr<|j|jƒdS)Ncss"|]\}}|dkr||fVqdS)Údependency_linksÚsetup_requiresN)r=r>r)r0ÚkÚvrrrr2usz*_install_setup_requires..T)Zignore_option_errors)Ú distutilsÚcorerÚdictÚitemsZparse_config_filesr>Zfetch_build_eggs)ÚattrsÚdistrrrÚ_install_setup_requiresqs  rGcKst|ƒtjjf|ŽS)N)rGrArBr )rErrrr ~sc@s(eZdZejZdZdd„Zddd„ZdS) r FcKstj||ƒt|ƒj|ƒdS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)Ú_CommandÚ__init__ÚvarsÚupdate)ÚselfrFÚkwrrrrIŽs zCommand.__init__rcKs tj|||ƒ}t|ƒj|ƒ|S)N)rHÚreinitialize_commandrJrK)rLZcommandZreinit_subcommandsrMÚcmdrrrrN–szCommand.reinitialize_commandN)r)r6r7r8rHr9Zcommand_consumes_argumentsrIrNrrrrr ‰scCs&dd„tj|dd�Dƒ}ttjj|ƒS)z% Find all files under 'path' css,|]$\}}}|D]}tjj||ƒVqqdS)N)rr!r")r0Úbaser)r*Úfilerrrr2¡sz#_find_all_simple..T)r)rr rr!r.)r!ÚresultsrrrÚ_find_all_simpleœsrScCs6t|ƒ}|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) rSrÚcurdirÚ functoolsÚpartialr!r#rr)r+r*Zmake_relrrrÚfindall¨s   rX)-r9rrVZdistutils.corerAZdistutils.filelistZdistutils.utilrZfnmatchrZsetuptools.extern.six.movesrrZsetuptools.versionZ setuptoolsZsetuptools.extensionrZsetuptools.distrrZsetuptools.dependsr Úr Ú__all__ÚversionÚ __version__Zbootstrap_install_fromZrun_2to3_on_doctestsZlib2to3_fixer_packagesÚobjectrr<rrrGr rBZ get_unpatchedr rHrSrUrXZ patch_allrrrrÚs:      F