o !QdX@s ddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddlm Z ddlZedZGd d d eZGd d d ee ZdS) N)ST_MODE) sysconfig)Command)newer) convert_path Mixin2to3)logs^#!.*python[0-9.]*([ ].*)?$c@sFeZdZdZgdZdgZddZddZdd Zd d Z d d Z dS) build_scriptsz("build" scripts (copy and fixup #! line)))z build-dir=dzdirectory to "build" (copy) to)forcefz1forcibly build everything (ignore file timestamps)z executable=ez*specify final destination interpreter pathr cCs"d|_d|_d|_d|_d|_dSN) build_dirscriptsr executableoutfilesselfrF/opt/alt/python310/lib64/python3.10/distutils/command/build_scripts.pyinitialize_optionss  z build_scripts.initialize_optionscCs|dddd|jj|_dS)NZbuild)r r)r r )rr)Zset_undefined_optionsZ distributionrrrrrfinalize_options%s zbuild_scripts.finalize_optionscCs|jSr)rrrrrget_source_files,szbuild_scripts.get_source_filescCs|jsdS|dSr)r copy_scriptsrrrrrun/s zbuild_scripts.runc Cs ||jg}g}|jD]}d}t|}tj|jtj|}|||j s7t ||s7t d|qzt |d}WntyM|jsId}Yn,wt|j\}}|d|} | si|d|qt| } | ryd}| dpxd} |r t d ||j|||jstjs|j} ntjtd d td td f} t| } d| | d} z| dWntyt d!| wz| |Wntyt d!| |wt |d}|"| |#|$Wdn1swY|r |%q|r|%|||&||qtj'dkrX|D]1}|jr4t d|q&t(|t)d@}|dBd@}||krVt d|||t*||q&||fS)NFznot copying %s (up-to-date)rbrz%s is an empty file (skipping)Tzcopying and adjusting %s -> %sZBINDIRz python%s%sZVERSIONZEXEs#! zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})wbposixzchanging mode of %siimz!changing mode of %s from %o to %o)+Zmkpathrrrospathjoinbasenameappendr rrdebugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarn first_line_rematchgroupinforZ python_buildrZget_config_varfsencodedecodeUnicodeDecodeError ValueErrorformatwrite writelines readlinescloseZ copy_filenamestatrchmod)rr updated_filesZscriptZadjustZoutfiler encodinglinesZ first_liner1Z post_interprZshebangZoutffileZoldmodeZnewmoderrrr5s                   zbuild_scripts.copy_scriptsN) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrrrrrrrrr s r c@seZdZddZdS)build_scripts_2to3cCs&t|\}}|js||||fSr)r rr*Zrun_2to3)rrr@rrrrs zbuild_scripts_2to3.copy_scriptsN)rDrErFrrrrrrHs rH)r"rer>rZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr+compiler0r rHrrrrs