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

Implements the Distutils 'build_scripts' command.é    N)ÚST_MODE)Ú	sysconfigé   )ÚCommand)Únewer)Úconvert_path)Úlogz^#!.*python[0-9.]*([ 	].*)?$c                   óf   — e Zd ZdZg d¢ZdgZd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Ze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                 ó>   — d | _         d | _        d | _        d | _        d S ©N)Ú	build_dirÚscriptsr   Ú
executable©Úselfs    úx/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/setuptools/_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*   s9   € Ø×"Ò"ØØ*ØØ(ñ		
ô 	
ð 	
ð Ô(Ô0ˆŒˆˆr   c                 ó   — | j         S r   )r   r   s    r   Úget_source_fileszbuild_scripts.get_source_files3   s
   € ØŒ|Ðr   c                 ó@   — | j         sd S |                      ¦   «          d S r   )r   Úcopy_scriptsr   s    r   Úrunzbuild_scripts.run6   s)   € ØŒ|ð 	ØˆFØ×ÒÑÔÐÐÐr   c                 ó²   — |                       | j        ¦  «         g }g }| j        D ]}|                      |||¦  «         Œ|                      |¦  «         ||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;   sm   € ð 	�Š�D”NÑ#Ô#Ð#ØˆØˆØ”lð 	?ð 	?ˆFØ×Ò˜f h°Ñ>Ô>Ð>Ð>à×Ò˜8Ñ$Ô$Ð$à˜Ð&Ð&r   c                 óV  — d }t          |¦  «        }t          j                             | j        t          j                             |¦  «        ¦  «        }|                     |¦  «         | j        s't          ||¦  «        st          j
        d|¦  «         d S 	 t          j        |¦  «        }|                     ¦   «         }|s|                      d|z  ¦  «         d S t                               |¦  «        }n# t"          $ r | j        s‚ d }Y nw xY w|                     |¦  «         |�rTt          j        d|| j        ¦  «         | j        �st(          j        s| j        }n[t          j                             t)          j        d¦  «        dt)          j        d¦  «        ›t)          j        d¦  «        ›�¦  «        }|                     d¦  «        pd	}	d
|z   |	z   dz   }
|                      |
|j        ¦  «         t          |d|j        ¬¦  «        5 }|                     |
¦  «         |                     |                     ¦   «         ¦  «         d d d ¦  «         n# 1 swxY w Y   |r|                     ¦   «          d S d S |r|                     ¦   «          |                      ||¦  «         d S )Nznot copying %s (up-to-date)z%s is an empty file (skipping)zcopying and adjusting %s -> %sÚBINDIRÚpythonÚVERSIONÚEXEé   Ú z#!ú
Úw)Úencoding) r   ÚosÚpathÚjoinr   ÚbasenameÚappendr   r   r	   ÚdebugÚtokenizeÚopenÚreadlineÚwarnÚshebang_patternÚmatchÚOSErrorÚdry_runÚinfor   Úpython_buildr   Úget_config_varÚgroupÚ_validate_shebangr4   ÚwriteÚ
writelinesÚ	readlinesÚcloseÚ	copy_file)r   r*   r(   r)   Úshebang_matchÚoutfiler   Ú
first_liner   Úpost_interpÚshebangÚoutfs               r   r&   zbuild_scripts._copy_scriptN   sã  € ØˆÝ˜fÑ%Ô%ˆÝ”'—,’,˜tœ~­r¬w×/?Ò/?ÀÑ/GÔ/GÑHÔHˆØ�Š˜Ñ Ô Ð àŒzð 	¥%¨°Ñ"8Ô"8ð 	ÝŒIÐ3°VÑ<Ô<Ð<ØˆFð	>Ý”˜fÑ%Ô%ˆAð Ÿš™œˆJØð Ø—	’	Ð:¸VÑCÑDÔDÐDØ�å+×1Ò1°*Ñ=Ô=ˆMˆMøõ ð 	ð 	ð 	Ø”<ð ØØˆAˆAˆAð	øøøð 	×Ò˜WÑ%Ô%Ð%Øñ 	,ÝŒHÐ5°v¸t¼~ÑNÔNÐNØ”<ñ 3Ý Ô-ð 
Ø!%¤�J�Jå!#¤§¢Ý!Ô0°Ñ:Ô:Ð:õ &Ô4°YÑ?Ô?Ð?Ý%Ô4°UÑ;Ô;Ð;ðñ"ô "�Jð ,×1Ò1°!Ñ4Ô4Ð:¸�Ø Ñ+¨kÑ9¸DÑ@�Ø×&Ò& w°´
Ñ;Ô;Ð;Ý˜' 3°´Ð<Ñ<Ô<ð 3ÀØ—J’J˜wÑ'Ô'Ð'Ø—O’O A§K¢K¡M¤MÑ2Ô2Ð2ð3ð 3ð 3ñ 3ô 3ð 3ð 3ð 3ð 3ð 3ð 3øøøð 3ð 3ð 3ð 3ð ð Ø—’‘	”	�	�	�	ðð ð ð Ø—’‘	”	�	Ø�NŠN˜6 7Ñ+Ô+Ð+Ð+Ð+s$   ÂC7 Ã7DÄDÈ=IÉIÉIc                 ó^   — t           j        dk    rd S |D ]}|                      |¦  «         Œd S )NÚposix)r5   ÚnameÚ_change_mode)r   r(   Úfiles      r   r'   zbuild_scripts._change_modes„   sD   € ÝŒ7�gÒÐØˆFàð 	$ð 	$ˆDØ×Ò˜dÑ#Ô#Ð#Ð#ð	$ð 	$r   c                 óþ   — | j         rt          j        d|¦  «         d S t          j        |¦  «        t
                   dz  }|dz  dz  }||k    r.t          j        d|||¦  «         t          j        ||¦  «         d S d S )Nzchanging mode of %siÿ  im  z!changing mode of %s from %o to %o)rB   r	   rC   r5   Ústatr   Úchmod)r   rW   ÚoldmodeÚnewmodes       r   rV   zbuild_scripts._change_mode‹   s‹   € ØŒ<ð 	ÝŒHÐ*¨DÑ1Ô1Ð1ØˆFå”'˜$‘-”-¥Ô(¨6Ñ1ˆØ˜U‘? fÑ,ˆØ�gÒÐÝŒHÐ8¸$ÀÈÑQÔQÐQÝŒH�T˜7Ñ#Ô#Ð#Ð#Ð#ð Ðr   c                 ó"  — 	 |                       d¦  «         n0# t          $ r# t          d                     | ¦  «        ¦  «        ‚w xY w	 |                       |¦  «         d S # t          $ r$ t          d                     | |¦  «        ¦  «        ‚w xY w)Nzutf-8z,The shebang ({!r}) is not encodable to utf-8z?The shebang ({!r}) is not encodable to the script encoding ({}))ÚencodeÚUnicodeEncodeErrorÚ
ValueErrorÚformat)rQ   r4   s     r   rG   zbuild_scripts._validate_shebang–   s¸   € ð	Ø�NŠN˜7Ñ#Ô#Ð#Ð#øÝ!ð 	ð 	ð 	ÝØA×HÒHÈÑQÔQñô ð ð	øøøð	Ø�NŠN˜8Ñ$Ô$Ð$Ð$Ð$øÝ!ð 	ð 	ð 	Ýð.ß.4ªf°W¸hÑ.GÔ.Gñô ð ð	øøøs   ‚ ˜-AÁ	A  Á .BN)Ú__name__Ú
__module__Ú__qualname__ÚdescriptionÚuser_optionsÚboolean_optionsr   r   r    r#   r"   r&   r'   rV   ÚstaticmethodrG   © r   r   r   r      sÇ   € € € € € à>€Kðð ð €Lð �i€Oðð ð ð1ð 1ð 1ðð ð ðð ð ð
'ð 'ð 'ð&4,ð 4,ð 4,ðl$ð $ð $ð	$ð 	$ð 	$ð ðð ñ „\ðð ð r   r   )Ú__doc__r5   ÚrerY   r   Ú	distutilsr   Úcorer   Údep_utilr   Úutilr   Údistutils._logr	   r;   Úcompiler?   Úfirst_line_rer   ri   r   r   ú<module>rs      sô   ðð5ð 5ð 
€	€	€	Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø €€€à�"”*Ð<Ñ=Ô=€ðð
  €ðUð Uð Uð Uð U�Gñ Uô Uð Uð Uð Ur   