Ë
    ¨Õ°jÏ  ã                   ó¨   — d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ  ej                   d
«      Z	 eZ G d„ de«      Zy)zRdistutils.command.build_scripts

Implements the Distutils 'build_scripts' command.é    N)Úlog)ÚST_MODE)ÚClassVaré   )Únewer)ÚCommand)Úconvert_pathz^#!.*python[0-9.]*([ 	].*)?$c                   ó˜   — e Zd ZU dZg d¢Zeeeeeef         e	d<   dgZ
eee      e	d<   d„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zed„ «       Zy)Úbuild_scriptsz("build" scripts (copy and fixup #! line)))z
build-dir=Údzdirectory to "build" (copy) to)ÚforceÚfz1forcibly build everything (ignore file timestamps)zexecutable=Úez*specify final destination interpreter pathÚuser_optionsr   Úboolean_optionsc                 ó<   — d | _         d | _        d | _        d | _        y ©N)Ú	build_dirÚscriptsr   Ú
executable©Úselfs    úa/var/www/mission/venv/lib/python3.12/site-packages/setuptools/_distutils/command/build_scripts.pyÚinitialize_optionsz build_scripts.initialize_options$   s   € ØˆŒØˆŒØˆŒ
Øˆ�ó    c                 ób   — | j                  dddd«       | j                  j                  | _        y )NÚbuild)r   r   )r   r   )r   r   )Úset_undefined_optionsÚdistributionr   r   s    r   Úfinalize_optionszbuild_scripts.finalize_options*   s1   € Ø×"Ñ"ØØ*ØØ(ô		
ð ×(Ñ(×0Ñ0ˆ�r   c                 ó   — | j                   S r   )r   r   s    r   Úget_source_fileszbuild_scripts.get_source_files3   s   € Ø�|‰|Ðr   c                 ó>   — | j                   sy | j                  «        y r   )r   Úcopy_scriptsr   s    r   Úrunzbuild_scripts.run6   s   € Ø�|Š|ØØ×ÑÕr   c                 ó²   — | j                  | j                  «       g }g }| j                  D ]  }| j                  |||«       Œ | j	                  |«       ||fS )a2  
        Copy each script listed in ``self.scripts``.

        If a script is marked as a Python script (first line matches
        'shebang_pattern', i.e. starts with ``#!`` and contains
        "python"), then adjust in the copy the first line to refer to
        the current Python interpreter.
        )Úmkpathr   r   Ú_copy_scriptÚ_change_modes)r   ÚoutfilesÚupdated_filesÚscripts       r   r$   zbuild_scripts.copy_scripts;   s^   € ð 	�‰�D—N‘NÔ#ØˆØˆØ—l‘lò 	?ˆFØ×Ñ˜f h°Õ>ð	?ð 	×Ñ˜8Ô$à˜Ð&Ð&r   c                 óÞ  — d }t        |«      }t        j                  j                  | j                  t        j                  j                  |«      «      }|j                  |«       | j                  s#t        ||«      st        j                  d|«       y t        j                  |«      5 }|j                  «       }|s| j                  |› d�«       	 d d d «       y t        j!                  |«      }|j                  |«       |r¹t        j"                  d|| j                  «       |j%                  d«      xs d}d| j&                  z   |z   dz   }	| j)                  |	|j*                  «       t        |d|j*                  ¬	«      5 }
|
j-                  |	«       |
j/                  |j1                  «       «       d d d «       n| j3                  ||«       d d d «       y # 1 sw Y   ŒxY w# 1 sw Y   y xY w)
Nznot copying %s (up-to-date)z is an empty file (skipping)zcopying and adjusting %s -> %sé   Ú z#!ú
Úw)Úencoding)r	   ÚosÚpathÚjoinr   ÚbasenameÚappendr   r   r   ÚdebugÚtokenizeÚopenÚreadlineÚwarnÚshebang_patternÚmatchÚinfoÚgroupr   Ú_validate_shebangr2   ÚwriteÚ
writelinesÚ	readlinesÚ	copy_file)r   r,   r*   r+   Úshebang_matchÚoutfiler   Ú
first_lineÚpost_interpÚshebangÚoutfs              r   r(   zbuild_scripts._copy_scriptN   s’  € ØˆÜ˜fÓ%ˆÜ—'‘'—,‘,˜tŸ~™~¬r¯w©w×/?Ñ/?ÀÓ/GÓHˆØ�‰˜Ô à�zŠz¤%¨°Ô"8Ü�I‰IÐ3°VÔ<Øô �]‰]˜6Ó"ð 	0 aØŸ™›ˆJÙØ—	‘	˜V˜HÐ$@ÐAÔBØ÷		0ð 	0ô ,×1Ñ1°*Ó=ˆMà× Ñ  Ô)ÙÜ—‘Ð9¸6À4Ç>Á>ÔRØ+×1Ñ1°!Ó4Ò:¸�Ø §¡Ñ0°;Ñ>ÀÑE�Ø×&Ñ& w°·
±
Ô;Ü˜' 3°·±Ô<ð 3ÀØ—J‘J˜wÔ'Ø—O‘O A§K¡K£MÔ2÷3ð 3ð —‘˜v wÔ/÷%	0ð 	0÷3ð 3ú÷	0ð 	0ús+   Â*(G#ÃB'G#Æ1GÆ3G#ÇG 	ÇG#Ç#G,c                 ó\   — t         j                  dk7  ry |D ]  }| j                  |«       Œ y )NÚposix)r3   ÚnameÚ_change_mode)r   r*   Úfiles      r   r)   zbuild_scripts._change_modesn   s.   € Ü�7‰7�gÒØàò 	$ˆDØ×Ñ˜dÕ#ñ	$r   c                 óº   — t        j                  |«      t           dz  }|dz  dz  }||k7  r/t        j                  d|||«       t        j
                  ||«       y y )Niÿ  im  z!changing mode of %s from %o to %o)r3   Ústatr   r   r?   Úchmod)r   rP   ÚoldmodeÚnewmodes       r   rO   zbuild_scripts._change_modeu   sU   € Ü—'‘'˜$“-¤Ñ(¨6Ñ1ˆØ˜U‘? fÑ,ˆØ�gÒÜ�H‰HÐ8¸$ÀÈÔQÜ�H‰H�T˜7Õ#ð r   c                 óÂ   — 	 | j                  d«       	 | j                  |«       y # t        $ r t        d| ›d�«      ‚w xY w# t        $ r t        d| ›d|› d�«      ‚w xY w)Nzutf-8zThe shebang (z) is not encodable to utf-8z+) is not encodable to the script encoding (ú))ÚencodeÚUnicodeEncodeErrorÚ
ValueError)rJ   r2   s     r   rA   zbuild_scripts._validate_shebang|   s‚   € ð	UØ�N‰N˜7Ô#ð	Ø�N‰N˜8Õ$øô "ò 	UÜ˜}¨W¨KÐ7RÐSÓTÐTð	Uûô "ò 	ÜØ ˜{ð ++Ø+3¨*°Að7óð ð	ús   ‚& ”A ¦?ÁAN)Ú__name__Ú
__module__Ú__qualname__Údescriptionr   r   ÚlistÚtupleÚstrÚ__annotations__r   r   r    r"   r%   r$   r(   r)   rO   ÚstaticmethodrA   © r   r   r   r      s~   … Ø>€Kò:€L�(˜4  c¨3° mÑ 4Ñ5Ñ6ó ð -4¨9€O�X˜d 3™iÑ(Ó4òò1òòò
'ò&0ò@$ò$ð ñó ñr   r   )Ú__doc__r3   Úrer9   Údistutils._logr   rR   r   Útypingr   Ú	_modifiedr   Úcorer   Úutilr	   Úcompiler=   Úfirst_line_rer   rd   r   r   ú<module>rn      sR   ðñ5ó 
Û 	Û Ý Ý Ý å Ý Ý à�"—*‘*Ð<Ó=€ðð
  €ôx�Gõ xr   