//usr/lib64/lib64//lib64/lib64//
ۜSec @ s d Z d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z m
Z
m Z m Z d d l m
Z
d f d YZ d e f d
YZ d S( st distutils.cmd
Provides the Command class, the base class for the command classes
in the distutils.command package.
s $Id$iN( t DistutilsOptionError( t utilt dir_utilt file_utilt archive_utilt dep_util( t logt Commandc B sy e Z d Z g Z d Z d Z d Z d Z d Z d# d d Z
d Z d d
Z d Z
d# d Z d# d
Z d Z d# d Z d Z d Z d Z d Z d d Z d d Z d Z d Z d Z d# d d Z d d Z d d d# d d Z d d d d d Z d d Z d d d Z d# d# d# d# d! Z! d# d# d d" Z" RS($ s} 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.
c C s d d l m } t | | s+ t d n | j t k rF t d n | | _ | j d | _
| j | _ d | _ d | _
d | _ d S( s Create 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.
i( t Distributions$ dist must be a Distribution instances Command is an abstract classi N( t distutils.distR t
isinstancet TypeErrort __class__R t RuntimeErrort distributiont initialize_optionst Nonet _dry_runt verboset forcet helpt finalized( t selft distR ( ( s% /usr/lib64/python2.7/distutils/cmd.pyt __init__1 s
c C sO | d k rB t | d | } | d k r; t | j | S| Sn t | d S( Nt dry_runt _( t getattrR R t AttributeError( R t attrt myval( ( s% /usr/lib64/python2.7/distutils/cmd.pyt __getattr__a s c C s# | j s | j n d | _ d S( Ni ( R t finalize_options( R ( ( s% /usr/lib64/python2.7/distutils/cmd.pyt ensure_finalizedk s
c C s t d | j d S( s Set 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.
s, abstract method -- subclass %s must overrideN( R
R ( R ( ( s% /usr/lib64/python2.7/distutils/cmd.pyR } s
c C s t d | j d S( s Set 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.
s, abstract method -- subclass %s must overrideN( R
R ( R ( ( s% /usr/lib64/python2.7/distutils/cmd.pyR s t c C s d d l m } | d k r/ d | j } n | j | | d t j | d } xy | j D]n \ } } } | j | } | d d k r | d } n t | | } | j | d | | f d t j q] Wd S( Ni( t
longopt_xlates command options for '%s':t levels t =s %s = %s(
t distutils.fancy_getoptR# R t get_command_namet announceR t INFOt user_optionst translateR ( R t headert indentR# t optionR t value( ( s% /usr/lib64/python2.7/distutils/cmd.pyt dump_options s
c C s t d | j d S( s A 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.
s, abstract method -- subclass %s must overrideN( R
R ( R ( ( s% /usr/lib64/python2.7/distutils/cmd.pyt run s
i c C s t j | | d S( sm If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
N( R ( R t msgR$ ( ( s% /usr/lib64/python2.7/distutils/cmd.pyR( s c C s/ d d l m } | r+ | GHt j j n d S( s~ Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
i( t DEBUGN( t distutils.debugR3 t syst stdoutt flush( R R2 R3 ( ( s% /usr/lib64/python2.7/distutils/cmd.pyt debug_print s c C s[ t | | } | d k r/ t | | | | St | t sW t d | | | f n | S( Ns '%s' must be a %s (got `%s`)( R R t setattrR
t strR ( R R. t whatt defaultt val( ( s% /usr/lib64/python2.7/distutils/cmd.pyt _ensure_stringlike s c C s | j | d | d S( sW Ensure that 'option' is a string; if not defined, set it to
'default'.
t stringN( R> ( R R. R<