+
    SBi                    P   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHtHtHt ^RI H!t!H"t"H#t#H$t$H%t%H&t& ^RI#H't' ^RI(H)t)H*t* ^RI+H,t, ^RI-H.t. ^RI/H0t0H1t1 ^RI2H2t3 ^RI4H4t5 ^RI6H6t7 ^RI8H8t9 ^RI:H:t; ^RI<H<t= ]'       d   ^ RI>H?t? ^RI@HAtA ]! R]'R7      tB]P                  ! ]D4      tE ! R R]4      tFRtGRtH ! R  R!]!4      tI ! R" R#]4      tJ ! R$ R%4      tK ! R& R']K4      tL ! R( R)4      tMR* R+ ltNR, R- ltOR. R/ ltPR0 tQR1 R2 ltRR3 R4 ltSR5 R6 ltTR7 R8 ltUR9 R: ltVR; R< ltWR= R> ltXR? R@ ltYRA RB ltZ ! RC RD]&P                  4      t\REt]RF RG lt^ ! RH RI]%P                  4      t`R# )Ja  
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)IterableIteratorMapping)suppress)Enum)cleandoc)chainstarmap)Path)TemporaryDirectory)TracebackType)TYPE_CHECKINGProtocolTypeVarcast)Command_normalization_path_shutilerrors
namespaces)StrPath)py310py312)find_package_path)Distribution)InformationOnlySetuptoolsDeprecationWarning)build)build_py)	dist_info)egg_info)install)install_scripts)Self	WheelFile_P)boundc                  <    ] tR t^4tRtRtRtRt]R R l4       t	Rt
R# )	_EditableModez
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).
strictlenientcompatc                    V ^8  d   QhRRRR/# )   mode
str | Nonereturnr+    )formats   "F/usr/lib/python3.14/site-packages/setuptools/command/editable_wheel.py__annotate___EditableMode.__annotate__A   s     $ $: $- $    c                	   V'       g   \         P                  # VP                  4       pV\         P                  9  d   \        P
                  ! R V: R24      hVR8X  d   \        P                  ! RRRR7       \         V,          # )zInvalid editable mode: z. Try: 'strict'.COMPATzCompat 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.
                zuserguide/development_mode.html)see_docs)r+   LENIENTupper__members__r   OptionErrorr   emit)clsr1   _modes   && r6   convert_EditableMode.convert@   sv     (((

111$$'>thFV%WXXH(--* ;  U##r9   r4   N)__name__
__module____qualname____firstlineno____doc__STRICTr=   r;   classmethodrD   __static_attributes__r4   r9   r6   r+   r+   4   s*     FGF$ $r9   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                      ] tR t^gtRtRtR R!RR]! ]P                  ;'       g    R4      3.tR t	R R lt
R	 R
 ltR tR tR R ltR R ltR tR R ltR R ltR R ltR R ltR tR R ltR R ltRtR# )"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 wheelzmode=N c                	>    R V n         R V n        R V n        R V n        R # N)dist_dirdist_info_dirproject_dirr1   selfs   &r6   initialize_options!editable_wheel.initialize_optionsu   s     !	r9   c                   V ^8  d   QhRR/# r0   r3   Noner4   )r5   s   "r6   r7   editable_wheel.__annotate__{   s     V V$ Vr9   c                	>   V P                   pVP                  ;'       g    \        P                  V n        VP
                  ;'       g    / V n        \        V P                  ;'       g+    \        P                  P                  V P                  R 4      4      V n        R# )distN)
distributionsrc_rootoscurdirrU   package_dirr   rS   pathjoin)rW   r_   s   & r6   finalize_optionseditable_wheel.finalize_options{   sh      ==55BII++11rT]]TTbggll4;K;KV.TUr9   c                   V ^8  d   QhRR/# r[   r4   )r5   s   "r6   r7   r]      s      T r9   c                	    V P                   P                  R R7       V P                  4        V P                  R4       V P	                  R4      pVP                  V P                  4       V P                  V4       R#   \         dZ   pT P                  P                  ;'       g    T P                  P                  4       p\        P                  ! TRT R24       h Rp?ii ; i)T)exist_okbdist_wheelz3An error occurred when building editable wheel for zl.
See debugging tips in: https://setuptools.pypa.io/en/latest/userguide/development_mode.html#debugging-tipsN)rS   mkdir_ensure_dist_inforeinitialize_commandget_finalized_commandwrite_wheelfilerT   _create_wheel_file	Exceptionr`   nameget_namer   add_note)rW   rl   exprojects   &   r6   runeditable_wheel.run   s    	MM.""$ %%m444]CK''(:(:;##K0 	'',,LL0A0A0J0J0LGNNEgY Of f 	s   A:A> >C"	ACC"c                	   V P                   fd   \        \        V P                  R4      4      pV P                  Vn        VP                  4        VP                  4        VP                   V n         R # \        V P                   4      P                  R4      '       g   Q h\        V P                   R4      P                  4       '       g   Q hR # )Nr!   z
.dist-infoMETADATA)rT   r   dist_info_clsro   rS   
output_dirensure_finalizedry   strendswithr   exists)rW   r!   s   & r6   rn    editable_wheel._ensure_dist_info   s    %]D,E,Ek,RSI#'==I &&(MMO!*!8!8Dt))*33LAAAA**J7>>@@@@r9   c                	    V P                   pVP                  '       g   R # \        V P                  V P                  P                  RR4      4      P                  4       p\        W1W$4      pVP                  4        R # )NrP   .)	r`   namespace_packagesr   rU   rd   getresolve_NamespaceInstallerinstall_namespaces)rW   installation_dir
pth_prefixr_   ra   	installers   &&&   r6   _install_namespaces"editable_wheel._install_namespaces   sb      &&&(($*:*:*>*>r3*GHPPR'
U	$$&r9   c                   V ^8  d   QhRR/# )r0   r3   r2   r4   )r5   s   "r6   r7   r]      s     & &J &r9   c                	    V P                   '       d    \        V P                   4      P                  M	\        4       p\        \        VP                  R 4      4      p\        VR4      # )z
*.egg-infoN)rT   r   parentmapr   globnext)rW   
parent_dir
candidatess   &  r6   _find_egg_info_dir!editable_wheel._find_egg_info_dir   sK    8<8J8J8JT$,,-44PTPV
jool;<
J%%r9   c               (    V ^8  d   QhRRRRRRRR/# )r0   rt   r   unpacked_wheelr   	build_libtmp_dirr4   )r5   s   "r6   r7   r]      s,     =# =#=#)0=#=D=#OV=#r9   c                   V P                   p\        V4      p\        V4      p\        \        W! R2R4      4      p\        \        W! R2R4      4      p\        \        W! R2R4      4      p	\        \        VP                  RRR7      4      p
\        V4      V
n        RV
n        \        \        VP                  RRR7      4      p\        \        VP                  R	RR7      4      pV;Vn
        ;Vn        Vn        V;Vn        ;Vn        Vn        V	;Vn        Vn        Wn        W|n        VP)                  R
4      pRVn        \        \,        VP)                  R4      4      pRVn        \        V4      Vn        \        \2        VP)                  R4      4      pRVn        V P7                  4       Vn        V P;                  4        VP=                  4        VP=                  4        R# )a  Configure 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.datadataheadersscriptsr"   T)reinit_subcommandsr   r#   build_scriptspythonr$   r    FN)r`   r   r   r   egg_info_clsro   egg_baseignore_egg_info_in_manifest	build_clsinstall_clsbuild_platlibbuild_purelibr   install_purelibinstall_platlibinstall_libr$   r   install_headersinstall_dataget_command_obj
executableinstall_scripts_clsno_ep
build_tempbuild_py_clscompiler   existing_egg_info_dir_set_editable_moder   )rW   rt   r   r   r   r_   wheelr   r   r   r"   r   r#   r   r$   r    s   &&&&&           r6   _configure_buildeditable_wheel._configure_build   s      N#	N	4&?@d>V5>9EFd>V5>9EF $33JSW3X
  L/3,t00T0R
 229QU2V
 GPOOe1EORWWW'"9G<O8??%"5")# ,,_=#+ !5!56G!H
 !%w<d&:&::&FG )-)@)@)B&!   "r9   c                    V P                   pVP                  R4      pVP                  4        FJ  pVP                  V4      p\        VR4      '       d
   RVn        K/  \        VR4      '       g   KC  RVn        KL  	  R# )z8Set the ``editable_mode`` flag in the build sub-commandsr   editable_modeTinplaceN)r`   r   get_sub_commandshasattrr   r   )rW   r_   r   cmd_namecmds   &    r6   r   !editable_wheel._set_editable_mode   si      $$W-..0H&&x0CsO,,$(!i((" 1r9   c                   V ^8  d   QhRR/# )r0   r3    tuple[list[str], dict[str, str]]r4   )r5   s   "r6   r7   r]      s      (H r9   c                	r   . p/ pV P                  R 4      pVP                  4        F  pV P                  V4      p\        VR4      '       d*   TP                  VP	                  4       ;'       g    . 4       \        VR4      '       g   Kc  TP                  VP                  4       ;'       g    / 4       K  	  W3# )r   get_outputsget_output_mapping)rp   r   r   extendr   updater   )rW   filesmappingr   r   r   s   &     r6   _collect_build_outputs%editable_wheel._collect_build_outputs   s    "$**73..0H,,X6CsM**S__.44"5s011s557==2> 1 ~r9   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r0   	dist_namer   r   r   r   r   r3   r   r4   )r5   s   "r6   r7   r]     s<         	
  
*r9   c                	    V P                  WW44       V P                  4        V P                  4       w  rVV P                  R 4       V P                  R4       V P                  R4       WV3# )r   r   r   )r   _run_build_subcommandsr   _run_install)rW   r   r   r   r   r   r   s   &&&&&  r6   _run_build_commands"editable_wheel._run_build_commands  sb     	iL##%446)$)$&!~r9   c                   V ^8  d   QhRR/# r[   r4   )r5   s   "r6   r7   r]     s     ' ' 'r9   c                    V P                  R4      pVP                  4        FR  pV P                  V4      pVR8X  d'   \        V4      \        Jd   V P	                  V4       KA  V P                  V4       KT  	  R# )aE  
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)rp   r   typer   _safely_runrun_command)rW   r   rt   r   s   &   r6   r   %editable_wheel._run_build_subcommands  sf     **73**,D,,T2Cz!d3i|&C  &  & -r9   c                   V ^8  d   QhRR/# )r0   r   r   r4   )r5   s   "r6   r7   r]   -  s      C r9   c                	     V P                  V4      #   \         d9    \        P                  ! R R\        P
                  ! 4        RT RT R24        R# i ; i)z0Customization 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 `aa  ` 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 behavior will change in future versions.
                N)r   rs   r   rA   	traceback
format_exc)rW   r   s   &&r6   r   editable_wheel._safely_run-  sp    	##H-- 	(--B%%'( )8 9Az B-
 .6J 7	s    ?AAc                	&   ^ RI Hp V P                  R4      pVP                  pRP	                  VP                  4       4      pRpV RV RV R2p\        V P                  V4      pVP                  4       '       d   VP                  4        \        VR7      p	\        RR7      p
\        RR7      pT	;_uu_ 4       q;_uu_ 4       q;_uu_ 4       p\        V\        V P                  4      P                  4      p\        P                  ! V P                  V4       V P                  W4       V P                  WLW4      w  ppV P!                  WEV4      pT;_uu_ 4        V! VR	4      ;_uu_ 4       pV! VVV4       VP#                  V4       R
R
R
4       R
R
R
4       R
R
R
4       R
R
R
4       R
R
R
4       V#   + '       g   i     L2; i  + '       g   i     L=; i  + '       g   i     LH; i  + '       g   i     LS; i  + '       g   i     T# ; i)    r&   r!   -z
0.editablez.whl)suffixz
.build-libz.build-tempwN)wheel.wheelfiler'   rp   rt   rf   get_tagr   rS   r   unlinkr   rT   shutilcopytreer   r   _select_strategywrite_files)rW   rl   r'   r!   r   tag	build_tagarchive_name
wheel_pathr   r   	build_tmpunpackedlibtmpunpacked_dist_infor   r   strategy	wheel_objs   &&                  r6   rr   !editable_wheel._create_wheel_fileI  s   -..{;	NN	hh{**,- 	#Ai[#d;$--6
+<@&l;	&m<	^xc99!%hT5G5G0H0M0M!NOOD..0BC$$X9!55i3TNE7,,YSAH9Z55E73%%h/ 6 <E^ 	 65 <E9^^ sm   :
G?
G,	BGG-F3	GGG,	!G?3G>GGGG)$G,	,G<7G??H	c                   V ^8  d   QhRR/# )r0   categoryr   r4   )r5   s   "r6   r7   r]   e  s     4 4S 4r9   c                	    \        V P                  R V 2R4      pV'       d?   V! 4       '       d0   \        P                  RV R24       V P	                  RV 24       R# R# R# )has_NzInstalling z as non editableinstall_)getattrr`   _loggerinfor   )rW   r   has_categorys   && r6   r   editable_wheel._run_installe  sX    t00D
2CTJLNNLL;xj0@ABxz23 +<r9   c               (    V ^8  d   QhRRRRRRRR/# )r0   rt   r   r   r   r   r3   EditableStrategyr4   )r5   s   "r6   r7   r]   k  s2     8 88 8 	8
 
8r9   c                   RV RV 2p\        V P                  4      p\        P                  V P                  4      pV\        P
                  J d8   \        \        V P                  RV4      4      p\        V P                  WV4      # \        V P                  4      p\        WP                  V4      p	V\        P                  J p
\        V P                  4      R08X  d	   V	'       g	   V
'       d>   V P                  P                  RR4      p\        V P                  V\        W[4      .4      # \!        V P                  V4      # )zDDecides which strategy to use to implement an editable installation.__editable__.r   r   rP   r   )r   rU   r+   rD   r1   rK   
_empty_dir	_LinkTreer`   _find_packages_simple_layoutrd   r;   setr   
_StaticPth_TopLevelFinder)rW   rt   r   r   
build_namerU   r1   auxiliary_dirpackageshas_simple_layoutis_compat_modesrc_dirs   &&&&        r6   r   editable_wheel._select_strategyk  s    %TF!C51
4++,$$TYY/='''&tD,<,<gz'RSMT..YOO!$"3"34*85E5E{S!5!55t RD(->.&&**2s3Gd//[8R7STT t00$77r9   )rS   rT   r1   rd   rU   )z	dist-dir=dz-directory to put final built distributions in)zdist-info-dir=Iz(path to a pre-build .dist-info directory)rF   rG   rH   rI   rJ   descriptionr   r+   user_optionsrX   rg   ry   rn   r   r   r   r   r   r   r   r   rr   r   r   rM   r4   r9   r6   rO   rO   g   s    
 WK 	LK	$!6!6!<!<"=>LV*	A'&
=#~	#',8848 8r9   rO   c                  :    ] tR tRtR R ltR R ltR R ltRtR	# )
r  i  c               (    V ^8  d   QhRRRRRRRR/# )	r0   r   r'   r   	list[str]r   Mapping[str, str]r3   objectr4   )r5   s   "r6   r7   EditableStrategy.__annotate__  s,      '0;L	r9   c                	    R # rR   r4   )rW   r   r   r   s   &&&&r6   __call__EditableStrategy.__call__  s    r9   c                   V ^8  d   QhRR/# r0   r3   r%   r4   )r5   s   "r6   r7   r    s    $$4$r9   c                	    R # rR   r4   rV   s   &r6   	__enter__EditableStrategy.__enter__  s    r9   c               (    V ^8  d   QhRRRRRRRR/# )	r0   	_exc_typeztype[BaseException] | None
_exc_valuezBaseException | None
_tracebackzTracebackType | Noner3   r  r4   )r5   s   "r6   r7   r    s2      - ) )	
 
r9   c                	    R # rR   r4   rW   r)  r*  r+  s   &&&&r6   __exit__EditableStrategy.__exit__  s    
 r9   r4   N)rF   rG   rH   rI   r!  r&  r.  rM   r4   r9   r6   r  r    s     % r9   r  c                  F    ] tR tRtR R ltR R ltR R ltR R	 ltR
tR# )r  i  c               (    V ^8  d   QhRRRRRRRR/# )	r0   r_   r   rt   r   path_entriesz
list[Path]r3   r\   r4   )r5   s   "r6   r7   _StaticPth.__annotate__  s)     ) )\ ) )J )SW )r9   c                	*    Wn         W n        W0n        R # rR   r_   rt   r2  )rW   r_   rt   r2  s   &&&&r6   __init___StaticPth.__init__  s    		(r9   c               $    V ^8  d   QhRRRRRR/# r0   r   r'   r   r  r   r  r4   )r5   s   "r6   r7   r3    s'     B Bi B	 BDU Br9   c                	    R P                  R V P                   4       4      p\        V R 24      pVP                  RV P                   R2V4       R# )
c              3  T   "   T F  p\        VP                  4       4      x  K   	  R # 5irR   )r   r   ).0ps   & r6   	<genexpr>&_StaticPth.__call__.<locals>.<genexpr>  s      H6GC		,,6Gs   &(r  .pthN)rf   r2  _encode_pthwritestrrt   )rW   r   r   r   entriescontentss   &&&&  r6   r!  _StaticPth.__call__  sG    ))Hd6G6GHH'"~.tyyk6Ar9   c                   V ^8  d   QhRR/# r$  r4   )r5   s   "r6   r7   r3    s      4 r9   c                	    R \        \        \        P                  V P                  4      4      : R2p\
        P                  V\        ,           4       V # )z_
        Editable install will be performed using .pth file to extend `sys.path` with:
        z	
        )listr   rb   fspathr2  r   warning_LENIENT_WARNINGrW   msgs   & r6   r&  _StaticPth.__enter__  sH    		c"))T../	03 4	 	../r9   c               (    V ^8  d   QhRRRRRRRR/# r0   r)  r  r*  r+  r3   r\   r4   )r5   s   "r6   r7   r3    s2        	
 
r9   c                	    R # rR   r4   r-  s   &&&&r6   r.  _StaticPth.__exit__  s     	r9   r5  N)	rF   rG   rH   rI   r6  r!  r&  r.  rM   r4   r9   r6   r  r    s    )
B
 r9   r  c                     a  ] tR tRtRtR V 3R lltR V 3R lltR R ltRR	 R
 lltR R lt	R R lt
R R ltRtV ;t# )r	  i  aH  
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.
c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r0   r_   r   rt   r   r  r   r   r3   r\   r4   )r5   s   "r6   r7   _LinkTree.__annotate__  s<     
; 
;
; 
; 	
;
 
; 

;r9   c                	   < \        V4      V n        \        V4      P                  4       V n        VP	                  R 4      P
                  V n        \        SV `!  WV P                  .4       R# )r    N)	r   r  r   r   r   	copy_file_filesuperr6  )rW   r_   rt   r  r   	__class__s   &&&&&r6   r6  _LinkTree.__init__  sV     "-0i002))*5??
d&8&8%9:r9   c               $    V ^8  d   QhRRRRRR/# r9  r4   )r5   s   "r6   r7   rV    s"     0 0i 0	 0DU 0r9   c                	J   < V P                  W#4       \        SV `	  WV4       R # rR   )_create_linksrZ  r!  )rW   r   r   r   r[  s   &&&&r6   r!  _LinkTree.__call__  s     5*w/r9   c                    V ^8  d   QhRRRR/# )r0   filer   r3   r2   r4   )r5   s   "r6   r7   rV    s      c j r9   c                	$   \        \        4      ;_uu_ 4        \        V4      P                  4       P	                  V P
                  4      p\        V4      P                  \        P                  R 4      uuRRR4       #   + '       g   i     R# ; i)/N)
r   
ValueErrorr   r   relative_tor   r   replacerb   sep)rW   rb  re   s   && r6   _normalize_output_LinkTree._normalize_output  sZ    j!!:%%'33DNNCDt9$$RVVS1 "!!! s   AA>>B	c                    V ^8  d   QhRRRR/# )r0   relative_outputr   src_filer4   )r5   s   "r6   r7   rV    s     . .C .3 .r9   c                	    V P                   V,          pVP                  P                  4       '       g   VP                  P                  R R7       V P	                  W$VR7       R# )T)parentslinkN)r  r   is_dirrm   rY  )rW   rl  rm  rq  dests   &&&& r6   _create_file_LinkTree._create_file  sJ    !!O3{{!!##KKd+

8
-r9   c                   V ^8  d   QhRR/# )r0   output_mappingr  r4   )r5   s   "r6   r7   rV    s     = =5F =r9   c                	  a  S P                   P                  R R R7       \        S P                   4      '       d   RMRpV 3R lVP                  4        4       pV UUu/ uF  w  rVVf   K  WVbK  	  pppV F7  pS P	                  V4      p	V	'       g   K  W9  g   K&  S P                  W4       K9  	  VP                  4        F  w  rS P                  WVR7       K  	  R# u uppi )T)ro  rk   symhardc              3  N   <"   T F  w  rSP                  V4      V3x  K  	  R # 5irR   )ri  )r=  kvrW   s   &  r6   r?  *_LinkTree._create_links.<locals>.<genexpr>  s%     XAWt--a0!4AWs   "%Nrp  )r  rm   _can_symlink_filesitemsri  rt  )rW   outputsrw  	link_type
normalisedr|  r}  mappingsoutputrelativesrcs   f&&        r6   r_  _LinkTree._create_links  s       =/0B0BCCE	XAUAUAWX
%/AZTQ1DADZAF--f5HxH4!!(3 
 &^^-MHh)< . Bs   C*Cc                   V ^8  d   QhRR/# r$  r4   )r5   s   "r6   r7   rV          4 r9   c                	J    R p\         P                  V\        ,           4       V # )z=Strict editable install will be performed using a link tree.
)r   rK  _STRICT_WARNINGrM  s   & r6   r&  _LinkTree.__enter__  s    No-.r9   c               (    V ^8  d   QhRRRRRRRR/# rQ  r4   )r5   s   "r6   r7   rV    s2     < << < 	<
 
<r9   c                	T    R V P                    R2p\        P                  ! RV4       R# )z\

        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.N)r  r   rA   rW   r)  r*  r+  rN  s   &&&& r6   r.  _LinkTree.__exit__  s2      !	 	5s;r9   )rY  r  r   rR   )rF   rG   rH   rI   rJ   r6  r!  ri  rt  r_  r&  r.  rM   __classcell__)r[  s   @r6   r	  r	    s:    
; 
;0 0.=
< <r9   r	  c                  ^    ] tR tRtR R ltR R ltR R ltR R	 ltR
 R ltR R lt	Rt
R# )r  i  c               $    V ^8  d   QhRRRRRR/# )r0   r_   r   rt   r   r3   r\   r4   )r5   s   "r6   r7   _TopLevelFinder.__annotate__  s!      \   r9   c                	    Wn         W n        R # rR   r_   rt   )rW   r_   rt   s   &&&r6   r6  _TopLevelFinder.__init__  s    		r9   c                   V ^8  d   QhRR/# )r0   r3   z5tuple[str, str, dict[str, str], dict[str, list[str]]]r4   )r5   s   "r6   r7   r     s     2 2T 2r9   c           
     	   V P                   P                  ;'       g    \        P                  p\	        \        V P                   4      \        V P                   4      4      pV P                   P                  ;'       g    / p\        W#V4      p\        \	        \        V P                   P                  ;'       g    . V4      R  \        V4       4       4      4      pV P                   P                  ;'       g    .  Uu/ uF.  pT\        YdV P                   P                  ;'       g    R4      bK0  	  pp/ VCVCpRV P                   R2p	\         P"                  ! V	4      p
WW3# u upi )c              3  (   "   T F  q. 3x  K
  	  R # 5irR   r4   )r=  nss   & r6   r?  0_TopLevelFinder.template_vars.<locals>.<genexpr>	  s     D$Cbb$Cs   rP   r  z.finder)r_   ra   rb   rc   r	   r
  _find_top_level_modulesrd   _find_package_rootsdict_find_namespacesr  _find_virtual_namespacesr   r   rt   r   safe_identifier)rW   ra   	top_levelrd   rootsnamespaces_pkglegacy_namespacesr   rt   finders   &          r6   template_vars_TopLevelFinder.template_vars   s7   99%%22.35LTYY5WX	ii++11r#IHE !3!3!9!9r5AD$<U$CD
 yy3399r9
9 "3tyy/A/A/G/GRHH9 	 

 1U0/0
 tyyk1//5W11
s   <(E"%E"c                   V ^8  d   QhRR/# )r0   r3   zIterator[tuple[str, bytes]]r4   )r5   s   "r6   r7   r    s     9 9$? 9r9   c              #  	   "   V P                  4       w  rr4\        \        W#V4      R 4      pV R2V3x  \        RV RV R24      pRV P                   R2V3x  R# 5i)utf-8z.pyzimport z; z
.install()r  rA  N)r  bytes_finder_templaterB  rt   )rW   r  rt   r   r  contents   &     r6   get_implementation"_TopLevelFinder.get_implementation  sn     -1-?-?-A*g(DgN~w''xr&DEtyyk.88s   AAc               $    V ^8  d   QhRRRRRR/# r9  r4   )r5   s   "r6   r7   r  $  s"     * *i *	 *DU *r9   c                	Z    V P                  4        F  w  rEVP                  WE4       K  	  R # rR   )r  rC  )rW   r   r   r   rb  r  s   &&&&  r6   r!  _TopLevelFinder.__call__$  s#    !446MDNN4) 7r9   c                   V ^8  d   QhRR/# r$  r4   )r5   s   "r6   r7   r  (  r  r9   c                	J    R p\         P                  V\        ,           4       V # )z=Editable install will be performed using a meta path finder.
)r   rK  rL  rM  s   & r6   r&  _TopLevelFinder.__enter__(  s    N../r9   c               (    V ^8  d   QhRRRRRRRR/# rQ  r4   )r5   s   "r6   r7   r  -  s2     
< 
<
< 
< 	
<
 

<r9   c                	8    R p\         P                  ! RV4       R# )z

        Please be careful with folders in your working directory with the same
        name as your package as they may take precedence during imports.
        r  N)r   rA   r  s   &&&& r6   r.  _TopLevelFinder.__exit__-  s     	5s;r9   r  N)rF   rG   rH   rI   r6  r  r  r!  r&  r.  rM   r4   r9   r6   r  r    s%    269*

< 
<r9   r  c                    V ^8  d   QhRRRR/# )r0   r  r   r3   r  r4   )r5   s   "r6   r7   r7   :  s        r9   c                J   \         P                  ! 4       ;_uu_ 4       p\         P                  ! V\        P                  R7      pVP                  V 4       VP                  4        VP                  ^ 4       VP                  4       uuRRR4       #   + '       g   i     R# ; i)al  
Prior to Python 3.13 (see https://github.com/python/cpython/issues/77102),
.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 behavior 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)``
or ``locale.getencoding()``).
encodingN)	ioBytesIOTextIOWrapperr   PTH_ENCODINGwriteflushseekread)r  bufferwrappers   &  r6   rB  rB  :  s^     
""6E4F4FGgA{{} 
s   A(BB"	c                    V ^8  d   QhRRRR/# )r0   base_dirr   r3   boolr4   )r5   s   "r6   r7   r7   O  s       $ r9   c           	        \        \        V P                  4       4      R 7      ;_uu_ 4       p\        VR4      \        VR4      r2VP	                  RRR7       \        \        \        \        4      ;_uu_ 4        \        P                  ! W#4       VP                  4       '       d+   VP                  RR7      R8X  d    RRR4       RRR4       R# RRR4        \        P                  ! W#4        RRR4       R	#   + '       g   i     L2; i  \         d   pRp\        T4      ThRp?ii ; i  + '       g   i     R# ; i)
)dirz	file1.txtz	file2.txtfile1r  r  NTzFile system does not seem to support either symlinks or hard links. Strict editable installs require one of them to be supported.F)r   r   r   r   
write_textr   AttributeErrorNotImplementedErrorOSErrorrb   symlink
is_symlink	read_textrq  rs   LinksNotSupported)r  r   path1path2rw   rN  s   &     r6   r  r  O  s    	H$4$4$6 7	8	8CC-tC/Eu73n&97CCJJu$!!eoowo&G7&R D 
9	8 D
	1GGE! ! 
9	8 DC  	1P  $C(b0	1 
9	8	8sO   AD-8AC9	=D-D-D.D-9D	D-D*D%%D**D--D>	c               (    V ^8  d   QhRRRRRRRR/# )	r0   r  Iterable[str]rd   dict[str, str]rU   r   r3   r  r4   )r5   s   "r6   r7   r7   c  s,     & &&*8&GN&	&r9   c           	       a V  Uu/ uF  q3\        W1V4      bK  	  ppV'       g   \        V4      / R039   # \        P                  P	                  \        \        VP                  4       4      4      o\        ;QJ d-    V3R lVP                  4        4       F  '       d   K   R# 	  R# ! V3R lVP                  4        4       4      # u upi )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
rP   c           	   3     <"   T F8  w  r\         P                  ! \        S.VP                  R 4      O5!  V4      x  K:  	  R# 5ir   N)r   	same_pathr   split)r=  keyvaluer   s   &  r6   r?  !_simple_layout.<locals>.<genexpr>  s:      (JC 	V5ciin5u==(s   A AFT)	r   r  rb   re   
commonpathr
   _parent_pathr  all)r  rd   rU   r  layoutr   s   &&&  @r6   r  r  c  s    > PXXx$S{CCxFX;B:--WWflln EFF3  ,,.33 3 3  ,,.  	 Ys   Cc                    VP                  V 4      '       d   VR\        V 4      )  MTpVP                  R\        P                  ,           4      # )a  Infer 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'
Nrd  )r   lenrstriprb   rh  )r  pkg_pathr   s   && r6   r  r    s?     '/&7&7&<&<XkS	"(F==rvv&&r9   c                    V ^8  d   QhRRRR/# r0   r_   r   r3   Iterator[str]r4   )r5   s   "r6   r7   r7     s       - r9   c              #    "   \        V P                  ;'       g    . 4       R j  xL
  V P                  ;'       g    . pV Uu. uF  pRV9   g   K  VNK  	  ppV P                  '       d   V P                  x  MKV P                  ;'       g    . pY4 Uu. uF"  pRVP
                  9   g   K  VP
                  NK$  	  up,          pV F  pVP                  R4      w  p pVx  K  	  R #  Lu upi u upi 5i)Nr   )iterr  
py_modulesext_packageext_modulesrt   
rpartition)	r_   r  modnested_modulesr  xmodulepackage_s	   &        r6   r
  r
    s     DMM''R(((&&BJ%/>Zc3#:ccZN>&&,,";H;a#-6166;HH ))#.A ! ) ?
 IsD   #C6C*C6C6	C,C,5C6C6C1-C1=.C6,
C6c                    V ^8  d   QhRRRR/# r  r4   )r5   s   "r6   r7   r7     s     F F, F= Fr9   c              #     "   V P                   ;'       g    . pR  V 4        Rj  xL
  V P                  '       g*   V P                  ;'       g    . pR V 4        Rj  xL
  R# R#  LA L
5i)c              3  8   "   T F  pR V9  g   K  Vx  K  	  R# 5ir  r4   )r=  r  s   & r6   r?  *_find_top_level_modules.<locals>.<genexpr>  s     <zS^zs   	
Nc              3  `   "   T F$  pR VP                   9  g   K  VP                   x  K&  	  R# 5ir  )rt   )r=  r  s   & r6   r?  r    s!     EKq3aff3DFAFFKs   ..)r  r  r  )r_   r  r  s   &  r6   r  r    sa     &&BJ<z<<<&&,,"EKEEE  = 	Fs,   #A+A'A+A+A+A)	A+)A+c               (    V ^8  d   QhRRRRRRRR/# )	r0   r  r  rd   r  ra   r   r3   r  r4   )r5   s   "r6   r7   r7     s0     
% 
%
%"
% 
% 	
%r9   c                ~    \        V 4       Uu/ uF  pV\        \        W1V4      4      bK  	  pp\        V4      # u upi rR   )sorted_absolute_rootr   _remove_nested)r  rd   ra   r  	pkg_rootss   &&&  r6   r  r    sM     (#!#C 	^-cIJJ#  !
 )$$!s   :c                    V ^8  d   QhRRRR/# )r0   re   r   r3   r   r4   )r5   s   "r6   r7   r7     s     2 2 2S 2r9   c                    \        V 4      pVP                  pVP                  4       '       d   \        VP	                  4       4      # \        VP	                  4       VP
                  ,          4      # )z(Works for packages and top-level modules)r   r   r   r   r   rt   )re   path_r   s   &  r6   r  r    sK    JE\\F||~~5==?##6>>#ejj011r9   c                    V ^8  d   QhRRRR/# )r0   r  r  r3   r  r4   )r5   s   "r6   r7   r7     s     # # #= #r9   c           	   #  2  "   V  F  pRV9  d   K  VP                  R4      p\        \        V4      ^,
          ^ R4       FN  pRP                  VRV 4      p\	        \        W@R4      4      pVP                  4       '       d	   W@9  g   KJ  Vx  KP  	  K  	  R# 5i)a  By 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   NrP   )r  ranger  rf   r   r   r   )r  r  partsipartial_namere   s   &     r6   r  r    s      c>		#s5zA~q"-A88E"1I.L),2FGD;;==L$A"" .	 s   BB	Bc               $    V ^8  d   QhRRRRRR/# )r0   r  r  r  r  r3   zIterator[tuple[str, list[str]]]r4   )r5   s   "r6   r7   r7     s$         $2 $ r9   c              #     "   V  FX  p\        W!R 4      p\        V4      P                  4       '       g   K0  \        VR4      P                  4       '       d   KR  W#.3x  KZ  	  R# 5i)rP   z__init__.pyN)r   r   r   )r  r  r  re   s   &&  r6   r  r    sO       4:tD-'@'G'G'I'I- s   .A#A#A#c                    V ^8  d   QhRRRR/# )r0   r  r  r3   r4   )r5   s   "r6   r7   r7     s     
 
n 
 
r9   c                v  aa \        V P                  4       4      p\        \        V P	                  4       4      4       Fw  w  oo\
        ;QJ d.    VV3R  lV P	                  4        4       F  '       g   K   RM#	  RM! VV3R  lV P	                  4        4       4      '       g   Kf  VP                  S4       Ky  	  V# )c              3  \   <"   T F!  w  rSV8g  ;'       d    \        SSW4      x  K#  	  R # 5irR   )
_is_nested)r=  other
other_pathre   r  s   &  r6   r?  !_remove_nested.<locals>.<genexpr>  s3      
%6! 5LEEZT5EE%6s   ,,TF)r  copyreversedrI  r  anypop)r  r  re   r  s   & @@r6   r  r    s    ).."#Fd9??#456	T3 
%.__%6
333 
%.__%6
 
 
 JJsO 7 Mr9   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )r0   r  r   r  r   parent_pathr3   r  r4   )r5   s   "r6   r7   r7     s/      C 3  # $ r9   c                
   \         P                  ! V4      pV P                  VR^4      P                  R4      P	                  R4      pV P                  V4      ;'       d%    V\         P                  ! \        V.VO5!  4      8H  # )au  
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
rP   r   )r   normpathrg  stripr  
startswithr   )r  r  r   r!  norm_pkg_pathrests   &&&&  r6   r  r    st     NN8,M;;vr1%++C066s;D>>&!  mu~~[ 4 8 ' r9   c                    V ^8  d   QhRRRR/# )r0   dir_r(   r3   r4   )r5   s   "r6   r7   r7     s      R B r9   c                b    \         P                  ! V RR7       \        P                  ! V 4       V # )zFCreate a directory ensured to be empty. Existing files may be removed.T)ignore_errors)r   rmtreerb   makedirs)r)  s   &r6   r  r    s!    NN4t,KKKr9   c                  .    ] tR tRtR R ltR tR tRtR# )r   i  c                   V ^8  d   QhRR/# r[   r4   )r5   s   "r6   r7    _NamespaceInstaller.__annotate__  s      SW r9   c                	R    Wn         W@n        W n        W0n        . V n        R V n        R# )FN)r`   ra   r   editable_namer  dry_run)rW   r`   r   r2  ra   s   &&&&&r6   r6  _NamespaceInstaller.__init__  s'    (  0*"$r9   c                    \         P                  P                  V P                  V P                  V P
                  ,           4      # )zInstallation target.)rb   re   rf   r   r2  	nspkg_extrV   s   &r6   _get_nspkg_file#_NamespaceInstaller._get_nspkg_file  s,    ww||D1143E3E3VWWr9   c                >    \        \        V P                  4      4      # )z1Where the modules/packages should be loaded from.)reprr   ra   rV   s   &r6   	_get_root_NamespaceInstaller._get_root#  s    C&''r9   )r`   r3  r2  r   r  ra   N)rF   rG   rH   rI   r6  r7  r;  rM   r4   r9   r6   r   r     s    X(r9   r   a  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
c               (    V ^8  d   QhRRRRRRRR/# )r0   rt   r   r   r  r   zdict[str, list[str]]r3   r4   )r5   s   "r6   r7   r7     s2     V V
V)V7KVVr9   c                z    \        \        VP                  4       R R7      4      p\        P	                  WVR7      # )zWCreate a string containing the code for the``MetaPathFinder`` and
``PathEntryFinder``.
c                    V ^ ,          # )r   r4   )r>  s   &r6   <lambda>"_finder_template.<locals>.<lambda>  s    1r9   )r  rt   r   r   )r  r  r  _FINDER_TEMPLATEr5   rB  s   &&&r6   r  r    s1     6'--/~>?G""*"UUr9   c                      ] tR tRtRtRtR# )r  i  zCFile system does not seem to support either symlinks or hard links.r4   N)rF   rG   rH   rI   rJ   rM   r4   r9   r6   r  r    s    Mr9   r  )arJ   
__future__r   r  loggingrb   r   r   collections.abcr   r   r   
contextlibr   enumr   inspectr   	itertoolsr	   r
   pathlibr   tempfiler   typesr   typingr   r   r   r   rP   r   r   r   r   r   r   r   r.   r   r   	discoveryr   r_   r   warningsr   r   r   r   r    r   r!   r}   r"   r   r#   r   r$   r   typing_extensionsr%   _vendor.wheel.wheelfiler'   r(   	getLoggerrF   r   r+   r  rL  rO   r  r  r	  r  rB  r  r  r  r
  r  r  r  r  r  r  r  r  	Installerr   rC  r  	FileErrorr  r4   r9   r6   <module>rW     s_  
 # 	  	   7 7    $  '  9 9 J J  ! )  D % . 1 . + C&3T!


H
%&$D &$R \8W \8~
x 
 8I<
 I<X<< <<~*(&R' F
%2#0 
,(*.. ($V rVN(( Nr9   