a
´iX ã @ s” d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z d dl
mZmZ d dlm
Z
d dlZe d¡ZG d d
„ d
eƒZG dd„ deeƒZdS )
é N)ÚST_MODE)Ú sysconfig)ÚCommand)Únewer)Úconvert_pathÚ Mixin2to3)Úlogs ^#!.*python[0-9.]*([ ].*)?$c @ sF e Zd ZdZg d¢ZdgZdd„ Zdd„ Zdd „ Zd
d„ Z dd
„ Z
dS )Ú
build_scriptsz("build" scripts (copy and fixup #! line)))z
build-dir=Údzdirectory to "build" (copy) to)ÚforceÚfz1forcibly build everything (ignore file timestamps)zexecutable=Úez*specify final destination interpreter pathr c C s" d | _ d | _d | _d | _d | _d S ©N)Ú build_dirÚscriptsr Ú
executableÚoutfiles©Úself© r ú7/usr/lib64/python3.9/distutils/command/build_scripts.pyÚinitialize_options s
z build_scripts.initialize_optionsc C s | dddd¡ | jj| _d S )NZbuild)r r )r r )r r )Zset_undefined_optionsZdistributionr r r r r Úfinalize_options% s ýzbuild_scripts.finalize_optionsc C s | j S r )r r r r r Úget_source_files, s zbuild_scripts.get_source_filesc C s | j s
d S | ¡ d S r )r Úcopy_scriptsr r r r Úrun/ s zbuild_scripts.runc C sÄ | | j¡ g }g }| jD �],}d}t|ƒ}tj | jtj |¡¡}| |¡ | j slt
||ƒslt d|¡ qzt
|dƒ}W n ty˜ | js�‚ d }Y nX0 t |j¡\}}| d¡ | ¡ } | sÐ| d| ¡ qt | ¡}
|
rðd}|
d¡pîd}|�r$t d || j¡ | |¡ | j�stj�s(| j}n(tj t d
¡dt d¡t d
¡f ¡}t |¡}d| | d }
z|
d¡ W n" t�yš t d !|
¡ƒ‚Y n0 z|
|¡ W n$ t�yÎ t d !|
|¡ƒ‚Y n0 t
|dƒ�(}| "|
¡ | #| $¡ ¡ W d ƒ n1 �s
0 Y |�rH| %¡ q|�r2| %¡ | |¡ | &||¡ qtj'dk�r¼|D ]`}| j�rtt d|¡ nDt (|¡t) d@ }|dB d@ }||k�rZt d|||¡ t *||¡ �qZ||fS )NFznot copying %s (up-to-date)Úrbr z%s is an empty file (skipping)Té ó zcopying and adjusting %s -> %sZBINDIRz
python%s%sÚVERSIONZEXEs #!ó
zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})ÚwbÚposixzchanging mode of %siÿ im z!changing mode of %s from %o to %o)+Zmkpathr r r ÚosÚpathÚjoinÚbasenameÚappendr r r ÚdebugÚopenÚOSErrorÚdry_runÚtokenizeÚdetect_encodingÚreadlineÚseekÚwarnÚ
first_line_reÚmatchÚgroupÚinfor Zpython_buildr Zget_config_varÚfsencodeÚdecodeÚUnicodeDecodeErrorÚ
ValueErrorÚformatÚwriteÚ
writelinesÚ readlinesÚcloseZ copy_fileÚnameÚstatr Úchmod)r r Ú
updated_filesZscriptZadjustZoutfiler ÚencodingÚlinesZ
first_liner2 Zpost_interpr ZshebangZoutfÚfileZoldmodeZnewmoder r r r 5 s
ÿ
ÿþ
ÿÿ
þÿ
.
ÿzbuild_scripts.copy_scriptsN)Ú__name__Ú
__module__Ú__qualname__ÚdescriptionZuser_optionsZboolean_optionsr r r r r r r r r r s r c @ s e Zd Zdd„ ZdS )Úbuild_scripts_2to3c C s&