§
    ZQdX  ã                   óÈ   — d 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mZ ddlmZ ddlZ ej        d	¦  «        Z G d
„ de¦  «        Z G d„ dee¦  «        ZdS )zRdistutils.command.build_scripts

Implements the Distutils 'build_scripts' command.é    N)ÚST_MODE)Ú	sysconfig)ÚCommand)Únewer)Úconvert_pathÚ	Mixin2to3)Úlogs   ^#!.*python[0-9.]*([ 	].*)?$c                   ó>   — e Zd ZdZg d¢ZdgZd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
Ú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 pathr   c                 óL   — d | _         d | _        d | _        d | _        d | _        d S ©N)Ú	build_dirÚscriptsr   Ú
executableÚoutfiles©Úselfs    ú6/usr/lib/python3.11/distutils/command/build_scripts.pyÚinitialize_optionsz build_scripts.initialize_options   s)   € ØˆŒØˆŒØˆŒ
ØˆŒØˆŒˆˆó    c                 óX   — |                       dddd¦  «         | j        j        | _        d S )NÚbuild)r   r   )r   r   )r   r   )Úset_undefined_optionsÚdistributionr   r   s    r   Úfinalize_optionszbuild_scripts.finalize_options%   s;   € Ø×"Ò" 7Ø#AØ#5Ø#?ñ	Aô 	Að 	Að Ô(Ô0ˆŒˆˆr   c                 ó   — | j         S r   )r   r   s    r   Úget_source_fileszbuild_scripts.get_source_files,   s
   € ØŒ|Ðr   c                 ó@   — | j         sd S |                      ¦   «          d S r   )r   Úcopy_scriptsr   s    r   Úrunzbuild_scripts.run/   s)   € ØŒ|ð 	ØˆFØ×ÒÑÔÐÐÐr   c           	      óR  — |                       | j        ¦  «         g }g }| j        D �]o}d}t          |¦  «        }t          j                             | j        t          j                             |¦  «        ¦  «        }|                     |¦  «         | j	        s&t          ||¦  «        st          j        d|¦  «         Œ˜	 t          |d¦  «        }t          j        |j        ¦  «        \  }}|                     d¦  «         |                     ¦   «         }	|	s|                      d|z  ¦  «         �Œ
t&                               |	¦  «        }
|
rd}|
                     d¦  «        pd}n# t,          $ r | j        s‚ d	}Y nw xY w|�rÑt          j        d
|| j        ¦  «         |                     |¦  «         | j        �s�t2          j        s| j        }n[t          j                             t3          j        d¦  «        dt3          j        d¦  «        ›t3          j        d¦  «        ›�¦  «        }t	          j        |¦  «        }d|z   |z   dz   }	 |                     d¦  «         n0# t>          $ r# tA          d !                    |¦  «        ¦  «        ‚w xY w	 |                     |¦  «         n1# t>          $ r$ tA          d !                    ||¦  «        ¦  «        ‚w xY wt          |d¦  «        5 }| "                    |¦  «         | #                    | $                    ¦   «         ¦  «         d	d	d	¦  «         n# 1 swxY w Y   |r| %                    ¦   «          �Œ.|r| %                    ¦   «          |                     |¦  «         |  &                    ||¦  «         �Œqt          j'        dk    r~|D ]{}| j        rt          j        d|¦  «         Œt	          j(        |¦  «        tR                   dz  }|dz  dz  }||k    r,t          j        d|||¦  «         t	          j*        ||¦  «         Œ|||fS )a"  Copy each script listed in 'self.scripts'; if it's marked as a
        Python script in the Unix way (first line matches 'first_line_re',
        ie. starts with "\#!" and contains "python"), then adjust the first
        line to refer to the current Python interpreter as we copy.
        Fznot copying %s (up-to-date)Úrbr   z%s is an empty file (skipping)Té   r   Nzcopying and adjusting %s -> %sÚBINDIRÚpythonÚVERSIONÚEXEs   #!ó   
zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})ÚwbÚposixzchanging mode of %siÿ  im  z!changing mode of %s from %o to %o)+Úmkpathr   r   r   ÚosÚpathÚjoinÚbasenameÚappendr   r   r	   ÚdebugÚopenÚtokenizeÚdetect_encodingÚreadlineÚseekÚwarnÚfirst_line_reÚmatchÚgroupÚOSErrorÚdry_runÚinfor   Úpython_buildr   Úget_config_varÚfsencodeÚdecodeÚUnicodeDecodeErrorÚ
ValueErrorÚformatÚwriteÚ
writelinesÚ	readlinesÚcloseÚ	copy_fileÚnameÚstatr   Úchmod)r   r   Úupdated_filesÚscriptÚadjustÚoutfiler   ÚencodingÚlinesÚ
first_liner=   Úpost_interpr   ÚshebangÚoutfÚfileÚoldmodeÚnewmodes                     r   r#   zbuild_scripts.copy_scripts5   s–  € ð 	�Š�D”NÑ#Ô#Ð#ØˆØˆØ”lð L	0ñ L	0ˆFØˆFÝ! &Ñ)Ô)ˆFÝ”g—l’l 4¤>µ2´7×3CÒ3CÀFÑ3KÔ3KÑLÔLˆGØ�OŠO˜GÑ$Ô$Ð$à”:ð ¥e¨F°GÑ&<Ô&<ð Ý”	Ð7¸Ñ@Ô@Ð@Øð
8Ý˜ Ñ&Ô&�õ #+Ô":¸1¼:Ñ"FÔ"F‘�˜%Ø—’�q‘	”	�	ØŸZšZ™\œ\�
Ø!ð Ø—I’IÐ>ÀÑGÑHÔHÐHÙå%×+Ò+¨JÑ7Ô7�Øð 8Ø!�FØ"'§+¢+¨a¡.¤.Ð"7°C�Køøõ ð ð ð Ø”|ð ØØ���ðøøøð" ñ ,0Ý”Ð9¸6Øœñ)ô )ð )à×$Ò$ WÑ-Ô-Ð-Ø”|ñ !7Ý$Ô1ð MØ%)¤_˜
˜
å%'¤W§\¢\Ý%Ô4°XÑ>Ô>Ð>Ý+4Ô+CÀIÑ+NÔ+NÐ+NÝ+4Ô+CÀEÑ+JÔ+JÐ+JðLñ&Mô &M˜
õ "$¤¨ZÑ!8Ô!8�JØ# jÑ0°;Ñ>ÀÑF�Gð:ØŸš wÑ/Ô/Ð/Ð/øÝ-ð :ð :ð :Ý(ð)ß)/ª°©¬ñ:ô :ð :ð:øøøð8ØŸš xÑ0Ô0Ð0Ð0øÝ-ð 8ð 8ð 8Ý(ð<ç#šV G¨XÑ6Ô6ñ8ô 8ð 8ð8øøøõ
 ˜g tÑ,Ô,ð 7°ØŸ
š
 7Ñ+Ô+Ð+ØŸš¨¯ª©¬Ñ6Ô6Ð6ð7ð 7ð 7ñ 7ô 7ð 7ð 7ð 7ð 7ð 7ð 7øøøð 7ð 7ð 7ð 7ð ð Ø—G’G‘I”I�Iùàð Ø—G’G‘I”I�IØ×$Ò$ WÑ-Ô-Ð-Ø—’˜v wÑ/Ô/Ð/Ñ/åŒ7�gÒÐØ ð 	0ð 	0�Ø”<ð 0Ý”HÐ2°DÑ9Ô9Ð9Ð9å œg d™mœm­GÔ4°vÑ=�GØ&¨™°&Ñ8�GØ 'Ò)Ð)ÝœÐ!DØ!% w°ñ9ô 9ð 9åœ  wÑ/Ô/Ð/øà˜Ð&Ð&s<   Â?E&Å&E=Å<E=É
I É -JÊJ'Ê'.KË(=L1Ì1L5	Ì8L5	N)Ú__name__Ú
__module__Ú__qualname__ÚdescriptionÚuser_optionsÚboolean_optionsr   r   r!   r$   r#   © r   r   r   r      sƒ   € € € € € à>€Kð
ð 
ð 
€Lð �i€Oðð ð ð1ð 1ð 1ðð ð ðð ð ðc'ð c'ð c'ð c'ð c'r   r   c                   ó   — e Zd Zd„ ZdS )Úbuild_scripts_2to3c                 ó|   — t                                | ¦  «        \  }}| j        s|                      |¦  «         ||fS r   )r   r#   r@   Úrun_2to3)r   r   rQ   s      r   r#   zbuild_scripts_2to3.copy_scriptsœ   sA   € Ý"/×"<Ò"<¸TÑ"BÔ"BÑˆ�-ØŒ|ð 	)Ø�MŠM˜-Ñ(Ô(Ð(Ø˜Ð&Ð&r   N)r^   r_   r`   r#   rd   r   r   rf   rf   š   s#   € € € € € ð'ð 'ð 'ð 'ð 'r   rf   )Ú__doc__r0   ÚrerO   r   Ú	distutilsr   Údistutils.corer   Údistutils.dep_utilr   Údistutils.utilr   r   r	   r7   Úcompiler<   r   rf   rd   r   r   ú<module>rp      s  ðð5ð 5ð €€€€€€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "Ø $Ð $Ð $Ð $Ð $Ð $Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø Ð Ð Ð Ð Ð Ø €€€ð �”
Ð;Ñ<Ô<€ðG'ð G'ð G'ð G'ð G'�Gñ G'ô G'ð G'ðR'ð 'ð 'ð 'ð '˜¨	ñ 'ô 'ð 'ð 'ð 'r   