ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/distutils/__pycache__/cmd.cpython-311.pyc

�

�f�F��p�dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZddlmZGd�d��Z
dS)ztdistutils.cmd

Provides the Command class, the base class for the command classes
in the distutils.command package.
�N)�DistutilsOptionError)�util�dir_util�	file_util�archive_util�dep_util��logc��eZdZdZgZd�Zd�Zd�Zd�Zd�Z	d%d	�Z
d
�Zd&d�Zd
�Z
d'd�Zd'd�Zd�Z	d'd�Zd�Zd�Zd�Zd�Zd&d�Zd(d�Zd�Zd�Zd�Zd)d�Zd*d�Z		d+d�Z		d,d �Zd&d!�Zd-d"�Z 		d.d#�Z!	d/d$�Z"dS)0�Commanda}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��ddlm}t||��std���|jt
urt
d���||_|���d|_	|j
|_
d|_d|_d|_
dS)z�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.
        r)�Distributionz$dist must be a Distribution instancezCommand is an abstract classN)�distutils.distr�
isinstance�	TypeError�	__class__r�RuntimeError�distribution�initialize_options�_dry_run�verbose�force�help�	finalized)�self�distrs   �4/opt/alt/python311/lib64/python3.11/distutils/cmd.py�__init__zCommand.__init__/s���	0�/�/�/�/�/��$��-�-�	D��B�C�C�C��>�W�$�$��=�>�>�>� ������!�!�!���
��|�����
���	������c��|dkr,t|d|z��}|�t|j|��S|St|���)N�dry_run�_)�getattrr�AttributeError)r�attr�myvals   r�__getattr__zCommand.__getattr___sK���9����D�#��*�-�-�E��}��t�0�$�7�7�7��� ��&�&�&rc�J�|js|���d|_dS�N�)r�finalize_options�rs r�ensure_finalizedzCommand.ensure_finalizedis)���~�	$��!�!�#�#�#�����rc�0�td|jz���)a�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.
        �,abstract method -- subclass %s must override�rrr,s rrzCommand.initialize_options{�#���I�!�^�,�-�-�	-rc�0�td|jz���)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/r0r,s rr+zCommand.finalize_options�s#���I�!�^�,�-�-�	-rN�c�z�ddlm}|�d|���z}|�||ztj���|dz}|jD]j\}}}|�|��}|ddkr
|dd�}t||��}|�||�d|��ztj����kdS)	Nr)�
longopt_xlatezcommand options for '%s':)�levelz  ����=z = )	�distutils.fancy_getoptr5�get_command_name�announcer
�INFO�user_options�	translater#)r�header�indentr5�optionr"�values       r�dump_optionszCommand.dump_options�s���8�8�8�8�8�8��>�0�4�3H�3H�3J�3J�J�F��
�
�f�v�o�S�X�
�6�6�6��$���"�/�	*�	*�N�V�Q���%�%�m�4�4�F��b�z�S� � ��������D�&�)�)�E��M�M�&������#>�>� #��
�
*�
*�
*�
*�	*�	*rc�0�td|jz���)a�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.
        r/r0r,s r�runzCommand.run�r1rr*c�0�tj||��dS)zmIf the current verbosity level is of greater than or equal to
        'level' print 'msg' to stdout.
        Nr	)r�msgr6s   rr;zCommand.announce�s��	���s�����rc�t�ddlm}|r/t|��tj���dSdS)z~Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        r)�DEBUGN)�distutils.debugrI�print�sys�stdout�flush)rrGrIs   r�debug_printzCommand.debug_print�sM��	*�)�)�)�)�)��	��#�J�J�J��J��������	�	rc	��t||��}|�t|||��|St|t��st	d|�d|�d|�d����|S)N�'z' must be a z (got `z`))r#�setattrr�strr)rrA�what�default�vals     r�_ensure_stringlikezCommand._ensure_stringlike�sq���d�F�#�#���;��D�&�'�*�*�*��N��C��%�%�	>�&�&�*0�&�&�$�$�$����(=�>�>�
>��
rc�4�|�|d|��dS)zWEnsure that 'option' is a string; if not defined, set it to
        'default'.
        �stringN)rW)rrArUs   r�
ensure_stringzCommand.ensure_string�s"��	
�����'�:�:�:�:�:rc�6�t||��}|�dSt|t��r&t||t	jd|����dSt|t��rtd�|D����}nd}|std|�d|�d����dS)z�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"].
        Nz,\s*|\s+c3�@K�|]}t|t��V��dS�N)rrS)�.0�vs  r�	<genexpr>z-Command.ensure_string_list.<locals>.<genexpr>�s,����9�9���A�s�+�+�9�9�9�9�9�9rFrQz!' must be a list of strings (got �))	r#rrSrR�re�split�list�allr)rrArV�oks    r�ensure_string_listzCommand.ensure_string_list�s����d�F�#�#���;��F�
��S�
!�
!�
	'��D�&�"�(�;��"<�"<�=�=�=�=�=��#�t�$�$�
��9�9�S�9�9�9�9�9������
'�*�*�������&�'�'�'�
'�
'rc��|�|||��}|�"||��std|z||fz���dSdS)Nzerror in '%s' option: )rWr)rrA�testerrT�	error_fmtrUrVs       r�_ensure_tested_stringzCommand._ensure_tested_string�s[���%�%�f�d�G�<�<���?�6�6�#�;�;�?�&�(@�9�(L�*0�#��(7�8�8�
8��?�?�?rc�T�|�|tjjdd��dS)z5Ensure that 'option' is the name of an existing file.�filenamez$'%s' does not exist or is not a fileN)rk�os�path�isfile�rrAs  r�ensure_filenamezCommand.ensure_filename�s7���"�"�6�2�7�>�#-�#I�	K�	K�	K�	K�	Krc�T�|�|tjjdd��dS)Nzdirectory namez)'%s' does not exist or is not a directory)rkrnro�isdirrqs  r�ensure_dirnamezCommand.ensure_dirnames7���"�"�6�2�7�=�#3�#N�	P�	P�	P�	P�	Prc�H�t|d��r|jS|jjS)N�command_name)�hasattrrwr�__name__r,s rr:zCommand.get_command_name	s(���4��(�(�	+��$�$��>�*�*rc	���|j�|��}|���|D]4\}}t||���t	||t||�����5dS)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)r�get_command_objr-r#rR)r�src_cmd�option_pairs�src_cmd_obj�
src_option�
dst_options      r�set_undefined_optionszCommand.set_undefined_optionss{���'�7�7��@�@���$�$�&�&�&�(4�	L�	L�$�Z���t�Z�(�(�0���j�'�+�z�*J�*J�K�K�K��	L�	Lrc�d�|j�||��}|���|S)z�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.
        )rr{r-)r�command�create�cmd_objs    r�get_finalized_commandzCommand.get_finalized_command$s3���#�3�3�G�V�D�D��� � �"�"�"��rrc�8�|j�||��Sr])r�reinitialize_command)rr��reinit_subcommandss   rr�zCommand.reinitialize_command0s%��� �5�5�g�6H�J�J�	Jrc�:�|j�|��dS)z�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)r�run_command)rr�s  rr�zCommand.run_command4s!��
	
��%�%�g�.�.�.�.�.rc�h�g}|jD]'\}}|�||��r|�|���(|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.
        )�sub_commands�append)r�commands�cmd_name�methods    r�get_sub_commandszCommand.get_sub_commands;sI����"&�"3�	*�	*��X�v��~������~�����)�)�)���rc�V�tjd|���|��dS)Nzwarning: %s: %s
)r
�warnr:)rrGs  rr�zCommand.warnKs)����$�d�&;�&;�&=�&=�s�C�C�C�C�Crc�@�tj||||j���dS�N�r!)r�executer!)r�func�argsrGr6s     rr�zCommand.executeNs#����T�4��d�l�;�;�;�;�;�;r�c�>�tj|||j���dSr�)r�mkpathr!)r�name�modes   rr�zCommand.mkpathQs!�����d�D�L�9�9�9�9�9�9rc	�N�tj|||||j||j���S)z�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.)r�)r�	copy_filerr!)r�infile�outfile�
preserve_mode�preserve_times�linkr6s       rr�zCommand.copy_fileTs4��
�"�6�7�M�#1�t�z�>�4�+/�<�9�9�9�	9rc	�N�tj||||||j|j���S)z\Copy an entire directory tree respecting verbose, dry-run,
        and force flags.
        r�)r�	copy_treerr!)rr�r�r�r��preserve_symlinksr6s       rr�zCommand.copy_tree]s9��
�!�&�'�=�"0�2C�&*�j�.�$�,�H�H�H�	Hrc�:�tj|||j���S)z$Move a file respecting dry-run flag.r�)r�	move_filer!)r�src�dstr6s    rr�zCommand.move_filefs���"�3��T�\�B�B�B�Brc�8�ddlm}||||j���dS)z2Spawn an external command respecting dry-run flag.r)�spawnr�N)�distutils.spawnr�r!)r�cmd�search_pathr6r�s     rr�z
Command.spawnjs3��)�)�)�)�)�)�
��c�;���5�5�5�5�5�5rc	�B�tj|||||j||���S)N)r!�owner�group)r�make_archiver!)r�	base_name�format�root_dir�base_dirr�r�s       rr�zCommand.make_archiveos2���(��F�H�h�15��/4�E�C�C�C�	Crc�j�|�d|z}t|t��r|f}n+t|ttf��st	d���|�d|�dd�|����}|jstj||��r|�	||||��dStj|��dS)a�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.
        Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating z from z, )rrSrd�tupler�joinrr�newer_groupr�r
�debug)r�infilesr�r�r��exec_msg�skip_msgr6s        r�	make_filezCommand.make_fileus�����7�'�A�H��g�s�#�#�	O��j�G�G��G�d�E�]�3�3�	O��M�O�O�
O����29�'�'�4�9�9�W�;M�;M�;M�N�H�
�:�	 ��-�g�w�?�?�	 ��L�L��t�X�u�5�5�5�5�5�
�I�h�����r)Nr3)r*r])rr))r�)r*r*Nr*)r*r*rr*)r*r*)NNNN)NNr*)#ry�
__module__�__qualname__�__doc__r�rr'r-rr+rCrEr;rOrWrZrgrkrrrur:r�r�r�r�r�r�r�r�r�r�r�r�r�r��rrrrsw������
�
�:�L�
-�-�-�`'�'�'����$-�-�-�-�-�-�*�*�*�*�-�-�-��������.����;�;�;�;�'�'�'�,'+�8�8�8�8�K�K�K�P�P�P�+�+�+�L�L�L�*����J�J�J�J�/�/�/���� D�D�D�<�<�<�<�:�:�:�:�JK�#$�9�9�9�9�JK�./�H�H�H�H�C�C�C�C�6�6�6�6�
GK�'+�C�C�C�C�78� � � � � � rr)r�rLrnrb�distutils.errorsr�	distutilsrrrrrr
rr�rr�<module>r�s�����������������1�1�1�1�1�1�G�G�G�G�G�G�G�G�G�G�G�G�G�G�������G �G �G �G �G �G �G �G �G �G r

Zerion Mini Shell 1.0