%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/distutils/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/distutils/__pycache__/cmd.cpython-38.pyc

U

qaF@sbdZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZddlmZGdddZ
dS)ztdistutils.cmd

Provides the Command class, the base class for the command classes
in the distutils.command package.
N)DistutilsOptionError)utildir_util	file_utilarchive_utildep_utillogc@s"eZdZdZgZddZddZddZdd	Zd
dZ	dCddZ
ddZdDddZddZ
dEddZdFddZddZdGddZdd Zd!d"Zd#d$Zd%d&ZdHd'd(ZdId*d+Zd,d-Zd.d/Zd0d1ZdJd2d3ZdKd5d6ZdLd7d8ZdMd9d:ZdNd;d<ZdOd=d>Z dPd?d@Z!dQdAdBZ"dS)RCommanda}Abstract base class for defining command classes, the "worker bees"
    of the Distutils.  A useful analogy for command classes is to think of
    them as subroutines with local variables called "options".  The options
    are "declared" in 'initialize_options()' and "defined" (given their
    final values, aka "finalized") in 'finalize_options()', both of which
    must be defined by every command class.  The distinction between the
    two is necessary because option values might come from the outside
    world (command line, config file, ...), and any options dependent on
    other options must be computed *after* these outside influences have
    been processed -- hence 'finalize_options()'.  The "body" of the
    subroutine, where it does all its work based on the values of its
    options, is the 'run()' method, which must also be implemented by every
    command class.
    cCsbddlm}t||std|jtkr0td||_|d|_	|j
|_
d|_d|_d|_
dS)zCreate and initialize a new Command object.  Most importantly,
        invokes the 'initialize_options()' method, which is the real
        initializer and depends on the actual command being
        instantiated.
        r)Distributionz$dist must be a Distribution instancezCommand is an abstract classN)Zdistutils.distr
isinstance	TypeError	__class__r
RuntimeErrordistributioninitialize_optionsZ_dry_runverboseforcehelp	finalized)selfdistrr)/usr/local/lib/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|jdS)aSet default values for all the options that this command
        supports.  Note that these defaults may be overridden by other
        commands, by the setup script, by config files, or by the
        command-line.  Thus, this is not the place to code dependencies
        between options; generally, 'initialize_options()' implementations
        are just a bunch of "self.foo = None" assignments.

        This method must be implemented by all command classes.
        ,abstract method -- subclass %s must overrideNrrr#rrrr{s
zCommand.initialize_optionscCstd|jdS)aSet final values for all the options that this command supports.
        This is always called as late as possible, ie.  after any option
        assignments from the command-line or from other commands have been
        done.  Thus, this is the place to code option dependencies: if
        'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as
        long as 'foo' still has the same value it was assigned in
        'initialize_options()'.

        This method must be implemented by all command classes.
        r%Nr&r#rrrr"szCommand.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|jdS)aA command's raison d'etre: carry out the action it exists to
        perform, controlled by the options initialized in
        'initialize_options()', customized by other commands, the setup
        script, the command-line, and config files, and finalized in
        'finalize_options()'.  All terminal output and filesystem
        interaction should be done by 'run()'.

        This method must be implemented by all command classes.
        r%Nr&r#rrrruns
zCommand.runr!cCst||dS)zmIf the current verbosity level is of greater than or equal to
        'level' print 'msg' to stdout.
        Nr)rmsgr)rrrr-szCommand.announcecCs&ddlm}|r"t|tjdS)z~Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        r)DEBUGN)Zdistutils.debugr7printsysstdoutflush)rr6r7rrrdebug_printszCommand.debug_printcCsBt||}|dkr"t||||St|ts>td|||f|S)Nz'%s' must be a %s (got `%s`))rsetattrrstrr)rr2whatdefaultvalrrr_ensure_stringlikes

zCommand._ensure_stringlikecCs||d|dS)zWEnsure that 'option' is a string; if not defined, set it to
        'default'.
        stringN)rB)rr2r@rrr
ensure_stringszCommand.ensure_stringcCspt||}|dkrdSt|tr6t||td|n6t|trTtdd|D}nd}|sltd||fdS)zEnsure that 'option' is a list of strings.  If 'option' is
        currently a string, we split it either on /,\s*/ or /\s+/, so
        "foo bar baz", "foo,bar,baz", and "foo,   bar baz" all become
        ["foo", "bar", "baz"].
        Nz,\s*|\s+css|]}t|tVqdSN)rr>).0vrrr	<genexpr>sz-Command.ensure_string_list.<locals>.<genexpr>Fz''%s' must be a list of strings (got %r))	rrr>r=resplitlistallr)rr2rAokrrrensure_string_lists


zCommand.ensure_string_listcCs6||||}|dk	r2||s2td|||fdS)Nzerror in '%s' option: )rBr)rr2Ztesterr?Z	error_fmtr@rArrr_ensure_tested_strings
zCommand._ensure_tested_stringcCs||tjjdddS)z5Ensure that 'option' is the name of an existing file.filenamez$'%s' does not exist or is not a fileN)rOospathisfilerr2rrrensure_filenameszCommand.ensure_filenamecCs||tjjdddS)Nzdirectory namez)'%s' does not exist or is not a directory)rOrQrRisdirrTrrrensure_dirnameszCommand.ensure_dirnamecCst|dr|jS|jjSdS)Ncommand_name)hasattrrXr__name__r#rrrr,	s
zCommand.get_command_namecGsF|j|}||D](\}}t||dkrt||t||qdS)a>Set the values of any "undefined" options from corresponding
        option values in some other command object.  "Undefined" here means
        "is None", which is the convention used to indicate that an option
        has not been changed between 'initialize_options()' and
        'finalize_options()'.  Usually called from 'finalize_options()' for
        options that depend on some other command rather than another
        option of the same command.  'src_cmd' is the other command from
        which option values will be taken (a command object will be created
        for it if necessary); the remaining arguments are
        '(src_option,dst_option)' tuples which mean "take the value of
        'src_option' in the 'src_cmd' command object, and copy it to
        'dst_option' in the current command object".
        N)rget_command_objr$rr=)rZsrc_cmdZoption_pairsZsrc_cmd_objZ
src_optionZ
dst_optionrrrset_undefined_optionss
zCommand.set_undefined_optionscCs|j||}||S)zWrapper around Distribution's 'get_command_obj()' method: find
        (create if necessary and 'create' is true) the command object for
        'command', call its 'ensure_finalized()' method, and return the
        finalized command object.
        )rr[r$)rcommandZcreateZcmd_objrrrget_finalized_command$szCommand.get_finalized_commandrcCs|j||SrE)rreinitialize_command)rr]Zreinit_subcommandsrrrr_0szCommand.reinitialize_commandcCs|j|dS)zRun some other command: uses the 'run_command()' method of
        Distribution, which creates and finalizes the command object if
        necessary and then invokes its 'run()' method.
        N)rrun_command)rr]rrrr`4szCommand.run_commandcCs2g}|jD]"\}}|dks"||r
||q
|S)akDetermine the sub-commands that are relevant in the current
        distribution (ie., that need to be run).  This is based on the
        'sub_commands' class attribute: each tuple in that list may include
        a method that we call to determine if the subcommand needs to be
        run for the current distribution.  Return a list of command names.
        N)sub_commandsappend)rcommandsZcmd_namemethodrrrget_sub_commands;s
zCommand.get_sub_commandscCstd||dS)Nzwarning: %s: %s
)r	warnr,)rr6rrrrfKszCommand.warncCstj||||jddSNr)rexecuter)rfuncargsr6r)rrrriNszCommand.executecCstj|||jddSrg)rmkpathr)rnamemoderrrrmQszCommand.mkpathc	Cstj|||||j||jdS)zCopy a file respecting verbose, dry-run and force flags.  (The
        former two default to whatever is in the Distribution object, and
        the latter defaults to false for commands that don't define it.)rh)r	copy_filerr)rinfileoutfile
preserve_modepreserve_timeslinkr)rrrrpTs
zCommand.copy_filec	Cstj||||||j|jdS)z\Copy an entire directory tree respecting verbose, dry-run,
        and force flags.
        rh)r	copy_treerr)rrqrrrsrtZpreserve_symlinksr)rrrrv]s
zCommand.copy_treecCstj|||jdS)z$Move a file respecting dry-run flag.rh)r	move_filer)rsrcdstr)rrrrwfszCommand.move_filecCs ddlm}||||jddS)z2Spawn an external command respecting dry-run flag.r)spawnrhN)Zdistutils.spawnrzr)rcmdZsearch_pathr)rzrrrrzjsz
Command.spawnc	Cstj|||||j||dS)N)rownergroup)rmake_archiver)r	base_nameformatroot_dirbase_dirr|r}rrrr~os
zCommand.make_archivecCs|dkrd|}t|tr"|f}nt|ttfs8td|dkrRd|d|f}|jsdt||rv|	||||n
t
|dS)aSpecial case of 'execute()' for operations that process one or
        more input files and generate one output file.  Works just like
        'execute()', except the operation is skipped and a different
        message printed if 'outfile' already exists and is newer than all
        files listed in 'infiles'.  If the command defined 'self.force',
        and it is true, then the command is unconditionally run -- does no
        timestamp checks.
        Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating %s from %sz, )rr>rKtupler
joinrrZnewer_grouprir	debug)rZinfilesrrrjrkZexec_msgZskip_msgr)rrr	make_fileus

zCommand.make_file)Nr')r!)N)N)N)r!)r)Nr!)rl)r!r!Nr!)r!r!rr!)r!)r!r!)NNNN)NNr!)#rZ
__module____qualname____doc__rarr r$rr"r4r5r-r<rBrDrNrOrUrWr,r\r^r_r`rerfrirmrprvrwrzr~rrrrrr
sZ0












	
	


r
)rr9rQrIZdistutils.errorsrZ	distutilsrrrrrr	r
rrrr<module>s


Zerion Mini Shell 1.0