관리-도구
편집 파일: cmd.cpython-312.pyc
� t��e�E � �p � d Z ddlZddlZddlZddlZddlmZ ddlmZm Z m Z mZmZ ddl mZ G d� d� Zy) 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� _modified��logc � � e Zd ZdZg Zd� Zd� Zd� Zd� Zd� Z d!d�Z d � Zej fd �Zd� Zd"d�Zd"d �Zd� Zd"d�Zd� Zd� Zd� Zd� Zd#d�Zd$d�Zd� Zd� Zd� Zd%d�Zd&d�Z d'd�Z d(d�Z d#d�Z!d)d�Z" d*d�Z# d+d �Z$y),�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 � � ddl m} t ||� st d� �| j t u rt d� �|| _ | j � d| _ |j | _ d| _ d| _ d| _ y)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�distr s ��/builddir/build/BUILDROOT/alt-python312-setuptools-69.0.2-1.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/setuptools/_distutils/cmd.py�__init__zCommand.__init__3 sz � � 0��$��-��B�C�C��>�>�W�$��=�>�>� ������!� �� � �|�|��� �� � �� � ��� c �t � |dk( r)t | d|z � }|�t | j |� S |S t |� �)N�dry_run�_)�getattrr �AttributeError)r �attr�myvals r �__getattr__zCommand.__getattr__c sB � ��9���D�#��*�-�E��}��t�0�0�$�7�7��� ��&�&r c �J � | j s| j � d| _ y �Nr )r �finalize_options�r s r �ensure_finalizedzCommand.ensure_finalizedm s � ��~�~��!�!�#���r c �2 � t d| j z � �)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�r r r, s r r zCommand.initialize_options � � � �:�T�^�^�K� � r c �2 � t d| j z � �)a 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. r/ r0 r, s r r+ zCommand.finalize_options� s � � �:�T�^�^�K� � r Nc �r � ddl m} |�d| j � z }| j ||z t j �� |dz }| j D ]d \ }}}|j |� }|d dk( r|d d }t | |� }| j |dj ||� z t j �� �f y ) Nr )� longopt_xlatezcommand options for '%s':)�levelz ����=z{} = {}) �distutils.fancy_getoptr4 �get_command_name�announce�logging�INFO�user_options� translater$ �format)r �header�indentr4 �optionr# �values r �dump_optionszCommand.dump_options� s� � �8��>�0�4�3H�3H�3J�J�F�� � �f�v�o�W�\�\� �:��$��� �-�-� X�L�F�A�q��%�%�m�4�F��b�z�S� �������D�&�)�E��M�M�&�9�#3�#3�F�E�#B�B�'�,�,�M�W� Xr c �2 � t d| j z � �)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/ r0 r, s r �runzCommand.run� r1 r c �0 � t j ||� y �Nr )r �msgr5 s r r: zCommand.announce� s � �����s�r c �h � ddl m} |r*t |� t j j � yy)z~Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true. r )�DEBUGN)�distutils.debugrK �print�sys�stdout�flush)r rI rK s r �debug_printzCommand.debug_print� s&