B ];Al@s^ddlZddlZddlZddlmZddlmZmZmZm Z m Z ddlm Z GdddZ dS)N)DistutilsOptionError)utildir_util file_util archive_utildep_util)logc@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 r0/opt/alt/python37/lib/python3.7/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_options)rrrrensure_finalizediszCommand.ensure_finalizedcCstd|jdS)Nz,abstract method -- subclass %s must override)rr )rrrrr{s zCommand.initialize_optionscCstd|jdS)Nz,abstract method -- subclass %s must override)rr )rrrrr s zCommand.finalize_optionsNcCsddlm}|dkr d|}|j||tjd|d}x\|jD]R\}}}||}|ddkrp|dd}t||}|j|d||ftjdqDWdS) Nr) longopt_xlatezcommand options for '%s':)levelz =z%s = %s) Zdistutils.fancy_getoptr#get_command_nameannouncerINFOZ user_options translater)rheaderindentr#optionrvaluerrr dump_optionss      zCommand.dump_optionscCstd|jdS)Nz,abstract method -- subclass %s must override)rr )rrrrruns z Command.runrcCst||dS)N)r)rmsgr$rrrr(szCommand.announcecCs&ddlm}|r"t|tjdS)Nr)DEBUG)Zdistutils.debugr2printsysstdoutflush)rr1r2rrr debug_prints zCommand.debug_printcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))rsetattrr strr)rr-whatdefaultvalrrr_ensure_stringlikes   zCommand._ensure_stringlikecCs||d|dS)Nstring)r=)rr-r;rrr ensure_stringszCommand.ensure_stringcCspt||}|dkrdSt|tr6t||td|n6t|trTtdd|D}nd}|sltd||fdS)Nz,\s*|\s+css|]}t|tVqdS)N)r r9).0vrrr sz-Command.ensure_string_list..Fz''%s' must be a list of strings (got %r)) rr r9r8resplitlistallr)rr-r<okrrrensure_string_lists   zCommand.ensure_string_listcCs6||||}|dk r2||s2td|||fdS)Nzerror in '%s' option: )r=r)rr-Ztesterr:Z error_fmtr;r<rrr_ensure_tested_stringszCommand._ensure_tested_stringcCs||tjjdddS)Nfilenamez$'%s' does not exist or is not a file)rIospathisfile)rr-rrrensure_filenames zCommand.ensure_filenamecCs||tjjdddS)Nzdirectory namez)'%s' does not exist or is not a directory)rIrKrLisdir)rr-rrrensure_dirnames zCommand.ensure_dirnamecCst|dr|jS|jjSdS)N command_name)hasattrrQr __name__)rrrrr' s zCommand.get_command_namecGsJ|j|}|x0|D](\}}t||dkrt||t||qWdS)N)rget_command_objr!rr8)rZsrc_cmdZ option_pairsZ src_cmd_objZ src_optionZ dst_optionrrrset_undefined_optionss  zCommand.set_undefined_optionscCs|j||}||S)N)rrTr!)rcommandZcreateZcmd_objrrrget_finalized_command$szCommand.get_finalized_commandrcCs|j||S)N)rreinitialize_command)rrVZreinit_subcommandsrrrrX0szCommand.reinitialize_commandcCs|j|dS)N)r run_command)rrVrrrrY4szCommand.run_commandcCs6g}x,|jD]"\}}|dks$||r ||q W|S)N) sub_commandsappend)rZcommandsZcmd_namemethodrrrget_sub_commands;s zCommand.get_sub_commandscCstd||dS)Nzwarning: %s: %s )rwarnr')rr1rrrr^Ksz Command.warncCstj||||jddS)N)r)rexecuter)rfuncargsr1r$rrrr_NszCommand.executecCstj|||jddS)N)r)rmkpathr)rnamemoderrrrcQszCommand.mkpathc Cstj|||||j ||jdS)N)r)r copy_filerr)rinfileoutfile preserve_modepreserve_timeslinkr$rrrrfTs  zCommand.copy_filec Cstj||||||j |jdS)N)r)r copy_treerr)rrgrhrirjZpreserve_symlinksr$rrrrl]s zCommand.copy_treecCstj|||jdS)N)r)r move_filer)rsrcdstr$rrrrmfszCommand.move_filecCs ddlm}||||jddS)Nr)spawn)r)Zdistutils.spawnrpr)rcmdZ search_pathr$rprrrrpjs z Command.spawnc Cstj|||||j||dS)N)rownergroup)r make_archiver)rZ base_nameformatZroot_dirZbase_dirrrrsrrrrtos 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 r9rEtupler joinrrZ newer_groupr_rdebug)rZinfilesrhr`raZexec_msgZskip_msgr$rrr make_fileus  zCommand.make_file)Nr")r)N)N)N)r)r)Nr)rb)rrNr)rrrr)r)rr)NNNN)NNr)"rS __module__ __qualname__rZrrr!rr r/r0r(r7r=r?rHrIrNrPr'rUrWrXrYr]r^r_rcrfrlrmrprtryrrrrr sD0              r ) r4rKrCZdistutils.errorsrZ distutilsrrrrrrr rrrrs