WcFcsj ddlZddlZddlZddlmZddlmZmZmZm Z m Z ddlm Z GddZ dS)N)DistutilsOptionError)utildir_util file_util archive_utildep_utillogcseZdZ gZdZdZdZdZdZd$dZ d Z d%d Z d Z d&d Z d&dZdZ d&dZdZdZdZdZd%dZd'dZdZdZdZd(dZd)dZ d*dZ d+dZd%d Zd,d!Z d-d"Z d.d#Z!dS)/Commandcs ddlm}t||s td|jt ur t d||_|jd|_ |j|_ d|_ d|_ d|_ dS)Nr) Distributionz$dist must be a Distribution instancezCommand is an abstract class)Zdistutils.distr isinstance TypeError __class__r RuntimeError distributioninitialize_optionsZ_dry_runZverboseforceZhelp finalized)selfZdistr  &/usr/lib64/python3.12/distutils/cmd.py__init__zCommand.__init__/s 0/////$ --BC C >>W $ $=> >  !! ||   cs|dkr-t|d|z}|t|j|S|St|)Ndry_run_)getattrrZAttributeError)rZattrZmyvalrr __getattr__zCommand.__getattr___sE 9  D#*-E}t00$77  & &rcsN|js|jd|_dSN)rfinalize_optionsr rensure_finalizedzCommand.ensure_finalizedis%~~~  ! ! # #rc8 td|jzNz,abstract method -- subclass %s must overriderr rr rrzCommand.initialize_options{% I!^^,- -rcr"r#r$rr rrzCommand.finalize_optionss% I!^^,- -rNcstddlm}|d|jz}|j||ztj |dz}|j D]b\}}}|j|}|ddkr|dd}t||}|j||d|ztj ddS) Nr) longopt_xlatezcommand options for '%s':)levelz iz=z = ) Zdistutils.fancy_getoptr'get_command_nameannouncerZINFOZ user_optionsZ translater)rZheaderZindentr'optionrZvalue r dump_optionszCommand.dump_optionss888888 >043H3H3JJF fvoSXX 66$"// * *NVQ%%m4FbzS  D&)E MM&#>> #  * * *  * *rcr"r#r$rr rrunz Command.runr%rrcs8 tj||dSNr)rmsgr(rrr*zCommand.announces   srcsv ddlm}|r/t|tjj dSdS)Nr)DEBUG)Zdistutils.debugr1ZprintsysZstdoutZflush)rr0r1rr debug_printzCommand.debug_printsI  *))))) 5 #JJ JJ       5rc st||}|t||||St|tst d|d|d|d|S)N'z ' must be a z (got `z`))rsetattrr strr)rr+whatdefaultval r_ensure_stringlikezCommand._ensure_stringlikesadF# ; D&' * *NC%%&&*0&&$$$(=> > rcs0 |j|d|dS)NZstring)r;)rr+r8rr ensure_stringzCommand.ensure_strings$  '::::rcs" t||}|dSt|tr't||t j d|dSt|t rtd|D}nd}|std|d|ddS)Nz,\s*|\s+c3s>K|]}t|tdSr/)r r6)Z.0Zv rz z-Command.ensure_string_list..s)99As+++++99rFr4z!' must be a list of strings (got z)) rr r6r5reZsplitlistZallr)rr+r9Zok rensure_string_listzCommand.ensure_string_lists dF# ; F S ! ! D&"((;"< = = = =#t$$99S9992**&''2rcsr|j|||}| ||std|z||fzdSdS)Nzerror in '%s' option: )r;r)rr+Ztesterr7Z error_fmtr8r9r,r_ensure_tested_stringzCommand._ensure_tested_stringsQ%%fdG< ?66#;;&(@9(L*0#(78 8$/;??rcsd |j|tjjdddS)NZfilenamez$'%s' does not exist or is not a file)rBospathZisfilerr+r=rensure_filenamezCommand.ensure_filenames8C ""6277>>#-#I K K K Krcsb|j|tjjdddS)Nzdirectory namez)'%s' does not exist or is not a directory)rBrCrDZisdirrEr=rensure_dirnamezCommand.ensure_dirnames5 ""6277==#3#N P P P Prcsbt|dr |jS|jjS)N command_name)ZhasattrrHr __name__rr rr)zCommand.get_command_name s+ 4 ( ($$ $>>** *rc s |jj|}|j|D]/\}}t||t ||t||1dSr/)rget_command_objr!rr5)rZsrc_cmdZ option_pairsZ src_cmd_objZ src_optionZ dst_options rset_undefined_optionszCommand.set_undefined_optionssw ''77@ $$&&(4 L L $ZtZ(0j'+z*JKKK L Lrcsd |jj||}|j|Sr/)rrJr!)rcommandZcreateZcmd_objr@rget_finalized_commandzCommand.get_finalized_command$s5 ##33GVD  ""rrcs<|jj||Sr/)rreinitialize_command)rrLZreinit_subcommandsrrrNzCommand.reinitialize_command0s"  55g6HJ Jrcs@ |jj|dSr/)r run_command)rrLr=rrOzCommand.run_command4s&  %%g....rcsn g}|jD]#\}}| ||s|j|%|Sr/) sub_commandsZappend)rZcommandsZcmd_nameZmethodr@rget_sub_commandszCommand.get_sub_commands;sO "&"3"3 * * Xv~)))rcsVtjd|j|dS)Nzwarning: %s: %s )rwarnr))rr0r=rrRz Command.warnKs% $d&;&;&=sCCCCrcsPtj||||jdSNr)rexecuter)rfuncargsr0r(r:rrUzCommand.executeNs$ T4dll;;;;;rcsNtj|||jdSrS)rmkpathr)rZnameZmoderrrYzCommand.mkpathQs"dDLL99999rc sj tj|||||j ||jSrS)r copy_filerr)rinfileoutfile preserve_modepreserve_timesZlinkr(r,rrZzCommand.copy_fileTs< L""67M#1tzz>4+/<<99 9rc sj tj||||||j |jSrS)r copy_treerr)rr[r\r]r^Zpreserve_symlinksr(r,rr_zCommand.copy_tree]s? !!&'="02C&*jj.$,,HH HrcsL tj|||jSrS)r move_filer)rZsrcZdstr(r@rr`zCommand.move_filefs!2""3T\\BBBrcs@ ddlm}||||jdS)Nr)spawnrT)Zdistutils.spawnrar)rZcmdZ search_pathr(rar:rraz Command.spawnjs5@)))))) c; 55555rc sRtj|||||j||S)N)rownergroup)r make_archiver)rZ base_nameZformatZroot_dirZbase_dirrbrcr,rrdzCommand.make_archiveos1((FHh15/4ECC Crcsj |d|z}t|tr|f}n't|ttfs t d|d|ddj |}|j stj||r|j||||dStj|dS)Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringsz generating z from z, ) r r6r?Ztupler ZjoinrrZ newer_grouprUrZdebug)rZinfilesr\rVrWZexec_msgZskip_msgr(s r make_filezCommand.make_fileus   7'AH gs # #jGGGdE]33MO O   29''499W;M;MNH :::--gw?? LLtXu 5 5 5 5 IIh    r)Nr&)rr/)rr)rX)rrNr)rrrr)rr)NNNN)NNr)"rIZ __module__Z __qualname__rPrrr!rrr-r.r*r3r;r<rArBrFrGr)rKrMrNrOrQrRrUrYrZr_r`rardrerrr r sr :L ---`'''$ - - - - - - * * * * - - - .;;;; ''','+8888KKK PPP+++ LLL*JJJJ///    DDD<<<<::::JK#$9999JK./HHHHCCCC6666 GK'+CCCC78      rr ) r2rCr>Zdistutils.errorsrZ distutilsrrrrrrr rfrrrgs 111111GGGGGGGGGGGGGGG G G G G G G G G r