\bg@JdZddlmZddlZddlZddlZddlZddlZddlm Z m Z m Z ddl m Z ddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZmZmZmZd dl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&d dl#m'Z'd dl(m)Z)d dl*m+Z+d dl,m-Z-d dl.m/Z/m0Z0m1Z1ddl2m2Z3ddl4m4Z5ddl6m6Z7ddl8m8Z9ddl:m:Z;ddlm?Z?d dl@mAZAede'ZBejCeDZEGdd eZFd!ZGd"ZHGd#d$e!ZIGd%d&eZJGd'd(ZKGd)d*eKZLGd+d,ZMdad1ZNdbd5ZOdcd<ZPd=ZQdddAZRdddBZSdedEZTdfdGZUdgdIZVdhdLZWdidMZXdjdRZYdkdTZZGdUdVe&j[Z\dWZ]dld\Z^Gd]d^e%j_Z`Gd_d`e1ZadS)ma 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``. ) annotationsN)IterableIteratorMapping)suppress)Enum)cleandoc)chainstarmap)Path)TemporaryDirectory) TracebackType) TYPE_CHECKINGProtocolTypeVarcast)Command_normalization_path_shutilerrors namespaces)StrPath)py312find_package_path) Distribution)InformationOnlySetuptoolsDeprecationWarningSetuptoolsWarning)build)build_py) dist_info)egg_info)install)install_scripts)Self WheelFile_P)boundc6eZdZdZdZdZdZed dZd S) _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). strictlenientcompatmode str | Nonereturnc|s tjS|}|tjvrt jd|d|dkrt jdddt|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)see_docs)r/LENIENTupper __members__r OptionErrorr emit)clsr3_modes r/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/command/editable_wheel.pyconvertz_EditableMode.convert@s ) ( (   1 1 1$%Wt%W%W%WXX X H   ( -* ;     U##N)r3r4r5r/) __name__ __module__ __qualname____doc__STRICTr:r7 classmethodrBrCrAr/r/4sMFG F$$$[$$$rCr/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. ceZdZdZdZddddeejpdfgZdZd&d Z d&d Z d Z dZ d'dZ d(dZdZd)dZd*dZd&dZd+dZd Zd,d"Zd-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=Nc>d|_d|_d|_d|_dSN)dist_dir dist_info_dir project_dirr3selfs rAinitialize_optionsz!editable_wheel.initialize_optionsus$ ! rCr5Nonec|j}|jp tj|_|jpi|_t |jp$tj |jd|_dS)Ndist) distributionsrc_rootoscurdirrT package_dirr rRpathjoin)rVrZs rAfinalize_optionszeditable_wheel.finalize_options{sX =5BI+1rT]Tbgll4;KV.T.TUU rCc |jd||d|d}||j||dS#t$rUtj |j j p|j }t|wxYw)NT)exist_ok bdist_wheel)project)rRmkdir_ensure_dist_inforeinitialize_commandget_finalized_commandwrite_wheelfilerS_create_wheel_file Exception traceback print_excr[nameget_name_DebuggingTipsr>)rVrerfs rArunzeditable_wheel.runs  M    . . .  " " $ $ $  % %m 4 4 444]CCK  ' '(: ; ; ;  # #K 0 0 0 0 0      ! ! !',L0A0J0J0L0LG     0 0 0   s BB AC+c|jjtt|d}|j|_|||j|_dSt|j dsJt|jd sJdS)Nr%z .dist-infoMETADATA) rSr dist_info_clsrirR output_dirensure_finalizedrsstrendswithr exists)rVr%s rArhz editable_wheel._ensure_dist_infos   %]D,E,Ek,R,RSSI#'=I  & & ( ( ( MMOOO!*!8D   t)**33LAA A AA*J77>>@@ @ @@ @ @rCc|j}|jsdSt|j|jdd}t||||}|dS)NrO.) r[namespace_packagesr rTr_getresolve_NamespaceInstallerinstall_namespaces)rVinstallation_dir pth_prefixrZr\ installers rA_install_namespacesz"editable_wheel._install_namespacessw &  F($*:*>*>r3*G*GHHPPRR'.> HUU $$&&&&&rCr4c|jrt|jjn t}tt|d}t |dS)Nz *.egg-info)rSr parentmapryglobnext)rV parent_dir candidatess rA_find_egg_info_dirz!editable_wheel._find_egg_info_dirsT8<8JVT$,--44PTPVPV jool;;<< J%%%rCrpryunpacked_wheelr build_libtmp_dircb|j}t|}t|}tt||dd}tt||dd}tt||dd} tt|dd} t|| _d| _tt|dd} tt|d d} |x| _ x| _ | _ |x| _ x| _| _| x| _| _|| _|| _tt(|d } d| _t|| _tt0|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.datadataheadersscriptsr&T)reinit_subcommandsr#r'r(r$FN)r[ryr r egg_info_clsriegg_baseignore_egg_info_in_manifest build_cls install_cls build_platlib build_purelibrinstall_purelibinstall_platlib install_libr( build_scriptsinstall_headers install_datainstall_scripts_clsget_command_objno_ep build_temp build_py_clscompilerexisting_egg_info_dir_set_editable_moderx)rVrprrrrZwheelrrrr&r#r'r(r$s rA_configure_buildzeditable_wheel._configure_builds N## NN 44??@@d>d>>>9EEFFd>d>>>9EEFF $33JSW3XX   LL/3, t00T0RR   229QU2VV  GPOOe1EORWWW'"9G>>g~rC dist_namec|||||||\}}|d|d|d||fS)Nrrr)r_run_build_subcommandsr _run_install)rVrrrrrrs rA_run_build_commandsz"editable_wheel._run_build_commandss iGLLL ##%%%4466w )$$$ )$$$ &!!!g~rCc|d}|D]^}||}|dkr,t|tur||I||_dS)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. r#r$N)rjrtyper _safely_run run_command)rVr#rprs rArz%editable_wheel._run_build_subcommandss**733**,, ' 'D,,T22Cz!!d3ii|&C&C  &&&&  &&&&  ' 'rCrc  ||S#t$r4tjddt jd|d|dYdSwxYw)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. )rrmr r>rn format_exc)rVrs rArzeditable_wheel._safely_run$s ##H-- -    ( -B%''9A .6       s:AAc ddlm}|d}|j}d|}d}|d|d|d}t |j|}|r| t|} td} td } | 5} | 5} | 5}t | t |j j}tj |j ||| |||| | |\}}|||| }|5||d 5}|||||| dddn #1swxYwYdddn #1swxYwYdddn #1swxYwYdddn #1swxYwYdddn #1swxYwY|S) Nrr*r%-z 0.editablez.whl)suffixz .build-libz .build-tempw)wheel.wheelfiler+rjrpraget_tagr rRr{unlinkr rSshutilcopytreerr_select_strategy write_files)rVrer+r%rtag build_tag archive_name wheel_pathrr build_tmpunpackedlibtmpunpacked_dist_inforrstrategy wheel_objs rArlz!editable_wheel._create_wheel_file@sH------..{;; N hh{**,,-- #;;i;;#;;; $-66           +<@@@&l;;; &m<<<  0x 0c9 0!%hT5G0H0H0M!N!N  OD.0B C C C  $ $Xy 9 9 9!55i3PSTTNE7,,YSAAH 0 099Z55 0E7333%%h/// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sG0 G B G F+ %#F  F+ FF+ FF+  G+F/ /G2F/ 3G6 GG G G G G0G G0 G !G00G47G4categoryct|jd|d}|rB|r:td|d|d|dSdSdS)Nhas_z Installing z as non editableinstall_)getattrr[_loggerinfor)rVr has_categorys rArzeditable_wheel._run_install\st02C2C2CTJJ  4LLNN 4 LLAxAAA B B B   222 3 3 3 3 3 4 4 4 4rCrEditableStrategyc\d|d|}t|j}t|j}|tjur:t t|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__.rr#rOr})r rTr/rBr3rH _empty_dir _LinkTreer[_find_packages_simple_layoutr_r7setr _StaticPth_TopLevelFinder) rVrprr build_namerTr3 auxiliary_dirpackageshas_simple_layoutis_compat_modesrc_dirs rArzeditable_wheel._select_strategybs#2T11C11 4+,, $$TY// =' ' '&tD, (. (&**2s33Gd/['8R8R7STT Tt0$777rCr5rX)r5r4)rpryrrrrrr)r5r) rryrrrrrrr5r)rry)rry)rpryrryrrr5r)rDrErFrG descriptionr r/ user_optionsrWrbrsrhrrrrrrrrrlrrrJrCrArLrLgsm WK LK $!6!<"==>L  VVVV " A A A'''&&&& 8#8#8#8#t # # #        '''',884444 888888rCrLc&eZdZdd Zdd ZddZdS)rrr+r list[str]rMapping[str, str]r5objectcdSrQrJ)rVrrrs rA__call__zEditableStrategy.__call__~srCr)cdSrQrJrUs rA __enter__zEditableStrategy.__enter__srC _exc_typetype[BaseException] | None _exc_valueBaseException | None _tracebackTracebackType | NonecdSrQrJrVrrrs rA__exit__zEditableStrategy.__exit__s rCN)rr+rrrrr5rr5r))rrrrrrr5r)rDrErFrrr rJrCrArr}sJ%$$$rCrc.eZdZdd ZddZddZddZdS)rrZrrpry path_entries list[Path]r5rXc0||_||_||_dSrQ)rZrpr )rVrZrpr s rA__init__z_StaticPth.__init__s  (rCrr+rrrrcdd|jD}t|d}|d|jd|dS)N c3XK|]%}t|V&dSrQ)ryr).0ps rA z&_StaticPth.__call__..s2HHC ,,HHHHHHrCr.pth)rar  _encode_pthwritestrrp)rVrrrentriescontentss rArz_StaticPth.__call__s`))HHd6GHHHHH'~~~.. 6ty666AAAAArCr)cdtttj|jd}t |tz|S)Nz_ Editable install will be performed using .pth file to extend `sys.path` with: z )listrr]fspathr rwarning_LENIENT_WARNINGrVmsgs rArz_StaticPth.__enter__sQ c")T.// 0 0    ../// rCrrrrcdSrQrJr s rAr z_StaticPth.__exit__s rCN)rZrrpryr rr5rXrr+rrrrr rrrrrrr5rX)rDrErFrrrr rJrCrArrsh)))) BBBB       rCrcZeZdZdZd#fd Zd$fd Zd%dZd&d'dZd(dZd)dZ d*d"Z xZ S)+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. rZrrpryrrrr5rXc t||_t||_|dj|_t|||jgdS)Nr$) r rrrr copy_file_filesuperr)rVrZrprr __class__s rArz_LinkTree.__init__sn"-00i0022))*55?  td&8%9:::::rCrr+rrrrcz|||t|||dSrQ) _create_linksr*r)rVrrrr+s rArz_LinkTree.__call__s; 5'*** w/////rCfiler4c*tt5t||j}t |tj dcdddS#1swxYwYdS)N/) r ValueErrorr r relative_torryreplacer]sep)rVr.r`s rA_normalize_outputz_LinkTree._normalize_outputs j ! ! 2 2::%%''33DNCCDt99$$RVS11 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2tsA&BB B Nrelative_outputsrc_filec|j|z }|js|jd||||dS)NT)parentslink)rris_dirrgr))rVr6r7r;dests rA _create_filez_LinkTree._create_files\!O3{!!## , K  d  + + + 8T -----rCoutput_mappingcjddtjrdnd}fd|D}d|D}|D]3}|}|r||vr||4|D]\}}|||dS)NT)r9rdsymhardc3LK|]\}}||fVdSrQ)r5)rkvrVs rArz*_LinkTree._create_links..s:XXAt--a00!4XXXXXXrCci|] \}}||| SrQrJ)rrDrEs rA z+_LinkTree._create_links..sAAATQ1=Aq===rCr:)rrg_can_symlink_filesitemsr5r>) rVoutputsr? link_type normalisedmappingsoutputrelativesrcs ` rAr-z_LinkTree._create_linkss    ===/0BCCOEE XXXXAUAUAWAWXXX AAZAAA 4 4F--f55H 4HH44!!(F333%^^-- = =MHc   h)  < < < < = =rCr)cNd}t|tz|S)Nz=Strict editable install will be performed using a link tree. )rr_STRICT_WARNINGr!s rArz_LinkTree.__enter__s#No-... rCrrrrcFd|jd}tjd|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.)rrr>rVrrrr"s rAr z_LinkTree.__exit__s:       5s;;;;;rC) rZrrpryrrrrr5rXr$)r.ryr5r4rQ)r6ryr7ry)r?rr r%) rDrErFrGrrr5r>r-rr  __classcell__)r+s@rArrs ; ; ; ; ; ;000000..... = = = = < < < < < < < eZdZddZdd Zdd ZddZddZd dZdS)!rrZrrpryr5rXc"||_||_dSrQ)rZrp)rVrZrps rArz_TopLevelFinder.__init__s  rC5tuple[str, str, dict[str, str], dict[str, list[str]]]c  jjp tj}t t jt j}jjpi}t||| tt tjj pg dt D} fdjj pgD}i |}djd}tj|}||||fS)Nc3K|]}|gfV dSrQrJ)rnss rArz0_TopLevelFinder.template_vars..s&DDb"bDDDDDDrCcLi|] }|t|jjpd!S)rO)rrZr\)rpkgrootsrVs rArGz1_TopLevelFinder.template_vars..sB    "3ty/A/GRHH   rCrz.finder)rZr\r]r^r r_find_top_level_modulesr__find_package_rootsdict_find_namespacesr_find_virtual_namespacesr~rprsafe_identifier) rVr\ top_levelr_ namespaces_legacy_namespacesrrpfinderr_s ` @rA template_varsz_TopLevelFinder.template_varss#9%2.335LTY5W5WXX i+1r #I{HEE,0  !3!9r5AADD$rUs rAr z_TopLevelFinder.__exit__$s%   5s;;;;;rCN)rZrrpryr5rX)r5rY)r5rkr$r r%) rDrErFrrjrqrrr rJrCrArrs222269999**** < < < < < >> _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 c4i|]}|t|SrJr)rr^r_rTs rArGz"_simple_layout..ys( X X Xc$S+{CC X X XrCrOc 3K|]:\}}tjtg|dR|V;dSr}N)r same_pathr split)rkeyvaluers rArz!_simple_layout..}sa C V5ciinn555u==rC)rr]r` commonpathr _parent_pathrIall)rr_rTlayoutrs `` @rArrZs>Y X X X Xx X X XF .;B:-- W   fllnn E E F FF  ,,..  rCc||r|dt| n|}|dtjzS)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' Nr0)rzlenrstripr]r4)r^pkg_pathrs rArrsJ'/&7&7&<&< JXkS k " "(F ==rv & &&rCrZr Iterator[str]c#Kt|jpgEd{V|jpg}d|D}|jr |jVn|jpg}|d|Dz }|D]}|d\}}}|V dS)Ncg|]}d|v| Sr}rJrmods rA z"_find_packages..s>>>c3#::c:::rCc.g|]}d|jv |jSrrprxs rArz"_find_packages..s!HHHa#--16---rCr})iterr py_modules ext_package ext_modules rpartition)rZrnested_modulesrmodulepackage_s rArrsDM'R(((((((((&BJ>>Z>>>N I&," HH;HHHH ))#.. A rCc#K|jpg}d|DEd{V|js|jpg}d|DEd{VdSdS)Nc3"K|] }d|v|V dSrrJrs rArz*_find_top_level_modules..s&<<S^^^^^^<.s0EEq3af3D3DAF3D3D3D3DEErC)rrr)rZrrs rAr`r`s&BJ<.s@!!!  ^-c;II J J!!!rC)sorted_remove_nested)rr_r\ pkg_rootss `` rArarasI !!!!!(##!!!I ) $ $$rCr`ct|}|j}|r!t|St||jz S)z(Works for packages and top-level modules)r rr{ryrrp)r`path_rs rArrsY JJE \F ||~~25==??###6>>##ej0111rCrc #>K|D]}d|vr|d}tt|dz ddD]Y}d|d|}t t ||d}|r||vr|VZdS)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. r}r"rNrO)rrangerrar rr{)rr^partsi partial_namer`s rArdrds # # c>>  #s5zzA~q"-- # #A88E"1"I..L), 2FFGGD;;== #L $A$A""""  # # #rCrIterator[tuple[str, list[str]]]c#K|D]]}t||d}t|r)t|ds||gfV^dS)NrOz __init__.py)rr r{)rrr^r`s rArcrcs|   i44 ::     tD-'@'@'G'G'I'I -     rCc:t|}tt|D]H\t fd|Dr|I|S)Nc3NK|]\}}|kot||V dSrQ) _is_nested)rother other_pathr`r^s rArz!_remove_nested..sR  !z 5L EZT5*EE      rC)rbcopyreversedrrIanypop)rrNr`r^s @@rArrs ).."" # #Fd9??#4#45566 T      %.__%6%6       JJsOOO MrCr^rr parent_pathctj|}||dddd}||o"|tjt |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 rOr"r})rnormpathr3stripr startswithr )r^rrr norm_pkg_pathrests rArrsN8,,M ;;vr1 % % + +C 0 0 6 6s ; ;D >>& ! ! mu~ [ 4   88'rCdir_cZtj|dtj||S)zFCreate a directory ensured to be empty. Existing files may be removed.T) ignore_errors)rrmtreer]makedirs)rs rArrs, N4t,,,,K KrCc"eZdZddZdZdZdS)rr5rXcZ||_||_||_||_g|_d|_dS)NF)r[r\r editable_namerJdry_run)rVr[rrr\s rArz_NamespaceInstaller.__init__s3(  0*"$  rCcftj|j|j|jzS)zInstallation target.)r]r`rarr nspkg_extrUs rA_get_nspkg_filez#_NamespaceInstaller._get_nspkg_files%w||D143E3VWWWrCcDtt|jS)z1Where the modules/packages should be loaded from.)reprryr\rUs rA _get_rootz_NamespaceInstaller._get_rootsC &&'''rCNr)rDrErFrrrrJrCrArr sIXXX(((((rCra from __future__ import annotations 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: dict[str, str] = {mapping!r} NAMESPACES: dict[str, list[str]] = {namespaces!r} PATH_PLACEHOLDER = {name!r} + ".__path_hook__" class _EditableFinder: # MetaPathFinder @classmethod def find_spec(cls, fullname: str, path=None, target=None) -> ModuleSpec | None: # type: ignore # 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]]) # Other levels of nesting should be handled automatically by importlib # using the parent path. return None @classmethod def _find_spec(cls, fullname: str, candidate_path: Path) -> ModuleSpec | None: 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) return None class _EditableNamespaceFinder: # PathEntryFinder @classmethod def _path_hook(cls, path) -> type[_EditableNamespaceFinder]: if path == PATH_PLACEHOLDER: return cls raise ImportError @classmethod def _paths(cls, fullname: str) -> list[str]: paths = NAMESPACES[fullname] if not paths and fullname in MAPPING: paths = [MAPPING[fullname]] # Always add placeholder, for 2 reasons: # 1. __path__ cannot be empty for the spec to be considered namespace. # 2. In the case of nested namespaces, we need to force # import machinery to query _EditableNamespaceFinder again. return [*paths, PATH_PLACEHOLDER] @classmethod def find_spec(cls, fullname: str, target=None) -> ModuleSpec | None: # type: ignore 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) -> None: 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 rprrdict[str, list[str]]ctt|d}t|||S)z_Create a string containing the code for the``MetaPathFinder`` and ``PathEntryFinder``. c|dS)NrrJ)rs rAz"_finder_template..~s 1rC)rrprr)rbrrI_FINDER_TEMPLATEformatrs rAroroxsC 6'--//~~>>>??G  " "g* " U UUrCceZdZdZdS)rzCFile system does not seem to support either symlinks or hard links.N)rDrErFrGrJrCrArrsMMMMrCrceZdZdZdZdZdS)rrz!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 r8N)rDrErF_SUMMARY_DETAILS _SEE_DOCSrJrCrArrrrs!2HH*2IIIrCrr)rpryr5rn)rr r5r)rrr_rrTrr5r)rZrr5r)rrr_rr\rr5r)r`rr5ry)rrr5r)rrrrr5r)rrr5r) r^ryrryrryrryr5r)rr,r5r,)rpryrrrrr5ry)brG __future__rrxloggingr]rrncollections.abcrrr contextlibrenumrinspectr itertoolsr r pathlibr tempfiler typesrtypingrrrrrOrrrrrrrr2r discoveryrrZrwarningsrr r!r#rr$rr%rvr&rr'rr(rtyping_extensionsr)_vendor.wheel.wheelfiler+r, getLoggerrDrr/rRr rLrrrrrrHrrrr`rarrdrcrrr Installerrrro FileErrorrrrrJrCrArsE  #"""""  7777777777$$$$$$$$''''''999999999999JJJJJJJJJJJJJJJJ))))))WWWWWWWWWW%%%%%%......111111......++++++CCCCCC4&&&&&&333333 WT!!! ' H % %&$&$&$&$&$D&$&$&$R S8S8S8S8S8WS8S8S8l     x           8I<I<I<I<I< I<I<I