+
    )jJ5                        R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^RIHt ^RIHtHt ^RIHtHtHt ]
! ]4      t ! R	 R
]4      t ! R R]4      tRR/R ltR# ) )annotationsN)sha1)	getLogger)Path)data)UnixLex
logged_run)MenuMenuItemmenuitem_defaultsc                  \   a  ] tR t^tR R ltR R lt]R V 3R ll4       tR R ltR	t	V ;t
# )
	MacOSMenuc                   V ^8  d   QhRR/#    returnztuple[os.PathLike] )formats   "6lib/python3.14/site-packages/menuinst/platforms/osx.py__annotate__MacOSMenu.__annotate__         *     c                	"    V P                  4       # N_pathsselfs   &r   createMacOSMenu.create       {{}r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      r   r   c                	"    V P                  4       # r   r   r   s   &r   removeMacOSMenu.remove   r"   r   c                   V ^8  d   QhRR/# )r   r   zdict[str, str]r   )r   s   "r   r   r      s     	 	n 	r   c                	   < \         SV `  pVP                  R \        V P	                  4       4      RRR\        V P
                  R,          R,          R,          R,          4      /4       V# )SP_DIRICON_EXTicns	PYTHONAPPz
python.appContentsMacOSpython)superplaceholdersupdatestr_site_packagesprefix)r   r1   	__class__s   & r   r1   MacOSMenu.placeholders   sc    w+#d1134FS|!;j!H7!RU]!]^	
 r   c                   V ^8  d   QhRR/# )r   r   tupler   )r   s   "r   r   r   '   s       r   c                	    R# )Nr   r   r   s   &r   r   MacOSMenu._paths'   s    	r   r   )__name__
__module____qualname____firstlineno__r    r%   propertyr1   r   __static_attributes____classcell__r6   s   @r   r   r      s+     	 	 r   r   c                  b  a  ] tR t^+t]R R l4       t]R R l4       t]R R l4       tR R ltV 3R	 lt	R
 R lt
R R ltR R ltR tR tR tR R ltR,R R lltR,R R lltR,R R lltR,R R lltR R ltR R  ltR! R" ltR-R# R$ lltR-R% R& lltR.R' ltR( t]R) R* l4       tR+tV ;t# )/MacOSMenuItemc                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   MacOSMenuItem.__annotate__-   s     J J$ Jr   c                R    V P                  4       R,          V P                  ,          # )z1Path to the .app directory defining the menu itemApplications)_base_location_bundle_namer   s   &r   locationMacOSMenuItem.location,   s#     ""$~58I8IIIr   c                   V ^8  d   QhRR/# r   r   r3   r   )r   s   "r   r   rH   2   s     : :c :r   c                	.    V P                  R / R7       R2# )name)extraz.app)
render_keyr   s   &r   rL   MacOSMenuItem._bundle_name1   s    //&/34D99r   c                   V ^8  d   QhRR/# rG   r   )r   s   "r   r   rH   6   s     L L$ Lr   c                X    V P                   R,          R,          V P                  ,          # )zAPath to the nested .app directory defining the menu item main appr-   	Resources)rM   rL   r   s   &r   _nested_locationMacOSMenuItem._nested_location5   s#     }}z)K7$:K:KKKr   c                   V ^8  d   QhRR/# rG   r   )r   s   "r   r   rH   :   s       r   c                	    V P                   P                  R 8X  d   \        R4      P                  4       # \        R4      # )user~/)menumoder   
expanduserr   s   &r   rK   MacOSMenuItem._base_location:   s/    99>>V#9''))Cyr   c                	  < \         SV `  4        V P                  R ,          ;'       g    / P                  4        F  w  rV P                  V P                  V4      ,          P                  4       pVP                  V P                  4      '       g   \        RV P                   RV R24      hVP                  P                  RRR7       \        P                  ! V P                  V4      V4       K  	  R# )link_in_bundlezF'link_in_bundle' destinations MUST be created inside the .app bundle (z), but it points to '.Tparentsexist_okN)r0   
_precreatemetadataitemsrM   renderresolveis_relative_to
ValueErrorparentmkdirossymlink)r   srcdestrendered_destr6   s   &   r   rj   MacOSMenuItem._precreate?   s    --(89??RFFHIC#'==4;;t3D#D"M"M"OM //>> //3}}o=RS`Raabd    &&td&CJJt{{3'7 Ir   c                   V ^8  d   QhRR/# r   r   ztuple[Path]r   )r   s   "r   r   rH   K   s          r   c                	2   V P                   P                  4       '       d   R V P                    R2p\        V4      h\        P	                  RV P                   4       V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                   3# )zApp already exists at z. Please remove the existing shortcut before installing. If you used conda to install this package, reinstall the package with --force-reinstall to create the shortcut once the location is cleared.zCreating %s)rM   existsRuntimeErrorlogdebug_create_application_treerj   
_copy_icon_write_pkginfo_write_plistinfo_write_appkit_launcher_write_launcher_write_script_write_event_handler#_maybe_register_with_launchservices_sign_with_entitlements)r   messages   & r   r    MacOSMenuItem.createK   s    ==!!( 8D D  w''		-/%%'##%!!#002$$&r   c                   V ^8  d   QhRR/# rz   r   )r   s   "r   r   rH   c   s       r   c                	   \         P                  R V P                  4       V P                  RR7       V P                  P	                  4       '       d0   \
        P                  ! V P                  RR7       V P                  3# \        4       # )zRemoving %sF)registerT)ignore_errors)r~   r   rM   r   r|   shutilrmtreer9   r   s   &r   r%   MacOSMenuItem.removec   s^    		-/00%0@==!!MM$--t<MM##wr   c                   V ^8  d   QhRR/# rz   r   )r   s   "r   r   rH   k   s      + r   c                	R   V P                   R ,          R,          V P                   R ,          R,          .pV P                  '       d<   VV P                  R ,          R,          V P                  R ,          R,          .,          pV F  pVP                  RRR7       K  	  \	        V4      # )r-   rX   r.   TFrg   )rM   _needs_appkit_launcherrY   rr   r9   )r   pathspaths   &  r   r   &MacOSMenuItem._create_application_treek   s    MMJ&4MMJ&0
 &&&%%
2[@%%
2W< E DJJteJ4 U|r   c                	   V P                  R 4      pV'       ds   \        P                  ! WP                  R,          R,          4       V P                  '       d1   \        P                  ! WP
                  R,          R,          4       R# R# R# )iconr-   rX   N)rT   r   copyrM   r   rY   )r   r   s   & r   r   MacOSMenuItem._copy_icony   s_    v&KKmmj8;FG***D"7"7*"D{"RS + r   c                	b   V P                   .pV P                  '       d   VP                  V P                  4       V FZ  p\	        VR ,          R,          R4      ;_uu_ 4       pVP                  RV P                  RRR7      R,           24       RRR4       K\  	  R#   + '       g   i     Kq  ; i)	r-   PkgInfowAPPLrR   Tslug:N   NN)rM   r   appendrY   openwriterT   )r   app_bundlesappfs   &   r   r   MacOSMenuItem._write_pkginfo   s    }}o&&&t445CcJ&2C88A$tvDA"EFGH 98 888s   "-BB.c                	   V P                  R 4      pV P                  R RR7      p\        V4      ^8  d>   VR,          \        VP                  4       4      P	                  4       R,          ,           pMTpRVRVRVRV R	2R
RV 2RRRRRR/pV P                  R4      pV'       d   \        V4      P                  VR&   V P                  '       dZ   \        V P                  R,          R,          R4      ;_uu_ 4       p\        P                  ! WF4       RRR4       RVR&   RV R2VR
&   . \        ORNRNRN5pV P                  P                  R4      ;'       g    / p\        R,          R,           FP  p	W9   d   K  W9   d   \        RV	 R24      hV P                  V	4      p
V
f   K7  V	R8X  d   WR&   V R V
 2VR&   WV	&   KR  	  VP!                  4        F  w  rV P#                  V
4      WI&   K  	  \        V P$                  R,          R,          R4      ;_uu_ 4       p\        P                  ! WF4       RRR4       R#   + '       g   i     EL4; i  + '       g   i     R# ; i)!rR   Tr   :N
   N:N   NCFBundleNameCFBundleDisplayNameCFBundleExecutableCFBundleGetInfoStringz-1.0.0CFBundleIdentifiercom.CFBundlePackageTyper   CFBundleVersionz1.0.0CFBundleShortVersionStringr   CFBundleIconFiler-   z
Info.plistwbNLSBackgroundOnlyz-appkit-launcherentitlementsre   info_plist_extra	platformsosxz%Duplicate Info.plist property found: z.. Remove the property from `info_plist_extra`.-)rT   lenr   encode	hexdigestr   rR   r   r   rY   plistlibdumpr   rk   getrp   rl   rm   rM   )r   rR   slugname	shortnameplr   r   ignore_keysr   keyvalues   &          r   r   MacOSMenuItem._write_plistinfo   s\   v&??6?5x=2 X__->(?(I(I(KB(OOI II!4 (#z%8 D
"3!6w('	
 v&%)$Z__B!"&&&d++j8<GNNRSb$ O &*B!")-hZ7G'HB#$ a)`>`;K`M_`==,,-?@FFB$[1%88C!& ;C5 AC C  OOC(E}''38/019
!E7.C*+sG 9  +002JCkk%(BG 3$--*,|;TBBaMM"  CB7 ONN6 CBBs   ;H=I=I	I"	c                   V ^8  d   QhRR/# rP   r   )r   s   "r   r   rH      s     !  ! # ! r   c           	     	.   R .pV P                  R4      '       d   VP                  . RO4       V P                  R4      pV'       dO   \        \        P                  P                  V4      4      P                  RRR7       VP                  RV R24       V P                  R4      pV'       d   VP                  V4       V P                  R,          '       dl   V P                  P                  pV P                  P                  V4      '       d   R	pMR
pVP                  RV RV RV P                  P                   R24       VP                  RP                  \        P                  ! V P                  R4      4      4      4       RP                  V4      # )z	#!/bin/shterminalworking_dirTrg   zcd ""
precommandactivatezshell activatezshell.bash activatez	eval "$("z" z "z")" command
)z@if [ "${__CFBundleIdentifier:-}" != "com.apple.Terminal" ]; thenz#    open -b com.apple.terminal "$0"z    exit $?fi)rT   extendr   rs   r   
expandvarsrr   r   rk   r`   	conda_exe_is_micromambar5   joinr   
quote_args)r   linesr   r   r   r   s   &     r   _commandMacOSMenuItem._command   s8   ??:&& LL oom4##K0177t7TLL4}A./__\2
LL$==$$		++Iyy''	22+0LL9YKr(2dii>N>N=OsSTSXXg001KLMNyyr   c                    V ^8  d   QhRRRR/# r   launcher_pathos.PathLike | Noner   os.PathLiker   )r   s   "r   r   rH      s      4F R] r   c                	    Vf   V P                  4       p\        P                  ! V P                  4       V4       \        P
                  ! VR4       V# N  )_default_appkit_launcher_pathr   r   _find_appkit_launcherrs   chmodr   r   s   &&r   r   $MacOSMenuItem._write_appkit_launcher   sA      >>@MD..0-@
&r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rH      s      -? ; r   c                	    Vf   V P                  4       p\        P                  ! V P                  4       V4       \        P
                  ! VR4       V# r   )_default_launcher_pathr   r   _find_launcherrs   r   r   s   &&r   r   MacOSMenuItem._write_launcher   sA      779MD'')=9
&r   c                    V ^8  d   QhRRRR/# r   script_pathr   r   r   r   )r   s   "r   r   rH      s      ); { r   c                	    Vf   V P                  RR7      p\        VR4      ;_uu_ 4       pVP                  V P                  4       4       R R R 4       \        P
                  ! VR4       V#   + '       g   i     L); i)Nz-script)suffixr   r   )r   r   r   r   rs   r   )r   r   r   s   && r   r   MacOSMenuItem._write_script   s^    55Y5GK+s##qGGDMMO$ $
e$ $#s    A,,A<	c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rH      s      0B k r   c                	^   V P                   '       g   R # V P                  R4      pVf   R # Vf"   V P                  R,          R,          R,          p\        VR4      ;_uu_ 4       pVP	                  RV R24       R R R 4       \
        P                  ! VR4       V#   + '       g   i     L); i)	Nevent_handlerr-   rX   zhandle-eventr   z#!/bin/bash
r   r   )r   rT   rM   r   r   rs   r   )r   r   event_handler_logicr   s   &&  r   r   "MacOSMenuItem._write_event_handler   s    ***"ooo>&--*4{B^SK+s##qGGm$7#8;< $
e$ $#s   %BB,	c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rH     s        *  r   c                	    V P                   3# r   )rM   r   s   &r   r   MacOSMenuItem._paths  s    r   c                   V ^8  d   QhRR/# rG   r   )r   s   "r   r   rH     s     Y Yt Yr   c                	T   R \         P                  ! 4        2p\        P                   F\  p\	        V4      V,          pVP                  4       '       g   K-  \        P                  ! V\        P                  4      '       g   KZ  Vu # 	  \        R\         P                  ! 4        24      h)appkit_launcher_'Could not find executable launcher for 
platformmachine_menuinst_data__path__r   is_filers   accessX_OKrp   r   launcher_namedatapathr   s   &   r   r   #MacOSMenuItem._find_appkit_launcher  s~    *8+;+;+=*>?&//H N]:M$$&&299]BGG+L+L$$ 0 B8CSCSCUBVWXXr   c                   V ^8  d   QhRR/# rG   r   )r   s   "r   r   rH     s     Y Y Yr   c                	T   R \         P                  ! 4        2p\        P                   F\  p\	        V4      V,          pVP                  4       '       g   K-  \        P                  ! V\        P                  4      '       g   KZ  Vu # 	  \        R\         P                  ! 4        24      h)osx_launcher_r  r  r  s   &   r   r   MacOSMenuItem._find_launcher  s~    '(8(8(:';<&//H N]:M$$&&299]BGG+L+L$$ 0 B8CSCSCUBVWXXr   c                    V ^8  d   QhRRRR/# r   r   r3   r   r   r   )r   s   "r   r   rH     s     H HC H Hr   c                	r    V P                  R RR7      pV P                  R,          R,          V V 2,          # rR   Tr   r-   r.   )rT   rM   r   r   rR   s   && r   r   +MacOSMenuItem._default_appkit_launcher_path  s6    vD1}}z)G3vh6GGGr   c                    V ^8  d   QhRRRR/# r  r   )r   s   "r   r   rH     s     H HS H$ Hr   c                	    V P                  R RR7      pV P                  '       d&   V P                  R,          R,          V V 2,          # V P                  R,          R,          V V 2,          # r  )rT   r   rY   rM   r  s   && r   r   $MacOSMenuItem._default_launcher_path  sf    vD1&&&((:5?TF6(BSSS}}z)G3vh6GGGr   c                	    V P                   '       g   R # V'       d"   \        R\        V P                  4      4       R # \        RRR\        V P                  4      4       R # )Nz-Rz-uz-all)r   _lsregisterr3   rM   )r   r   s   &&r   r   1MacOSMenuItem._maybe_register_with_launchservices!  s>    ***c$--01dFC,>?r   c                   V P                  R4      pV'       g   R# V P                  RRR7      pV Uu/ uF  q3RbK  	  ppV P                  R,          R,          p\        VR4      ;_uu_ 4       p\        P                  ! WF4       RRR4       \        R	R
RRRRV 2RRRRRVV P                  .RR7       R# u upi   + '       g   i     L>; i)z1Self-sign shortcut to apply required entitlementsr   NrR   Tr   r-   zEntitlements.plistr   z/usr/bin/codesignz	--verbosez--signr   z--prefixr   z	--optionsruntimez--forcez--deepz--entitlements)check)rT   rM   r   r   r   r	   )r   entitlement_keysr   r   plistentitlements_pathr   s   &      r   r   %MacOSMenuItem._sign_with_entitlements*  s    ??>:??6?5&67&6sd&67 MMJ69MM#T**aMM%# + $xj! !  #	
	 8**s   B6.B;;C	c                   V ^8  d   QhRR/# )r   r   boolr   )r   s   "r   r   rH   I  s     8 8 8r   c                J    \        V P                  P                  R4      4      # )a  
In macOS, file type and URL protocol associations are handled by the
Apple Events system. When the user opens on a file or URL, the system
will send an Apple Event to the application that was registered as a handler.
Some apps might not have the needed listener to process the event. In that case,
we provide a generic one. This is decided by the presence of "event_handler".
If that key is absent or null, we assume the app has its own listener.

See:
- https://developer.apple.com/library/archive/documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/LSCConcepts.html
- The source code at /src/appkit-launcher in this repository
r   )r(  rk   r   r   s   &r   r   $MacOSMenuItem._needs_appkit_launcherH  s     DMM%%o677r   r   r   )r   )T)r<   r=   r>   r?   r@   rM   rL   rY   rK   rj   r    r%   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rA   rB   rC   s   @r   rE   rE   +   s    J J : : L L

8 0TI4!l! F YYHH@
< 8 8r   rE   r"  Tc                (    R p\        V.VO3RV /VB # )zh/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregisterr"  )r	   )r"  argskwargsexes   $*, r   r  r  Y  s*    	B  slTl:%:6::r   )__doc__
__future__r   rs   r  r   r   hashlibr   loggingr   pathlibr   r   r   r  utilsr   r	   baser
   r   r   r<   r~   r   rE   r  r   r   r   <module>r6     s]     " 	       % ' 3 3 .k8H k8\	;T ;r   