_idZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z dd l mZddlZej d Z eZGd d eZy) zRdistutils.command.build_scripts Implements the Distutils 'build_scripts' command.N)ST_MODE) sysconfig)Command)newer) convert_path)logz^#!.*python[0-9.]*([ ].*)?$c^eZdZdZgdZdgZdZdZdZdZ dZ d Z d Z d Z ed Zy ) 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 c<d|_d|_d|_d|_yN) build_dirscriptsr executableselfs /builddir/build/BUILDROOT/alt-python312-setuptools-69.0.2-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/setuptools/_distutils/command/build_scripts.pyinitialize_optionsz build_scripts.initialize_options#s  cb|jdddd|jj|_y)Nbuild)r r)r r )rr)set_undefined_options distributionrrs rfinalize_optionszbuild_scripts.finalize_options)s1 ""  *  (  ((00 rc|jSr)rrs rget_source_fileszbuild_scripts.get_source_files2s ||rc>|jsy|jyr)r copy_scriptsrs rrunzbuild_scripts.run5s||  rc|j|jg}g}|jD]}|j||||j |||fS)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. )mkpathrr _copy_script _change_modes)routfiles updated_filesscripts rr"zbuild_scripts.copy_scripts:sY DNN# llF   fh ># 8$&&rc*d}t|}tjj|jtjj |}|j ||js#t||stjd|y tj|}|j}|s|jd|zytj!|}|j ||rJtj&d||j|j$st(j*s |j,}n^tjjt)j.ddt)j.dt)j.d}|j1dxsd } d |z| zd z} |j3| |j4t|d |j4 5} | j7| | j9|j;ddd|r|j=yy|r|j=|j?||y#t"$r|j$sd}YwxYw#1swYaxYw)Nznot copying %s (up-to-date)z%s is an empty file (skipping)zcopying and adjusting %s -> %sBINDIRpythonVERSIONEXEz#! w)encoding) rospathjoinrbasenameappendr rr debugtokenizeopenreadlinewarnshebang_patternmatchOSErrordry_runinfor python_buildrget_config_vargroup_validate_shebangr4write writelines readlinesclose copy_file) rr*r(r) shebang_matchoutfiler first_liner post_interpshebangoutfs rr&zbuild_scripts._copy_scriptMs f%'',,t~~rww/?/?/GH zz%"8 II3V <  > f%A J :VCD+11*=MW%  HH5vt~~ N<< --!%J!#!00:&44Y?%44U;"J,11!4: +k9D@&&w ;'3<JJw'OOAKKM2=  NN67 +M <<A <=KL iO 1 '&4,l$ $rr )__doc__r5rerYr distutilsrcorer _modifiedrutilrdistutils._logr r;compiler? first_line_rer rirrrssR5 "**<=  TGTr