U ifF@s^ddlZddlZddlZddlmZddlmZmZmZm Z m Z ddlm Z GdddZ dS)N)DistutilsOptionError)utildir_util file_util archive_utildep_utillogc@seZdZgZddZddZddZddZd d ZdBd dZ ddZ dCddZ ddZ dDddZ dEddZddZdFddZddZd d!Zd"d#Zd$d%ZdGd&d'ZdHd)d*Zd+d,Zd-d.Zd/d0ZdId1d2ZdJd4d5ZdKd6d7ZdLd8d9ZdMd:d;ZdNdd?Z dPd@dAZ!d S)QCommandcCsbddlm}t||std|jtkr0td||_|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 r2/opt/alt/python38/lib64/python3.8/distutils/cmd.py__init__/s    zCommand.__init__cCs<|dkr0t|d|}|dkr*t|j|S|Snt|dS)Ndry_run_)getattrrAttributeError)rattrZmyvalrrr __getattr___s  zCommand.__getattr__cCs|js|d|_dS)N)rfinalize_optionsrrrrensure_finalizediszCommand.ensure_finalizedcCstd|jdSNz,abstract method -- subclass %s must overriderrr"rrrr{s zCommand.initialize_optionscCstd|jdSr$r%r"rrrr!s zCommand.finalize_optionsNcCsddlm}|dkr d|}|j||tjd|d}|jD]R\}}}||}|ddkrn|dd}t||}|j|d||ftjdqBdS) 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_optionscCstd|jdSr$r%r"rrrruns z Command.runr cCst||dSNr)rmsgr(rrrr,szCommand.announcecCs&ddlm}|r"t|tjdS)Nr)DEBUG)Zdistutils.debugr7printsysstdoutflush)rr6r7rrr debug_prints zCommand.debug_printcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))rsetattrr strr)rr1whatdefaultvalrrr_ensure_stringlikes   zCommand._ensure_stringlikecCs||d|dS)Nstring)rB)rr1r@rrr ensure_stringszCommand.ensure_stringcCspt||}|dkrdSt|tr6t||td|n6t|trTtdd|D}nd}|sltd||fdS)Nz,\s*|\s+css|]}t|tVqdSr5)r r>).0vrrr sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rr r>r=resplitlistallr)rr1rAokrrrensure_string_lists   zCommand.ensure_string_listcCs6||||}|dk r2||s2td|||fdS)Nzerror in '%s' option: )rBr)rr1Ztesterr?Z error_fmtr@rArrr_ensure_tested_strings zCommand._ensure_tested_stringcCs||tjjdddS)Nfilenamez$'%s' does not exist or is not a file)rNospathisfilerr1rrrensure_filenames zCommand.ensure_filenamecCs||tjjdddS)Nzdirectory namez)'%s' does not exist or is not a directory)rNrPrQisdirrSrrrensure_dirnames zCommand.ensure_dirnamecCst|dr|jS|jjSdS)N command_name)hasattrrWr__name__r"rrrr+ s zCommand.get_command_namecGsF|j|}||D](\}}t||dkrt||t||qdSr5)rget_command_objr#rr=)rZsrc_cmdZ option_pairsZ src_cmd_objZ src_optionZ dst_optionrrrset_undefined_optionss   zCommand.set_undefined_optionscCs|j||}||Sr5)rrZr#)rcommandZcreateZcmd_objrrrget_finalized_command$szCommand.get_finalized_commandrcCs|j||Sr5)rreinitialize_command)rr\Zreinit_subcommandsrrrr^0szCommand.reinitialize_commandcCs|j|dSr5)r run_command)rr\rrrr_4szCommand.run_commandcCs2g}|jD]"\}}|dks"||r ||q |Sr5) sub_commandsappend)rZcommandsZcmd_namemethodrrrget_sub_commands;s  zCommand.get_sub_commandscCstd||dS)Nzwarning: %s: %s )r warnr+)rr6rrrrdKsz Command.warncCstj||||jddSNr)rexecuter)rfuncargsr6r(rrrrgNszCommand.executecCstj|||jddSre)rmkpathr)rnamemoderrrrkQszCommand.mkpathc Cstj|||||j ||jdSre)r copy_filerr)rinfileoutfile preserve_modepreserve_timeslinkr(rrrrnTs  zCommand.copy_filec Cstj||||||j |jdSre)r copy_treerr)rrorprqrrZpreserve_symlinksr(rrrrt]s  zCommand.copy_treecCstj|||jdSre)r move_filer)rsrcZdstr(rrrrufszCommand.move_filecCs ddlm}||||jddS)Nr)spawnrf)Zdistutils.spawnrwr)rcmdZ search_pathr(rwrrrrwjs z Command.spawnc Cstj|||||j||dS)N)rownergroup)r make_archiver)rZ base_nameformatZroot_dirZbase_dirryrzrrrr{os  zCommand.make_archivecCs|dkrd|}t|tr"|f}nt|ttfs8td|dkrRd|d|f}|jsdt||rv| ||||n t |dS)Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating %s from %sz, ) r r>rJtupler joinrrZ newer_grouprgr debug)rZinfilesrprhriZexec_msgZskip_msgr(rrr make_fileus  zCommand.make_file)Nr&)r )N)N)N)r )r)Nr )rj)r r Nr )r r rr )r )r r )NNNN)NNr )"rY __module__ __qualname__r`rrr#rr!r3r4r,r<rBrDrMrNrTrVr+r[r]r^r_rcrdrgrkrnrtrurwr{rrrrrr sX0             r ) r9rPrHZdistutils.errorsrZ distutilsrrrrrr r rrrrs