a „oeþ#ã@sDdZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZmZddl mZddlmZdd lmZmZdd lmZdd lmZdd lmZgd ¢ZejZdZej Z!ej Z"dd„Z#dd„Z$dd„Z%ej&j%je%_e 'ej&j(¡Z)Gdd„de)ƒZ(dd„Z*ej+fdd„Z,e -e ¡dd„ƒZ Gdd„de.ƒZ/e 0¡dS)z@Extensions to the 'distutils' for large or complex distributionséN)ÚDistutilsOptionError)Ú convert_pathé)ÚloggingÚmonkey)Úversion)ÚRequire)Ú PackageFinderÚPEP420PackageFinder)Ú Distribution)Ú Extension)ÚSetuptoolsDeprecationWarning)Úsetupr ÚCommandr rr Ú find_packagesÚfind_namespace_packagescCs:Gdd„dtjjƒ}||ƒ}|jdd�|jr6t|ƒdS)Ncs6eZdZdZ‡fdd„Zd ‡fdd„ Zdd„Z‡ZS) z4_install_setup_requires..MinimalDistributionzl A minimal version of a distribution for supporting the fetch_build_eggs interface. cs<d}‡fdd„t|ƒtˆƒ@Dƒ}tƒ |¡|j ¡dS)N)Zdependency_linksÚsetup_requirescsi|]}|ˆ|“qS©r)Ú.0Úk©Úattrsrú4C:\Program Files\Certbot\pkgs\setuptools\__init__.pyÚ 3ózQ_install_setup_requires..MinimalDistribution.__init__..)ÚsetÚsuperÚ__init__Ú set_defaultsZ_disable)ÚselfrZ_inclZfiltered©Ú __class__rrr1s z=_install_setup_requires..MinimalDistribution.__init__Ncs:ztƒ |¡\}}|dfWSty4|dfYS0dS)zAIgnore ``pyproject.toml``, they are not related to setup_requiresrN)rZ _split_standard_project_metadataÚ Exception)rÚ filenamesZcfgZtomlr rrÚ_get_project_config_files8s   zN_install_setup_requires..MinimalDistribution._get_project_config_filescSsdS)zl Disable finalize_options to avoid building the working set. Ref #2158. Nr)rrrrÚfinalize_options@szE_install_setup_requires..MinimalDistribution.finalize_options)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr$r%Ú __classcell__rrr rÚMinimalDistribution+s r+T)Zignore_option_errors)Ú distutilsÚcorer Zparse_config_filesrÚ_fetch_build_eggs)rr+ÚdistrrrÚ_install_setup_requires(s  r0c Cstz| |j¡Wn^tyn}zFd}d|jjvrXt|dƒrF| |¡n| d|›d�¡‚WYd}~n d}~00dS)Na– It is possible a package already installed in your system contains an version that is invalid according to PEP 440. You can try `pip install --use-pep517` as a workaround for this problem, or rely on a new virtual environment. If the problem refers to a package that is not installed yet, please contact that package's maintainers or distributors. ZInvalidVersionÚadd_noteÚ )Zfetch_build_eggsrr"r!r&Úhasattrr1Zannounce)r/ÚexÚmsgrrrr.Ns   r.cKs"t ¡t|ƒtjjfi|¤ŽS©N)rZ configurer0r,r-rrrrrrcsrcs@eZdZdZdZ‡fdd„Zd dd„Zdd „Zdd d „Z‡Z S)ra› Setuptools internal actions are organized using a *command design pattern*. This means that each action (or group of closely related actions) executed during the build should be implemented as a ``Command`` subclass. These commands are abstractions and do not necessarily correspond to a command that can (or should) be executed via a terminal, in a CLI fashion (although historically they would). When creating a new command from scratch, custom defined classes **SHOULD** inherit from ``setuptools.Command`` and implement a few mandatory methods. Between these mandatory methods, are listed: .. method:: initialize_options(self) Set or (reset) all options/attributes/caches used by the command to their default values. Note that these values may be overwritten during the build. .. method:: finalize_options(self) Set final values for all options/attributes used by the command. Most of the time, each option/attribute/cache should only be set if it does not have any value yet (e.g. ``if self.attr is None: self.attr = val``). .. method:: run(self) Execute the actions intended by the command. (Side effects **SHOULD** only take place when ``run`` is executed, for example, creating new files or writing to the terminal output). A useful analogy for command classes is to think of them as subroutines with local variables called "options". The options are "declared" in ``initialize_options()`` and "defined" (given their final values, aka "finalized") in ``finalize_options()``, both of which must be defined by every command class. The "body" of the subroutine, (where it does all the work) is the ``run()`` method. Between ``initialize_options()`` and ``finalize_options()``, ``setuptools`` may set the values for options/attributes based on user's input (or circumstance), which means that the implementation should be careful to not overwrite values in ``finalize_options`` unless necessary. Please note that other commands (or other parts of setuptools) may also overwrite the values of the command's options/attributes multiple times during the build process. Therefore it is important to consistently implement ``initialize_options()`` and ``finalize_options()``. For example, all derived attributes (or attributes that depend on the value of other attributes) **SHOULD** be recomputed in ``finalize_options``. When overwriting existing commands, custom defined classes **MUST** abide by the same APIs implemented by the original class. They also **SHOULD** inherit from the original class. Fc stƒ |¡t|ƒ |¡dS)zj Construct the command for dist, updating vars(self) with any keyword parameters. N)rrÚvarsÚupdate)rr/Úkwr rrr©s zCommand.__init__NcCsBt||ƒ}|dur"t|||ƒ|St|tƒs>td|||fƒ‚|S)Nz'%s' must be a %s (got `%s`))ÚgetattrÚsetattrÚ isinstanceÚstrr)rÚoptionZwhatÚdefaultÚvalrrrÚ_ensure_stringlike±s    ÿzCommand._ensure_stringlikecCspt||ƒ}|durdSt|tƒr6t||t d|¡ƒn6t|tƒrTtdd„|Dƒƒ}nd}|sltd||fƒ‚dS)a¼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"]. .. TODO: This method seems to be similar to the one in ``distutils.cmd`` Probably it is just here for backward compatibility with old Python versions? :meta private: Nz,\s*|\s+css|]}t|tƒVqdSr6)r<r=)rÚvrrrÚ Ïrz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) r:r<r=r;ÚreÚsplitÚlistÚallr)rr>r@ÚokrrrÚensure_string_list¼s    ÿzCommand.ensure_string_listrcKs t |||¡}t|ƒ |¡|Sr6)Ú_CommandÚreinitialize_commandr7r8)rZcommandZreinit_subcommandsr9ÚcmdrrrrK×szCommand.reinitialize_command)N)r) r&r'r(r)Zcommand_consumes_argumentsrrArIrKr*rrr rrps 6  rcCs&dd„tj|dd�Dƒ}ttjj|ƒS)z% Find all files under 'path' css,|]$\}}}|D]}tj ||¡VqqdSr6)ÚosÚpathÚjoin)rÚbaseÚdirsÚfilesÚfilerrrrCásþz#_find_all_simple..T)Ú followlinks)rMÚwalkÚfilterrNÚisfile)rNÚresultsrrrÚ_find_all_simpleÝs þrYcCs6t|ƒ}|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) rYrMÚcurdirÚ functoolsÚpartialrNÚrelpathÚmaprF)ÚdirrRZmake_relrrrÚfindallés   racCstjdddd�t|ƒS)NzAccess to implementation detaila The function `convert_path` is not provided by setuptools itself, and therefore not part of the public API. Its direct usage by 3rd-party packages is considered improper and the function may be removed in the future. )içé é )Zdue_date)r ÚemitÚ _convert_path)Úpathnamerrrrõs ÷ rc@seZdZdZdS)Úsicz;Treat this string as-is (https://en.wikipedia.org/wiki/Sic)N)r&r'r(r)rrrrrgsrg)1r)r\rMrDZ_distutils_hack.overrideZ_distutils_hackZdistutils.corer,Zdistutils.errorsrZdistutils.utilrreÚrrrZ_version_moduleZdependsrZ discoveryr r r/r Ú extensionr Úwarningsr Ú__all__Ú __version__Zbootstrap_install_fromÚfindrrr0r.rr-Z get_unpatchedrrJrYr[raÚwrapsr=rgZ patch_allrrrrÚs>        & m