o ?OgF@s` ddlZddlZddlZddlmZddlmZmZmZm Z m Z ddlm Z GdddZ dS)N)DistutilsOptionError)utildir_util file_util archive_utildep_utillogc@s0eZdZ gZddZddZddZddZd d ZdBd dZ ddZ dCddZ ddZ dDddZ dDddZddZ dDddZddZd d!Zd"d#Zd$d%ZdCd&d'ZdEd)d*Zd+d,Zd-d.Zd/d0ZdFd1d2ZdGd4d5Z  dHd6d7Z  dId8d9ZdCd:d;ZdJdd?Z dLd@dAZ!d S)MCommandcCsd ddlm}t||std|jturtd||_|d|_ |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_runverboseforcehelp finalized)selfZdistr r4/opt/alt/python310/lib64/python3.10/distutils/cmd.py__init__/s     zCommand.__init__cCs6|dkrt|d|}|durt|j|S|St|)Ndry_run_)getattrrAttributeError)rattrZmyvalrrr __getattr___s  zCommand.__getattr__cCs|js|d|_dSN)rfinalize_optionsrrrrensure_finalizedis zCommand.ensure_finalizedcC td|jNz,abstract method -- subclass %s must overriderrr#rrrr{ zCommand.initialize_optionscCr%r&r'r#rrrr"s zCommand.finalize_optionsNcCsddlm}|durd|}|j||tjd|d}|jD])\}}}||}|ddkr7|dd}t||}|j|d||ftjdq!dS) Nr) longopt_xlatezcommand options for '%s':)levelz =z%s = %s) Zdistutils.fancy_getoptr*get_command_nameannouncer INFOZ user_options translater)rheaderindentr*optionrvaluerrr dump_optionss      zCommand.dump_optionscCr%r&r'r#rrrrunr(z Command.runr!cCs t||dSNr)rmsgr+rrrr/szCommand.announcecCs, ddlm}|rt|tjdSdS)Nr)DEBUG)Zdistutils.debugr:printsysstdoutflush)rr9r:rrr debug_prints  zCommand.debug_printcCsBt||}|durt||||St|tstd|||f|S)Nz'%s' must be a %s (got `%s`))rsetattrr strr)rr4whatdefaultvalrrr_ensure_stringlikes   zCommand._ensure_stringlikecCs ||d|dS)Nstring)rE)rr4rCrrr ensure_stringszCommand.ensure_stringcCst t||}|dur dSt|trt||td|dSt|tr,tdd|D}nd}|s8td||fdS)Nz,\s*|\s+css|]}t|tVqdSr8)r rA).0vrrr sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rr rAr@resplitlistallr)rr4rDokrrrensure_string_lists    zCommand.ensure_string_listcCs:||||}|dur||std|||fdSdS)Nzerror in '%s' option: )rEr)rr4ZtesterrBZ error_fmtrCrDrrr_ensure_tested_strings zCommand._ensure_tested_stringcCs ||tjjdddS)Nfilenamez$'%s' does not exist or is not a file)rQospathisfilerr4rrrensure_filenames  zCommand.ensure_filenamecCs||tjjdddS)Nzdirectory namez)'%s' does not exist or is not a directory)rQrSrTisdirrVrrrensure_dirnames zCommand.ensure_dirnamecCst|dr|jS|jjS)N command_name)hasattrrZr__name__r#rrrr. s zCommand.get_command_namecGsH |j|}||D]\}}t||dur!t||t||q dSr8)rget_command_objr$rr@)rZsrc_cmdZ option_pairsZ src_cmd_objZ src_optionZ dst_optionrrrset_undefined_optionss  zCommand.set_undefined_optionscCs |j||}||Sr8)rr]r$)rcommandZcreateZcmd_objrrrget_finalized_command$szCommand.get_finalized_commandrcCs|j||Sr8)rreinitialize_command)rr_Zreinit_subcommandsrrrra0szCommand.reinitialize_commandcCs |j|dSr8)r run_command)rr_rrrrb4szCommand.run_commandcCs4 g}|jD]\}}|dus||r||q|Sr8) sub_commandsappend)rZcommandsZcmd_namemethodrrrget_sub_commands;s zCommand.get_sub_commandscCstd||dS)Nzwarning: %s: %s )r warnr.)rr9rrrrgKz Command.warncCstj||||jddSNr)rexecuter)rfuncargsr9r+rrrrkNszCommand.executecCstj|||jddSri)rmkpathr)rnamemoderrrroQrhzCommand.mkpathc Cs tj|||||j ||jdSri)r copy_filerr)rinfileoutfile preserve_modepreserve_timeslinkr+rrrrrTs   zCommand.copy_filec Cs tj||||||j |jdSri)r copy_treerr)rrsrtrurvZpreserve_symlinksr+rrrrx]s   zCommand.copy_treecCs tj|||jdSri)r move_filer)rsrcZdstr+rrrryfszCommand.move_filecCs" ddlm}||||jddS)Nr)spawnrj)Zdistutils.spawnr{r)rcmdZ search_pathr+r{rrrr{js z Command.spawnc Cstj|||||j||dS)N)rownergroup)r make_archiver)rZ base_nameformatZroot_dirZbase_dirr}r~rrrros zCommand.make_archivecCs |dur d|}t|tr|f}n t|ttfstd|dur*d|d|f}|js3t||r=| ||||dSt |dS)Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating %s from %sz, ) r rArMtupler joinrrZ newer_grouprkr debug)rZinfilesrtrlrmZexec_msgZskip_msgr+rrr make_fileus zCommand.make_file)Nr))r!r8)rr )rn)r!r!Nr!)r!r!rr!)r!r!)NNNN)NNr!)"r\ __module__ __qualname__rcrrr$rr"r6r7r/r?rErGrPrQrWrYr.r^r`rarbrfrgrkrorrrxryr{rrrrrrr sR0              r ) r<rSrKZdistutils.errorsrZ distutilsrrrrrr r rrrrs