a oeރ@sndZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZd d lmZm Z m!Z!m"Z"m#Z#d d l$m%Z%d d l&m'Z'd dl(m)Z)m*Z*m+Z+ddl,m,Z-erddl.m/Z/ej0dkr,ddlm1Z1n er@ddl2m1Z1n ddl3m4Z1ee5efZ6ede6dZ7e8e9Z:Gddde Z;dZGddde1Z?Gdd d Z@Gd!d"d"e@ZAGd#d$d$ZBe5eCd%d&d'ZDeeEd(d)d*ZFee5ee5e5feeEd+d,d-ZGd.d/ZHe'ee5d0d1d2ZIe'ee5d0d3d4ZJee5ee5e5fe6ee5e5fd5d6d7ZKe6e5d8d9d:ZLee5e5fee5d;dd?d@ZNee5e5fee5e5fd;dAdBZOe5e5e5e5eEdCdDdEZPe7e7dFdGdHZQGdIdJdJe#jRZSdKZTe5ee5e5fee5ee5fe5dLdMdNZUGdOdPdPe"jVZWGdQdRdRe+ZXdS)Sa Create a wheel that, when installed, will make the source package 'editable' (add it to the interpreter's path, including metadata) per PEP 660. Replaces 'setup.py develop'. .. note:: One of the mechanisms briefly mentioned in PEP 660 to implement editable installs is to create a separated directory inside ``build`` and use a .pth file to point to that directory. In the context of this file such directory is referred as *auxiliary build directory* or ``auxiliary_dir``. N)suppress)Enum)cleandoc)chain)Path)TemporaryDirectory) TYPE_CHECKINGDictIterableIteratorListMappingOptionalTupleTypeVarUnion)Command_normalization_patherrors namespacesfind_package_path) Distribution)InformationOnlySetuptoolsDeprecationWarningSetuptoolsWarning)build_py WheelFile))Protocol)ABC_P)boundc@s4eZdZdZdZdZdZeee ddddZ dS) _EditableModea Possible editable installation modes: `lenient` (new files automatically added to the package - DEFAULT); `strict` (requires a new installation when files are added/removed); or `compat` (attempts to emulate `python setup.py develop` - DEPRECATED). strictZlenientcompat)modereturncCsN|s tjS|}|tjvr.td|d|dkrFtjddddt|S)NzInvalid editable mode: z. Try: 'strict'.COMPATzCompat editable installsa  The 'compat' editable mode is transitional and will be removed in future versions of `setuptools`. Please adapt your code accordingly to use either the 'strict' or the 'lenient' modes. userguide/development_mode.html)Zsee_docs)r(LENIENTupper __members__rZ OptionErrorremit)clsr+_moder5BC:\Program Files\Certbot\pkgs\setuptools\command\editable_wheel.pyconvertQs z_EditableMode.convertN) __name__ __module__ __qualname____doc__STRICTr/r- classmethodrstrr7r5r5r5r6r(Es r(zU New or renamed files may not be automatically picked up without a new installation. zt Options like `package-data`, `include/exclude-package-data` or `packages.find.exclude/include` may have no effect. c @seZdZdZdZddddeejp"dfgZdd Zd d Z d d Z ddZ ddZ e edddZeeeedddZddZeeeeeeffdddZeeeeeeeeeeffdddZdd Zed!d"d#Zd$d%Zed&d'd(Zeeed)d*d+d,ZdS)-editable_wheelzBuild 'editable' wheel for development. This command is private and reserved for internal use of setuptools, users should rely on ``setuptools.build_meta`` APIs. zBDO NOT CALL DIRECTLY, INTERNAL ONLY: create PEP 660 editable wheel)z dist-dir=dz-directory to put final built distributions in)zdist-info-dir=Iz(path to a pre-build .dist-info directoryzmode=NcCsd|_d|_d|_d|_dSN)dist_dir dist_info_dir project_dirr+selfr5r5r6initialize_optionssz!editable_wheel.initialize_optionscCs@|j}|jptj|_|jpi|_t|jp6tj |jd|_dS)Ndist) distributionsrc_rootoscurdirrF package_dirrrDpathjoin)rHrJr5r5r6finalize_optionss zeditable_wheel.finalize_optionscCszD|jjdd||d|d}||j||Wn:ty~t |j j pj|j }tj|dYn0dS)NT)exist_ok bdist_wheel)project)rDmkdir_ensure_dist_inforeinitialize_commandget_finalized_commandZwrite_wheelfilerE_create_wheel_file Exception traceback print_excrKnameZget_name_DebuggingTipsr2)rHrTrUr5r5r6runs     zeditable_wheel.runcCsb|jdur6|d}|j|_|||j|_n(t|jdsJJt|jd s^JdS)N dist_infoz .dist-infoZMETADATA) rErXrDZ output_dirensure_finalizedr`r>endswithrexists)rHrar5r5r6rWs   z editable_wheel._ensure_dist_infocCsD|j}|jsdSt|j|jdd}t||||}|dS)NrB.) rKnamespace_packagesrrFrOgetresolve_NamespaceInstallerZinstall_namespaces)rHinstallation_dirZ pth_prefixrJrLZ installerr5r5r6_install_namespacess z"editable_wheel._install_namespaces)r,cCs2|jrt|jjnt}tt|d}t|dS)Nz *.egg-info)rErparentmapr>globnext)rHZ parent_dirZ candidatesr5r5r6_find_egg_info_dirsz!editable_wheel._find_egg_info_dir)r^unpacked_wheel build_libtmp_dircCs|j}t|}t|}tt||dd}tt||dd}tt||dd} |jddd} t|| _d| _|jddd} |jd dd} || _| _| _|| _ | _ | _ | | _ | _ || _|| _|d } d| _t|| _|d }d |_||_|| | d S)aConfigure commands to behave in the following ways: - Build commands can write to ``build_lib`` if they really want to... (but this folder is expected to be ignored and modules are expected to live in the project directory...) - Binary extensions should be built in-place (editable_mode = True) - Data/header/script files are not part of the "editable" specification so they are written directly to the unpacked_wheel directory. z.datadataheadersscriptsegg_infoT)Zreinit_subcommandsbuildinstallinstall_scriptsrFN)rKr>rrXZegg_baseZignore_egg_info_in_manifestZ build_platlibZ build_purelibrrZinstall_purelibZinstall_platlibZ install_librzZ build_scriptsZinstall_headersZ install_dataget_command_objZno_epZ build_tempcompilerpZexisting_egg_info_dir_set_editable_moderb)rHr^rqrrrsrJwheelrtrurvrwrxryrzrr5r5r6_configure_builds2      zeditable_wheel._configure_buildcCsN|j}|d}|D]0}||}t|dr8d|_qt|drd|_qdS)z8Set the ``editable_mode`` flag in the build sub-commandsrx editable_modeTinplaceN)rKr{get_sub_commandshasattrrr)rHrJrxcmd_namecmdr5r5r6r}s     z!editable_wheel._set_editable_modecCsjg}i}|d}|D]F}||}t|drD||p@gt|dr||p\iq||fS)Nrx get_outputsget_output_mapping)rYrrextendrupdater)rHfilesmappingrxrrr5r5r6_collect_build_outputss     z%editable_wheel._collect_build_outputs) dist_namerqrrrsr,cCsJ|||||||\}}|d|d|d||fS)Nrurvrt)r_run_build_subcommandsr _run_install)rHrrqrrrsrrr5r5r6_run_build_commandss    z"editable_wheel._run_build_commandscCsP|d}|D]8}||}|dkr@t|tkr@||q||qdS)a} Issue #3501 indicates that some plugins/customizations might rely on: 1. ``build_py`` not running 2. ``build_py`` always copying files to ``build_lib`` However both these assumptions may be false in editable_wheel. This method implements a temporary workaround to support the ecosystem while the implementations catch up. rxrN)rYrtype build_py_cls _safely_run run_command)rHrxr^rr5r5r6rs     z%editable_wheel._run_build_subcommands)rc CsHz ||WStyBtddtd|d|dYn0dS)Nz0Customization incompatible with editable installz z If you are seeing this warning it is very likely that a setuptools plugin or customization overrides the `a` command, without taking into consideration how editable installs run build steps starting from setuptools v64.0.0. Plugin authors and developers relying on custom build steps are encouraged to update their `ab` implementation considering the information about editable installs in https://setuptools.pypa.io/en/latest/userguide/extension.html. For the time being `setuptools` will silence this error and ignore the faulty command, but this behaviour will change in future versions. )rr[rr2r\ format_exc)rHrr5r5r6r)s   zeditable_wheel._safely_runc Csddlm}|d}|j}d|}d}|d|d|d}t|j|}|r`| t |d} t dd} t d d} | } | } | }t| t|j j}t |j ||| |||| | |\}}|||| }|R||d &}|||||| Wdn1s0YWdn1s>0YWdn1s^0YWdn1s~0YWdn1s0Y|S) Nrr ra-z 0.editablez.whl)suffixz .build-libz .build-tempw)wheel.wheelfiler!rYr^rQZget_tagrrDrdunlinkrrEshutilcopytreerkr_select_strategyZ write_files)rHrTr!rartagZ build_tag archive_nameZ wheel_pathrqrrZ build_tmpZunpackedlibtmpZunpacked_dist_inforrZstrategyZ wheel_objr5r5r6rZEs,        z!editable_wheel._create_wheel_file)categorycCsDt|jd|d}|r@|r@td|d|d|dS)NZhas_z Installing z as non editableZinstall_)getattrrK_loggerinfor)rHrZ has_categoryr5r5r6ras zeditable_wheel._run_installEditableStrategy)r^rrrr,c Csd|d|}t|j}t|j}|tjurRtt|jd|}t|j|||St |j}t ||j |} |tj u} t |j dhkr| s| r|j dd} t|j|t|| gSt|j|S)zDDecides which strategy to use to implement an editable installation. __editable__.rrxrBre)rrFr(r7r+r< _empty_dir _LinkTreerK_find_packages_simple_layoutrOr-setrg _StaticPth_TopLevelFinder) rHr^rrrZ build_namerFr+ auxiliary_dirpackagesZhas_simple_layoutZis_compat_modeZsrc_dirr5r5r6rgs     zeditable_wheel._select_strategy)r8r9r:r; descriptionrr(Z user_optionsrIrRr`rWrkrr>rp_Pathrr}rr r rrrrrZrrr5r5r5r6r?xs8   2 " r?c@s:eZdZdeeeeefdddZddZddZd S) rr!r~rrcCsdSrCr5rHr~rrr5r5r6__call__szEditableStrategy.__call__cCsdSrCr5rGr5r5r6 __enter__szEditableStrategy.__enter__cCsdSrCr5rH _exc_type _exc_value _tracebackr5r5r6__exit__szEditableStrategy.__exit__N) r8r9r:r r>r rrrr5r5r5r6rsrc@sPeZdZeeeedddZdeeeeefdddZ dd Z d d Z d S) rrJr^ path_entriescCs||_||_||_dSrCr)rHrJr^rr5r5r6__init__sz_StaticPth.__init__r!rcCs>ddd|jD}t|d}|d|jd|dS)N css|]}t|VqdSrC)r>rh).0pr5r5r6 z&_StaticPth.__call__..r.pth)rQr _encode_pthwritestrr^)rHr~rrentriescontentsr5r5r6rsz_StaticPth.__call__cCs,dtttj|jd}t|t|S)Nz_ Editable install will be performed using .pth file to extend `sys.path` with: z )listrmrMfspathrrwarning_LENIENT_WARNINGrHmsgr5r5r6rs z_StaticPth.__enter__cCsdSrCr5rr5r5r6rsz_StaticPth.__exit__N) r8r9r:rr>r rrr rrrr5r5r5r6rsrcseZdZdZeeeedfdd Zdeee eefdfdd Z ee ed d d Z deed ddZ ddZddZddZZS)ra` Creates a ``.pth`` file that points to a link tree in the ``auxiliary_dir``. This strategy will only link files (not dirs), so it can be implemented in any OS, even if that means using hardlinks instead of symlinks. By collocating ``auxiliary_dir`` and the original source code, limitations with hardlinks should be avoided. )rJr^rrrcs>t||_t||_|dj|_t|||jgdS)Nr) rrrhrrr{Z copy_file_filesuperr)rHrJr^rrr __class__r5r6rs z_LinkTree.__init__r!rcs |||t|||dSrC) _create_linksrrrrr5r6rs z_LinkTree.__call__)filer,cCsRtt6t||j}t|tj dWdS1sD0YdS)N/) r ValueErrorrrh relative_torrr>replacerMsep)rHrrPr5r5r6_normalize_outputs 0z_LinkTree._normalize_outputN)relative_outputsrc_filecCs6|j|}|js"|jjdd|j|||ddS)NT)parentslink)rrlis_dirrVr)rHrrrdestr5r5r6 _create_files  z_LinkTree._create_filecsjjdddtjrdnd}fdd|D}|dd|D]&}|}|rH||vrH||qH|D]\}}j|||dqxdS)NT)rrSZsymZhardcsi|]\}}||qSr5)rrkvrGr5r6 rz+_LinkTree._create_links..r)rrV_can_symlink_filesitemspoprr)rHoutputsZoutput_mappingZ link_typeZmappingsoutputrelativesrcr5rGr6rs   z_LinkTree._create_linkscCsd}t|t|S)Nz=Strict editable install will be performed using a link tree. )rr_STRICT_WARNINGrr5r5r6rsz_LinkTree.__enter__cCsd|jd}td|dS)Nz\ Strict editable installation performed using the auxiliary directory: z Please be careful to not remove this directory, otherwise you might not be able to import/use your package. Editable installation.)rrr2rHrrrrr5r5r6rsz_LinkTree.__exit__)N)r8r9r:r;rr>rrr r rrrrrrr __classcell__r5r5rr6rs  "rc@sJeZdZeedddZdeeeeefdddZdd Z d d Z d S) rrJr^cCs||_||_dSrCr)rHrJr^r5r5r6rsz_TopLevelFinder.__init__r!rc sjjp tj}ttjtj}jjp.i}t|||t tt jj pLgddt D}fddjj p|gD}i|}djd} t| } tt| ||d} || d| td | d | d } |djd | dS) Ncss|]}|gfVqdSrCr5)rnsr5r5r6rrz+_TopLevelFinder.__call__..cs"i|]}|t|jjpdqS)rB)rrJrLrpkgrootsrHr5r6rsz,_TopLevelFinder.__call__..rz.finderutf-8z.pyzimport z; z .install()r)rJrLrMrNrr_find_top_level_modulesrO_find_package_rootsdict_find_namespacesr_find_virtual_namespacesrfr^rZsafe_identifierbytes_finder_templaterr) rHr~rrrLZ top_levelrOZ namespaces_Zlegacy_namespacesr^findercontentr5rr6rs(      z_TopLevelFinder.__call__cCsd}t|t|S)Nz=Editable install will be performed using a meta path finder. )rrrrr5r5r6rsz_TopLevelFinder.__enter__cCsd}td|dS)Nz Please be careful with folders in your working directory with the same name as your package as they may take precedence during imports. r)rr2rr5r5r6rsz_TopLevelFinder.__exit__N) r8r9r:rr>rr r rrrr5r5r5r6rsr)rr,cCsntjdkrdnd}t@}t||}||||d|WdS1s`0YdS)a!.pth files are always read with 'locale' encoding, the recommendation from the cpython core developers is to write them as ``open(path, "w")`` and ignore warnings (see python/cpython#77102, pypa/setuptools#3937). This function tries to simulate this behaviour without having to create an actual file, in a way that supports a range of active Python versions. (There seems to be some variety in the way different version of Python handle ``encoding=None``, not all of them use ``locale.getpreferredencoding(False)``). )r" localeNr) sys version_infoioBytesIO TextIOWrapperwriteflushseekread)rencodingbufferwrapperr5r5r6rs     r)base_dirr,c Cstt|d}t|dt|d}}|jdddttttPt ||| r|j dddkrWdWddSWdn1s0Yzt ||Wn2ty}zd}t||WYd}~n d}~00Wdd S1s0YdS) N)dirz file1.txtz file2.txtZfile1r)r TzFile system does not seem to support either symlinks or hard links. Strict editable installs require one of them to be supported.F)rr>rhr write_textrAttributeErrorNotImplementedErrorOSErrorrMsymlink is_symlink read_textrr[LinksNotSupported)rrZpath1Zpath2exrr5r5r6r-s : r)rrOrFr,cs^fdd|D}|s*tidhfvStjdd|Dtfdd|DS)a[Return ``True`` if: - all packages are contained by the same parent directory, **and** - all packages become importable if the parent directory is added to ``sys.path``. >>> _simple_layout(['a'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.b'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.b'], {}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "a", "b": "b"}, ".") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a", "b": "_b"}, ".") False >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a"}, "/tmp/myproj") False >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a.a1.a2": "_a2"}, ".") False >>> _simple_layout(['a', 'a.b'], {"": "src", "a.b": "_ab"}, "/tmp/myproj") False >>> # Special cases, no packages yet: >>> _simple_layout([], {"": "src"}, "/tmp/myproj") True >>> _simple_layout([], {"a": "_a", "": "src"}, "/tmp/myproj") False csi|]}|t|qSr5rr)rOrFr5r6r`rz"_simple_layout..rBcSsg|]\}}t||qSr5) _parent_pathrr5r5r6 crz"_simple_layout..c3s0|](\}}ttg|dR|VqdSreN)rZ same_pathrsplit)rkeyvalue)rlr5r6rdsz!_simple_layout..)rrMrP commonpathrall)rrOrFZlayoutr5)rOrlrFr6rAs rcCs0||r|dt| n|}|dtjS)a7Infer the parent path containing a package, that if added to ``sys.path`` would allow importing that package. When ``pkg`` is directly mapped into a directory with a different name, return its own path. >>> _parent_path("a", "src/a") 'src' >>> _parent_path("b", "src/c") 'src/c' Nr)rclenrstriprMr)rpkg_pathrlr5r5r6rjs r)rJr,ccs|t|jp gEdH|jpg}dd|D}|jr<|jVn|jpDg}|dd|D7}|D]}|d\}}}|Vq\dS)NcSsg|]}d|vr|qSrer5rmodr5r5r6r|rz"_find_packages..cSsg|]}d|jvr|jqSr&r^rxr5r5r6rrre)iterr py_modules ext_package ext_modules rpartition)rJr-Znested_modulesr/modulepackage_r5r5r6rxs   rccsF|jpg}dd|DEdH|jsB|jp,g}dd|DEdHdS)Ncss|]}d|vr|VqdSrr5r'r5r5r6rrz*_find_top_level_modules..css|]}d|jvr|jVqdSrr)r*r5r5r6rr)r-r.r/)rJr-r/r5r5r6rs   r)rrOrLr,cs fddt|D}t|S)Ncsi|]}|tt|qSr5)_absolute_rootrrrOrLr5r6rsz'_find_package_roots..)sorted_remove_nested)rrOrL pkg_rootsr5r5r6rs r)rPr,cCs8t|}|j}|r"t|St||jSdS)z(Works for packages and top-level modulesN)rrlrdr>rhr^)rPZpath_rlr5r5r6r4s  r4)r8r,ccst|D]j}d|vrq|d}tt|dddD]<}d|d|}tt||d}|rf||vr0|Vq0qdS)a8By carefully designing ``package_dir``, it is possible to implement the logical structure of PEP 420 in a package without the corresponding directories. Moreover a parent package can be purposefully/accidentally skipped in the discovery phase (e.g. ``find_packages(include=["mypkg.*"])``, when ``mypkg.foo`` is included by ``mypkg`` itself is not). We consider this case to also be a virtual namespace (ignoring the original directory) to emulate a non-editable installation. This function will try to find these kinds of namespaces. rerrNrB)rranger#rQrrrd)r8rpartsiZ partial_namerPr5r5r6rs  r)rr8r,ccs@|D]6}t||d}t|rt|ds||gfVqdS)NrBz __init__.py)rrrd)rr8rrPr5r5r6rs rcsPt|}tt|D].\tfdd|Dr|q|S)Nc3s(|] \}}|kot||VqdSrC) _is_nested)rother other_pathrPrr5r6rsz!_remove_nested..)rcopyreversedrranyr)r8rr5r@r6r7s  r7)rr%rl parent_pathr,cCsHt|}||dddd}||oF|tt|g|RkS)a Return ``True`` if ``pkg`` is nested inside ``parent`` both logically and in the file system. >>> _is_nested("a.b", "path/a/b", "a", "path/a") True >>> _is_nested("a.b", "path/a/b", "a", "otherpath/a") False >>> _is_nested("a.b", "path/a/b", "c", "path/c") False >>> _is_nested("a.a", "path/a/a", "a", "path/a") True >>> _is_nested("b.a", "path/b/a", "a", "path/a") False rBrre)rnormpathrstripr startswithr)rr%rlrDZ norm_pkg_pathrestr5r5r6r=s  r=)dir_r,cCstj|ddt||S)zFCreate a directory ensured to be empty. Existing files may be removed.T) ignore_errors)rrmtreerMmakedirs)rIr5r5r6rs rc@s$eZdZddZddZddZdS)ricCs(||_||_||_||_g|_d|_dS)NF)rKrLrj editable_namerdry_run)rHrKrjrMrLr5r5r6rs z_NamespaceInstaller.__init__cCstj|j|j|jS)zInstallation target.)rMrPrQrjrMZ nspkg_extrGr5r5r6_get_nspkg_filesz#_NamespaceInstaller._get_nspkg_filecCstt|jS)z1Where the modules/packages should be loaded from.)reprr>rLrGr5r5r6 _get_rootsz_NamespaceInstaller._get_rootN)r8r9r:rrOrQr5r5r5r6risria import sys from importlib.machinery import ModuleSpec, PathFinder from importlib.machinery import all_suffixes as module_suffixes from importlib.util import spec_from_file_location from itertools import chain from pathlib import Path MAPPING = {mapping!r} NAMESPACES = {namespaces!r} PATH_PLACEHOLDER = {name!r} + ".__path_hook__" class _EditableFinder: # MetaPathFinder @classmethod def find_spec(cls, fullname, path=None, target=None): extra_path = [] # Top-level packages and modules (we know these exist in the FS) if fullname in MAPPING: pkg_path = MAPPING[fullname] return cls._find_spec(fullname, Path(pkg_path)) # Handle immediate children modules (required for namespaces to work) # To avoid problems with case sensitivity in the file system we delegate # to the importlib.machinery implementation. parent, _, child = fullname.rpartition(".") if parent and parent in MAPPING: return PathFinder.find_spec(fullname, path=[MAPPING[parent], *extra_path]) # Other levels of nesting should be handled automatically by importlib # using the parent path. return None @classmethod def _find_spec(cls, fullname, candidate_path): init = candidate_path / "__init__.py" candidates = (candidate_path.with_suffix(x) for x in module_suffixes()) for candidate in chain([init], candidates): if candidate.exists(): return spec_from_file_location(fullname, candidate) class _EditableNamespaceFinder: # PathEntryFinder @classmethod def _path_hook(cls, path): if path == PATH_PLACEHOLDER: return cls raise ImportError @classmethod def _paths(cls, fullname): # Ensure __path__ is not empty for the spec to be considered a namespace. return NAMESPACES[fullname] or MAPPING.get(fullname) or [PATH_PLACEHOLDER] @classmethod def find_spec(cls, fullname, target=None): if fullname in NAMESPACES: spec = ModuleSpec(fullname, None, is_package=True) spec.submodule_search_locations = cls._paths(fullname) return spec return None @classmethod def find_module(cls, fullname): return None def install(): if not any(finder == _EditableFinder for finder in sys.meta_path): sys.meta_path.append(_EditableFinder) if not NAMESPACES: return if not any(hook == _EditableNamespaceFinder._path_hook for hook in sys.path_hooks): # PathEntryFinder is needed to create NamespaceSpec without private APIS sys.path_hooks.append(_EditableNamespaceFinder._path_hook) if PATH_PLACEHOLDER not in sys.path: sys.path.append(PATH_PLACEHOLDER) # Used just to trigger the path hook )r^rrr,cCs(tt|ddd}tj|||dS)z_Create a string containing the code for the``MetaPathFinder`` and ``PathEntryFinder``. cSs|dS)Nrr5)rr5r5r6_rz"_finder_template..)rr^rr)rr6r_FINDER_TEMPLATEformatrSr5r5r6rYsrc@seZdZdZdS)rzCFile system does not seem to support either symlinks or hard links.N)r8r9r:r;r5r5r5r6rcsrc@seZdZdZdZdZdS)r_z!Problem in editable installation.a  An error happened while installing `{project}` in editable mode. The following steps are recommended to help debug this problem: - Try to install the project normally, without using the editable mode. Does the error still persist? (If it does, try fixing the problem before attempting the editable mode). - If you are using binary extensions, make sure you have all OS-level dependencies installed (e.g. compilers, toolchains, binary libraries, ...). - Try the latest version of setuptools (maybe the error was already fixed). - If you (or your project dependencies) are using any setuptools extension or customization, make sure they support the editable mode. After following the steps above, if the problem still persists and you think this is related to how setuptools handles editable installations, please submit a reproducible example (see https://stackoverflow.com/help/minimal-reproducible-example) to: https://github.com/pypa/setuptools/issues r.N)r8r9r:Z_SUMMARYZ_DETAILSZ _SEE_DOCSr5r5r5r6r_gsr_)Yr;ZloggingrrMrrr\ contextlibrenumrinspectr itertoolsrpathlibrZtempfilertypingrr r r r r rrrrrBrrrrrZ discoveryrrJrwarningsrrrrrrr!rr$Ztyping_extensionsabcr%r>rr&Z getLoggerr8rr(rrr?rrrrrrboolrrrrrrr4rrr7r=rZ InstallerrirTrZ FileErrorrr_r5r5r5r6s       0          )  F1 )     T