źhdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z dd l mZddlZejd Z eZGd d eZdS) zRdistutils.command.build_scripts Implements the Distutils 'build_scripts' command.N)ST_MODE) sysconfig)Command)newer) convert_path)logz^#!.*python[0-9.]*([ ].*)?$cfeZdZdZgdZdgZdZdZdZdZ dZ d Z d Z d Z ed Zd S) 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|_dSN) build_dirscriptsr executableselfs /builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_distutils/command/build_scripts.pyinitialize_optionsz build_scripts.initialize_options#s"  cX|dddd|jj|_dS)Nbuild)r r)r r )rr)set_undefined_options distributionrrs rfinalize_optionszbuild_scripts.finalize_options)s9 ""  *  (    (0 rc|jSr)rrs rget_source_fileszbuild_scripts.get_source_files2s |rc@|jsdS|dSr)r copy_scriptsrs rrunzbuild_scripts.run5s)|  F rc||jg}g}|jD]}||||||||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:sm DN### l ? ?F   fh > > > > 8$$$&&rcVd}t|}tj|jtj|}|||js't||stj d|dS tj |}| }|s|d|zdSt|}n#t"$r |jsd}YnwxYw|||rTtjd||j|jst(js|j}n[tjt)jddt)jdt)jd}|dpd } d |z| zd z} || |jt|d |j 5} | | | |dddn #1swxYwY|r|dSdS|r||||dS)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~rw/?/?/G/GHH   z %"8"8  I3V < < < F > f%%A J  :VCDDD+11*==MM   < AAA  W%%%  , H5vt~ N N N< 3 - !%JJ!#!0:::&4Y???%4U;;;""J,11!44: +k9D@&&w ;;;'3<<<3JJw'''OOAKKMM222333333333333333      NN67 + + + + +s$C77D D=IIIc^tjdkrdS|D]}||dS)Nposix)r5name _change_mode)rr(files rr'zbuild_scripts._change_modessD 7g   F $ $D   d # # # # $ $rc|jrtjd|dStj|t dz}|dzdz}||kr.tjd|||tj||dSdS)Nzchanging mode of %siimz!changing mode of %s from %o to %o)rBr rCr5statrchmod)rrWoldmodenewmodes rrVzbuild_scripts._change_modes <  H*D 1 1 1 F'$--(61U?f, g   H8$ Q Q Q HT7 # # # # #  rc" |dn0#t$r#td|wxYw ||dS#t$r$td||wxYw)Nzutf-8z,The shebang ({!r}) is not encodable to utf-8z?The shebang ({!r}) is not encodable to the script encoding ({}))encodeUnicodeEncodeError ValueErrorformat)rQr4s rrGzbuild_scripts._validate_shebangs  NN7 # # # #!   AHHQQ    NN8 $ $ $ $ $!   ..4fWh.G.G  s-A A .BN)__name__ __module__ __qualname__ description user_optionsboolean_optionsrrr r#r"r&r'rV staticmethodrGrrr r s>KL iO 111 '''&4,4,4,l$$$ $ $ $\rr )__doc__r5rerYr distutilsrcorer _modifiedrutilrdistutils._logr r;compiler? first_line_rer rirrrss55 "*<==  TTTTTGTTTTTr