o 0iX @ s d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z d dl mZmZ d dlm Z d dlZedZG d d d eZG dd deeZdS ) N)ST_MODE) sysconfig)Command)newer)convert_path Mixin2to3)logs ^#!.*python[0-9.]*([ ].*)?$c @ sF e Zd ZdZg dZdgZdd Zdd Zdd Zd d Z dd Z dS ) build_scriptsz("build" scripts (copy and fixup #! line)))z build-dir=dzdirectory to "build" (copy) to)forcefz1forcibly build everything (ignore file timestamps)zexecutable=ez*specify final destination interpreter pathr c C s" d | _ d | _d | _d | _d | _d S N) build_dirscriptsr executableoutfilesself r F/opt/alt/python310/lib64/python3.10/distutils/command/build_scripts.pyinitialize_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 sd 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 s7t ||s7td| qzt |d}W n tyM | jsI d }Y n,w t|j\}}|d | } | si| d| qt| } | ryd}| dpxd}|rtd || j || | jstjs| j}ntjtd dtdtd f }t|}d| | d } z| d W n ty t d!| w z| | W n ty t d!| |w t |d}|"| |#|$ W d n1 sw Y |r |% q|r|% || | &|| qtj'dkrX|D ]1}| jr4td| q&t(|t) d@ }|dB d@ }||krVtd||| t*|| q&||fS )NFznot copying %s (up-to-date)rbr z%s is an empty file (skipping)T zcopying 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 %si im z!changing mode of %s from %o to %o)+Zmkpathr r r ospathjoinbasenameappendr r r debugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarn first_line_rematchgroupinfor Zpython_buildr Zget_config_varfsencodedecodeUnicodeDecodeError ValueErrorformatwrite writelines readlinescloseZ copy_filenamestatr chmod)r r updated_filesZscriptZadjustZoutfiler encodinglinesZ first_liner1 Zpost_interpr ZshebangZoutffileZoldmodeZnewmoder 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&