Your IP : 3.145.51.35


Current Path : /opt/alt/python33/lib64/python3.3/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/distutils/__pycache__/cmd.cpython-33.pyc

�
��f[Jc@s�dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZddlmZGdd�d�Z
Gdd	�d	e
�ZdS(
utdistutils.cmd

Provides the Command class, the base class for the command classes
in the distutils.command package.
iN(uDistutilsOptionError(uutiludir_utilu	file_utiluarchive_utiludep_util(ulogcBs�|EeZdZdZgZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dBdd
d�Zdd�Zddd�Z
dd�ZdBdd�ZdBdd�Zdd�ZdBdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zdd&d'�Zd(d)d*�Zd+d,�Zd-d.�Zd/d0�ZdBdd1d2�Zd3d4d5�ZdddBdd6d7�Zddd(dd8d9�Zdd:d;�Z ddd<d=�Z!dBdBd>d?�Z"dBdBdd@dA�Z#dBS(CuCommandu}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.
    cCs�ddlm}t||�s.td��n|jtkrLtd��n||_|j�d|_
|j|_d|_d|_
d|_dS(u�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(uDistributionu$dist must be a Distribution instanceuCommand is an abstract classN(udistutils.distuDistributionu
isinstanceu	TypeErroru	__class__uCommanduRuntimeErrorudistributionuinitialize_optionsuNoneu_dry_runuverboseuforceuhelpu	finalized(uselfudistuDistribution((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu__init__/s	

			uCommand.__init__cCsR|dkrBt|d|�}|dkr;t|j|�S|Snt|��dS(Nudry_runu_(ugetattruNoneudistributionuAttributeError(uselfuattrumyval((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu__getattr___suCommand.__getattr__cCs#|js|j�nd|_dS(Ni(u	finalizedufinalize_options(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuensure_finalizedis	
uCommand.ensure_finalizedcCstd|j��dS(u�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.
        u,abstract method -- subclass %s must overrideN(uRuntimeErroru	__class__(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuinitialize_options{s
uCommand.initialize_optionscCstd|j��dS(uSet 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.
        u,abstract method -- subclass %s must overrideN(uRuntimeErroru	__class__(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyufinalize_options�suCommand.finalize_optionsucCs�ddlm}|dkr/d|j�}n|j||dtj�|d}x|jD]t\}}}|j|�}|d	dkr�|dd
�}nt	||�}|j|d||fdtj�q]WdS(Ni(u
longopt_xlateucommand options for '%s':ulevelu  iu=u%s = %si����i����(
udistutils.fancy_getoptu
longopt_xlateuNoneuget_command_nameuannounceuloguINFOuuser_optionsu	translateugetattr(uselfuheaderuindentu
longopt_xlateuoptionu_uvalue((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyudump_options�s
uCommand.dump_optionscCstd|j��dS(u�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.
        u,abstract method -- subclass %s must overrideN(uRuntimeErroru	__class__(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyurun�s
uCommand.runicCstj||�dS(umIf the current verbosity level is of greater than or equal to
        'level' print 'msg' to stdout.
        N(ulog(uselfumsgulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuannounce�suCommand.announcecCs4ddlm}|r0t|�tjj�ndS(u~Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        i(uDEBUGN(udistutils.debuguDEBUGuprintusysustdoutuflush(uselfumsguDEBUG((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyudebug_print�s
uCommand.debug_printcCs^t||�}|dkr/t|||�|St|t�sZtd|||f��n|S(Nu'%s' must be a %s (got `%s`)(ugetattruNoneusetattru
isinstanceustruDistutilsOptionError(uselfuoptionuwhatudefaultuval((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu_ensure_stringlike�suCommand._ensure_stringlikecCs|j|d|�dS(uWEnsure that 'option' is a string; if not defined, set it to
        'default'.
        ustringN(u_ensure_stringlike(uselfuoptionudefault((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu
ensure_string�suCommand.ensure_stringcCs�t||�}|dkrdSt|t�rMt||tjd|��nPt|t�rxtdd�|D��}nd}|s�t
d||f��ndS(u�Ensure 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"].
        Nu,\s*|\s+css|]}t|t�VqdS(N(u
isinstanceustr(u.0uv((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu	<genexpr>�su-Command.ensure_string_list.<locals>.<genexpr>u''%s' must be a list of strings (got %r)F(ugetattruNoneu
isinstanceustrusetattrureusplitulistualluFalseuDistutilsOptionError(uselfuoptionuvaluok((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuensure_string_list�suCommand.ensure_string_listcCsO|j|||�}|dk	rK||�rKtd|||f��ndS(Nuerror in '%s' option: (u_ensure_stringlikeuNoneuDistutilsOptionError(uselfuoptionutesteruwhatu	error_fmtudefaultuval((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu_ensure_tested_string�s
uCommand._ensure_tested_stringcCs |j|tjjdd�dS(u5Ensure that 'option' is the name of an existing file.ufilenameu$'%s' does not exist or is not a fileN(u_ensure_tested_stringuosupathuisfile(uselfuoption((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuensure_filename�suCommand.ensure_filenamecCs |j|tjjdd�dS(Nudirectory nameu)'%s' does not exist or is not a directory(u_ensure_tested_stringuosupathuisdir(uselfuoption((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuensure_dirnamesuCommand.ensure_dirnamecCs$t|d�r|jS|jjSdS(Nucommand_name(uhasattrucommand_nameu	__class__u__name__(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuget_command_name	suCommand.get_command_namecGsh|jj|�}|j�xE|D]=\}}t||�dkr#t||t||��q#q#WdS(u>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(udistributionuget_command_objuensure_finalizedugetattruNoneusetattr(uselfusrc_cmduoption_pairsusrc_cmd_obju
src_optionu
dst_option((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuset_undefined_optionss

uCommand.set_undefined_optionscCs#|jj||�}|j�|S(u�Wrapper 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.
        (udistributionuget_command_objuensure_finalized(uselfucommanducreateucmd_obj((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuget_finalized_command$s
uCommand.get_finalized_commandicCs|jj||�S(N(udistributionureinitialize_command(uselfucommandureinit_subcommands((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyureinitialize_command0suCommand.reinitialize_commandcCs|jj|�dS(u�Run 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(udistributionurun_command(uselfucommand((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyurun_command4suCommand.run_commandcCsLg}x?|jD]4\}}|dks4||�r|j|�qqW|S(ukDetermine 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(usub_commandsuNoneuappend(uselfucommandsucmd_nameumethod((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuget_sub_commands;s
uCommand.get_sub_commandscCs!tjd|j�|f�dS(Nuwarning: %s: %s
(uloguwarnuget_command_name(uselfumsg((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuwarnKs	uCommand.warncCs tj|||d|j�dS(Nudry_run(uutiluexecuteudry_run(uselfufuncuargsumsgulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuexecuteOsuCommand.executei�cCstj||d|j�dS(Nudry_run(udir_utilumkpathudry_run(uselfunameumode((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyumkpathRsuCommand.mkpathc	Cs)tj|||||j|d|j�S(u�Copy 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.)udry_run(u	file_utilu	copy_fileuforceudry_run(uselfuinfileuoutfileu
preserve_modeupreserve_timesulinkulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu	copy_fileUsuCommand.copy_filec	Cs)tj||||||jd|j�S(u\Copy an entire directory tree respecting verbose, dry-run,
        and force flags.
        udry_run(udir_utilu	copy_treeuforceudry_run(uselfuinfileuoutfileu
preserve_modeupreserve_timesupreserve_symlinksulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu	copy_tree^suCommand.copy_treecCstj||d|j�S(u$Move a file respecting dry-run flag.udry_run(u	file_utilu	move_fileudry_run(uselfusrcudstulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu	move_filegsuCommand.move_filecCs*ddlm}|||d|j�dS(u2Spawn an external command respecting dry-run flag.i(uspawnudry_runN(udistutils.spawnuspawnudry_run(uselfucmdusearch_pathuleveluspawn((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuspawnksu
Command.spawncCstj||||d|j�S(Nudry_run(uarchive_utilumake_archiveudry_run(uselfu	base_nameuformaturoot_dirubase_dir((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyumake_archivepsuCommand.make_archivecCs�|dkrd|}nt|t�r4|f}n$t|ttf�sXtd��n|dkr�d|dj|�f}n|js�tj	||�r�|j
||||�n
tj|�dS(u�Special 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.
        uskipping %s (inputs unchanged)u9'infiles' must be a string, or a list or tuple of stringsugenerating %s from %su, N(
uNoneu
isinstanceustrulistutupleu	TypeErrorujoinuforceudep_utilunewer_groupuexecuteulogudebug(uselfuinfilesuoutfileufuncuargsuexec_msguskip_msgulevel((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu	make_filets

uCommand.make_fileN($u__name__u
__module__u__qualname__u__doc__usub_commandsu__init__u__getattr__uensure_finalizeduinitialize_optionsufinalize_optionsuNoneudump_optionsurunuannounceudebug_printu_ensure_stringlikeu
ensure_stringuensure_string_listu_ensure_tested_stringuensure_filenameuensure_dirnameuget_command_nameuset_undefined_optionsuget_finalized_commandureinitialize_commandurun_commanduget_sub_commandsuwarnuexecuteumkpathu	copy_fileu	copy_treeu	move_fileuspawnumake_archiveu	make_file(u
__locals__((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuCommandsD0



uCommandcBsS|EeZdZdZdgZdd�Zdd�Zd	d
�Zdd�Zd
S(uinstall_miscu{Common base class for installing some files in a subdirectory.
    Currently used by install_data and install_scripts.
    uinstall-dir=udu!directory to install the files tocCsd|_g|_dS(N(uNoneuinstall_diruoutfiles(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuinitialize_options�s	uinstall_misc.initialize_optionscCs|jd|df�dS(Nuinstalluinstall_dir(uset_undefined_options(uselfudirname((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu_install_dir_from�suinstall_misc._install_dir_fromcCsmg|_|sdS|j|j�xC|D];}|j||j�|jjtjj|j|��q*WdS(N(uoutfilesumkpathuinstall_diru	copy_fileuappenduosupathujoin(uselfufilelistuf((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu_copy_files�s	
uinstall_misc._copy_filescCs|jS(N(uoutfiles(uself((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuget_outputs�suinstall_misc.get_outputsN(uinstall-dir=udu!directory to install the files to(	u__name__u
__module__u__qualname__u__doc__uuser_optionsuinitialize_optionsu_install_dir_fromu_copy_filesuget_outputs(u
__locals__((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyuinstall_misc�s		uinstall_misc(u__doc__usysuosureudistutils.errorsuDistutilsOptionErroru	distutilsuutiludir_utilu	file_utiluarchive_utiludep_utiluloguCommanduinstall_misc(((u2/opt/alt/python33/lib64/python3.3/distutils/cmd.pyu<module>s$(��

?>