3 M(ÌYã@sBddlZddlZddlmZmZddljjZGdd„dejƒZdS)éN)ÚproductÚstarmapc@sZeZdZdZdd„Zdd„Zdd„Zedd „ƒZd d „Z ed d „ƒZ ddd„Z dd„Z dS)Ú install_libz9Don't add compiled flags to filenames of non-Python filescCs&|jƒ|jƒ}|dk r"|j|ƒdS)N)ÚbuildÚinstallÚ byte_compile)ÚselfÚoutfiles©r úL/private/tmp/pip-build-nl73fm5q/setuptools/setuptools/command/install_lib.pyÚrun szinstall_lib.runcs4‡fdd„ˆjƒDƒ}t|ˆjƒƒ}ttˆj|ƒƒS)z— Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations. c3s"|]}ˆj|ƒD] }|VqqdS)N)Ú _all_packages)Ú.0Zns_pkgÚpkg)rr r ú sz-install_lib.get_exclusions..)Ú_get_SVEM_NSPsrÚ_gen_exclusion_pathsÚsetrÚ_exclude_pkg_path)rZ all_packagesZ excl_specsr )rr Úget_exclusionss  zinstall_lib.get_exclusionscCs$|jdƒ|g}tjj|jf|žŽS)zw Given a package name and exclusion path within that package, compute the full exclusion path. Ú.)ÚsplitÚosÚpathÚjoinÚ install_dir)rrZexclusion_pathÚpartsr r r rszinstall_lib._exclude_pkg_pathccs$x|r|V|jdƒ\}}}qWdS)zn >>> list(install_lib._all_packages('foo.bar.baz')) ['foo.bar.baz', 'foo.bar', 'foo'] rN)Ú rpartition)Úpkg_nameÚsepÚchildr r r r 'szinstall_lib._all_packagescCs,|jjs gS|jdƒ}|j}|r(|jjSgS)z‰ Get namespace packages (list) but only for single_version_externally_managed installations and empty otherwise. r)Ú distributionZnamespace_packagesÚget_finalized_commandZ!single_version_externally_managed)rZ install_cmdZsvemr r r r1s  zinstall_lib._get_SVEM_NSPsccsbdVdVdVttdƒs dStjjddtjƒƒ}|dV|d V|d V|d VdS) zk Generate file paths to be excluded for namespace packages (bytecode cache files). z __init__.pyz __init__.pycz __init__.pyoÚget_tagNÚ __pycache__z __init__.z.pycz.pyoz .opt-1.pycz .opt-2.pyc)ÚhasattrÚimprrrr#)Úbaser r r rAs    z install_lib._gen_exclusion_pathsérc sj|r|r| st‚|jƒ‰ˆs.tjj|||ƒSddlm}ddlm‰g‰‡‡‡fdd„}||||ƒˆS)Nr)Úunpack_directory)Úlogcs<|ˆkrˆjd|ƒdSˆjd|tjj|ƒƒˆj|ƒ|S)Nz/Skipping installation of %s (namespace package)Fzcopying %s -> %s)ÚwarnÚinforrÚdirnameÚappend)ÚsrcÚdst)Úexcluder*r r r Úpfgs z!install_lib.copy_tree..pf) ÚAssertionErrorrÚorigrÚ copy_treeZsetuptools.archive_utilr)Ú distutilsr*) rÚinfileÚoutfileÚ preserve_modeÚpreserve_timesÚpreserve_symlinksÚlevelr)r2r )r1r*r r r5Vs   zinstall_lib.copy_treecs.tjj|ƒ}|jƒ‰ˆr*‡fdd„|DƒS|S)Ncsg|]}|ˆkr|‘qSr r )rÚf)r1r r ú xsz+install_lib.get_outputs..)r4rÚ get_outputsr)rÚoutputsr )r1r r?ts  zinstall_lib.get_outputsN)r(r(rr() Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrÚ staticmethodr rrr5r?r r r r rs   r) rr&Ú itertoolsrrZdistutils.command.install_libÚcommandrr4r r r r Ús