Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
cmd.cpython-313.pyc193 linesDownload Raw Back to __pycache__
1�

2��j`S���SrSSKJr SSKrSSKrSSKrSSKrSSKJr SSK	J3r4Jr SSKJ
r
JrJrJrJr SSKJrJrJrJrJr SS	KJr SS5KJr \
(aSSKJr SSKJrJ r  \"S
5r!\"SSS9r"\"SSS9r#\"SSS9r$"SS5r%g)ztdistutils.cmd6 7Provides the Command class, the base class for the command classes8in the distutils.command package.9�)�annotationsN)�abstractmethod)�Callable�MutableSequence)�
TYPE_CHECKING�Any�ClassVar�TypeVar�overload�)�	_modified�archive_util�dir_util�	file_util�util��log)�DistutilsOptionError��Distribution)�TypeVarTuple�Unpack�_Ts�	_StrPathT�str | os.PathLike[str])�bound�_BytesPathT�bytes | os.PathLike[bytes]�	_CommandT�Commandc��\rSrSr%Sr/rS\S'/rS\S'S.SjrS/Sjr	\10S/S	j5r\11S/S12j5rS0Sjr
\13S/S
j5r\R 4S1SjjrS2SjrS3SjrS3S4SjjrS5SjrS3SjrS5SjrS5SjrS6SjrS7SjrS8S9Sjjr\S:S;Sjj5r\S:S<Sjj5rS:S=SjjrS>SjrS?SjrS2Sjr S@SASjjr!SBSCS jjr"\SDSES!jj5r#\SDSFS"jj5r#SDSGS#jjr#SHSIS$jjr$\SJSKS%jj5r%\SJSLS&jj5r%SJSMS'jjr%SNSOS(jjr&\SPSQS)jj5r'\SRSSS*jj5r'SPSTS+jjr'SUSVS,jjr(S-r)g)Wr �"aIAbstract base class for defining command classes, the "worker bees"14of the Distutils.  A useful analogy for command classes is to think of15them as subroutines with local variables called "options".  The options16are "declared" in 'initialize_options()' and "defined" (given their17final values, aka "finalized") in 'finalize_options()', both of which18must be defined by every command class.  The distinction between the19two is necessary because option values might come from the outside20world (command line, config file, ...), and any options dependent on21other options must be computed *after* these outside influences have22been processed -- hence 'finalize_options()'.  The "body" of the23subroutine, where it does all its work based on the values of its24options, is the 'run()' method, which must also be implemented by every25command class.26z8ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]�sub_commandszHClassVar[list[tuple[str, str, str]] | list[tuple[str, str | None, str]]]�user_optionsc���SSKJn [X5(d[S5eUR[27La[
S5eXlUR5 URUl	SUl28SUlSUlg)z�Create and initialize a new Command object.  Most importantly,29invokes the 'initialize_options()' method, which is the real30initializer and depends on the actual command being31instantiated.32rrz$dist must be a Distribution instancezCommand is an abstract classNF)
�distutils.distr�33isinstance�	TypeError�	__class__r �RuntimeError�distribution�initialize_options�verbose�force�help�	finalized)�self�distrs   �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\setuptools/_distutils/cmd.py�__init__�Command.__init__Ksp��	0��$�-�-��B�C�C��>�>�W�$��=�>�>� �����!��|�|�����34���	����c�T�UR(dUR5 SUlg)NT)r0�finalize_options�r1s r3�ensure_finalized�Command.ensure_finalizedus���~�~��!�!�#���r6c�4�[SURS35e)a�Set default values for all the options that this command35supports.  Note that these defaults may be overridden by other36commands, by the setup script, by config files, or by the37command-line.  Thus, this is not the place to code dependencies38between options; generally, 'initialize_options()' implementations39are just a bunch of "self.foo = None" assignments.40 41This method must be implemented by all command classes.42�abstract method -- subclass � must override�r*r)r9s r3r,�Command.initialize_options��"���*�4�>�>�*:�.�I�43�	44r6c�4�[SURS35e)a�Set final values for all the options that this command supports.45This is always called as late as possible, ie.  after any option46assignments from the command-line or from other commands have been47done.  Thus, this is the place to code option dependencies: if48'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as49long as 'foo' still has the same value it was assigned in50'initialize_options()'.51 52This method must be implemented by all command classes.53r=r>r?r9s r3r8�Command.finalize_options�s"���*�4�>�>�*:�.�I�54�	55r6Nc�T�SSKJn UcSUR5S3nURX!-[R56S9 US-nURHVun nURU5nUSS:XaUSSn[X5nURX$S	U3-[R57S9 MX g)58Nr)�
longopt_xlatezcommand options for 'z':)�levelz  ������=z = )	�distutils.fancy_getoptrE�get_command_name�announce�logging�INFOr$�	translate�getattr)r1�header�indentrE�option�_�values       r3�dump_options�Command.dump_options�s���8��>�,�T�-B�-B�-D�,E�R�H�F��
�
�f�o�W�\�\�
�:��$��� �-�-�L�F�A�q��%�%�m�4�F��b�z�S� �������D�)�E��M�M�&�X�S���#8�8����M�M�.r6c�4�[SURS35e)a�A command's raison d'etre: carry out the action it exists to59perform, controlled by the options initialized in60'initialize_options()', customized by other commands, the setup61script, the command-line, and config files, and finalized in62'finalize_options()'.  All terminal output and filesystem63interaction should be done by 'run()'.64 65This method must be implemented by all command classes.66r=r>r?r9s r3�run�Command.run�rAr6c�0�[R"X!5 g�Nr)r1�msgrFs   r3rK�Command.announce�s������r6c�r�SSKJn U(a*[U5 [RR5 gg)znPrint 'msg' to stdout if the global DEBUG (taken from the67DISTUTILS_DEBUG environment variable) flag is true.68r)�DEBUGN)�distutils.debugr_�print�sys�stdout�flush)r1r\r_s   r3�debug_print�Command.debug_print�s&��	*���#�J��J�J����r6c	��[X5nUc[XU5 U$[U[5(d[	SUSUSUS35eU$)N�'z' must be a z (got `z`))rO�setattrr'�strr)r1rR�what�default�vals     r3�_ensure_stringlike�Command._ensure_stringlike�sS���d�#���;��D�'�*��N��C��%�%�&��6�(�,�t�f�G�C�5�PR�'S�T�T��69r6c�*�URUSU5 g)zGEnsure that 'option' is a string; if not defined, set it to70'default'.71�stringN)rn)r1rRrls   r3�
ensure_string�Command.ensure_string�s��	
�����'�:r6c��[X5nUcg[U[5(a"[X[R72"SU55 g[U[5(a[SU55nOSnU(d[SUSU<S35eg)z�Ensure that 'option' is a list of strings.  If 'option' is73currently a string, we split it either on /,\s*/ or /\s+/, so74"foo bar baz", "foo,bar,baz", and "foo,   bar baz" all become75["foo", "bar", "baz"].76Nz,\s*|\s+c3�B# �UHn[U[5v� M g7fr[)r'rj)�.0�vs  r3�	<genexpr>�-Command.ensure_string_list.<locals>.<genexpr>�s���9�S���A�s�+�+�S�s�Frhz!' must be a list of strings (got �))	rOr'rjri�re�split�list�allr)r1rRrm�oks    r3�ensure_string_list�Command.ensure_string_list�s����d�#���;��
��S�
!�
!��D�"�(�(�;��"<�=��#�t�$�$��9�S�9�9�����*���x�@���q�I���r6c�n�URXU5nUb U"U5(d[SU-X4-5egg)Nzerror in '%s' option: )rnr)r1rR�testerrk�	error_fmtrlrms       r3�_ensure_tested_string�Command._ensure_tested_stringsD���%�%�f�G�<���?�6�#�;�;�&�)�I�5�&��F��
�$/�?r6c�\�URU[RRSS5 g)z5Ensure that 'option' is the name of an existing file.�filenamez$'%s' does not exist or is not a fileN)r��os�path�isfile�r1rRs  r3�ensure_filename�Command.ensure_filenames"���"�"��B�G�G�N�N�J�0V�	77r6c�\�URU[RRSS5 g)Nzdirectory namez)'%s' does not exist or is not a directory)r�r�r��isdirr�s  r3�ensure_dirname�Command.ensure_dirnames$���"�"���G�G�M�M��7�		78r6c�h�[US5(aUR$URR$)N�command_name)�hasattrr�r)�__name__r9s r3rJ�Command.get_command_names+���4��(�(��$�$�$��>�>�*�*�*r6c	��URRU5nUR5 UH(upE[X5bM[	X[X455 M* g)a�Set the values of any "undefined" options from corresponding79option values in some other command object.  "Undefined" here means80"is None", which is the convention used to indicate that an option81has not been changed between 'initialize_options()' and82'finalize_options()'.  Usually called from 'finalize_options()' for83options that depend on some other command rather than another84option of the same command.  'src_cmd' is the other command from85which option values will be taken (a command object will be created86for it if necessary); the remaining arguments are87'(src_option,dst_option)' tuples which mean "take the value of88'src_option' in the 'src_cmd' command object, and copy it to89'dst_option' in the current command object".90N)r+�get_command_objr:rOri)r1�src_cmd�option_pairs�src_cmd_obj�91src_option�92dst_options      r3�set_undefined_options�Command.set_undefined_optionssM��"�'�'�7�7��@���$�$�&�&2�"�J��t�(�0���'�+�*J�K�'3r6c�\�URRX5nUR5 U$)z�Wrapper around Distribution's 'get_command_obj()' method: find93(create if necessary and 'create' is true) the command object for94'command', call its 'ensure_finalized()' method, and return the95finalized command object.96)r+r�r:)r1�command�create�cmd_objs    r3�get_finalized_command�Command.get_finalized_command7s+���#�#�3�3�G�D��� � �"��r6c��gr[��r1r��reinit_subcommandss   r3�reinitialize_command�Command.reinitialize_commandCs��r6c��gr[r�r�s   r3r�r�Gs��r6c�8�URRX5$r[)r+r�r�s   r3r�r�Ks��� � �5�5�g�R�Rr6c�:�URRU5 g)z�Run some other command: uses the 'run_command()' method of97Distribution, which creates and finalizes the command object if98necessary and then invokes its 'run()' method.99N)r+�run_command)r1r�s  r3r��Command.run_commandPs��100	
���%�%�g�.r6c�z�/nURH(up#UbU"U5(dMURU5 M* U$)aCDetermine the sub-commands that are relevant in the current101distribution (ie., that need to be run).  This is based on the102'sub_commands' class attribute: each tuple in that list may include103a method that we call to determine if the subcommand needs to be104run for the current distribution.  Return a list of command names.105)r#�append)r1�commands�cmd_name�methods    r3�get_sub_commands�Command.get_sub_commandsWs<���� $� 1� 1��H��~���������)�!2��r6c�P�[R"SUR5U5 g)Nzwarning: %s: %s106)r�warningrJ)r1r\s  r3�warn�Command.warnfs�����'��)>�)>�)@�#�Fr6c�2�[R"XU5 gr[)r�execute)r1�func�argsr\rFs     r3r��Command.executeis��	
���T��%r6c�0�[R"X5 gr[)r�mkpath)r1�name�modes   r3r��Command.mkpathrs������#r6c��gr[r��r1�infile�outfile�
preserve_mode�preserve_times�linkrFs       r3�	copy_file�Command.copy_fileus��(+r6c��gr[r�r�s       r3r�r�s��,/r6c�V�[R"UUUUUR(+U5$)z�Copy a file respecting verbose, dry-run and force flags.  (The107former two default to whatever is in the Distribution object, and108the latter defaults to false for commands that don't define it.))rr�r.r�s       r3r�r��s/���"�"������109�110�N��
111�	112r6c�V�[R"UUUUUUR(+5$)zLCopy an entire directory tree respecting verbose, dry-run,113and force flags.114)r�	copy_treer.)r1r�r�r�r��preserve_symlinksrFs       r3r��Command.copy_tree�s/���!�!�������115�116�N�
117�	118r6c��gr[r��r1�src�dstrFs    r3�	move_file�Command.move_file�s��r6c��gr[r�r�s    r3r�r��s��"r6c�.�[R"X5$)z$Move a file respecting dry-run flag.)rr�r�s    r3r�r��s���"�"�3�,�,r6c� �SSKJn U"X5 g)z2Spawn an external command respecting dry-run flag.r)�spawnN)�distutils.spawnr�)r1�cmd�search_pathrFr�s     r3r��
Command.spawn�s��	*�
�c�r6c��gr[r��r1�	base_name�format�root_dir�base_dir�owner�groups       r3�make_archive�Command.make_archive����r6c��gr[r�r�s       r3r�r��r�r6c	�4�[R"UUUUUUS9$)N)r�r�)rr�r�s       r3r�r��s)���(�(�������
119�	120r6c��UcSUS3n[U[5(aU4nO&[U[[45(d[	S5eUc!SRUSR
U55nUR(d[R"X5(aURX4XW5 g[R"U5 g)a�Special case of 'execute()' for operations that process one or121more input files and generate one output file.  Works just like122'execute()', except the operation is skipped and a different123message printed if 'outfile' already exists and is newer than all124files listed in 'infiles'.  If the command defined 'self.force',125and it is true, then the command is unconditionally run -- does no126timestamp checks.127Nz	skipping z (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating {} from {}z, )
r'rjr}�tupler(r��joinr.r
�newer_groupr�r�debug)r1�infilesr�r�r��exec_msg�skip_msgrFs        r3�	make_file�Command.make_file�s���$��"�7�)�+>�?�H��g�s�#�#��j�G��G�d�E�]�3�3��W�X�X���.�5�5�g�t�y�y��?Q�R�H�128�:�:��.�.�w�@�@��L�L��X�5�
�I�I�h�r6)r+r0r.r/r-)r2r�return�None)r�r�)N�)r\�objectrF�intr�r�)r\r�r�r�r[)rRrjrl�129str | Noner�r�)rRrjr�r�)r�rj)r�rjr�ztuple[str, str]r�r�)T)r�rjr��boolr�r )F)r�rjr�rr�r )r�rr�rr�r)r�z
str | Commandr�r )r�rjr�r�)r��	list[str])Nr)130r��Callable[[Unpack[_Ts]], object]r��tuple[Unpack[_Ts]]r\r�rFr�r�r�)i�)r�rjr�r�r�r�)TTNr)r�rr�rr�rr�rr�rrFr�r�ztuple[_StrPathT | str, bool])r�rr�rr�rr�rr�rrFr�r�z tuple[_BytesPathT | bytes, bool])r��3str | os.PathLike[str] | bytes | os.PathLike[bytes]r�rr�rr�rr�rrFr�r�z@tuple[str | os.PathLike[str] | bytes | os.PathLike[bytes], bool])TTFr)r�rr�rjr�rr�rr�rrFr�r�r)r)r�rr�rrFr�r�z_StrPathT | str)r�rr�rrFr�r�z_BytesPathT | bytes)r�rr�rrFr�r�r)Tr)r�zMutableSequence[str]r�rrFr�r�r�)NNNN)r�rjr�rjr��:str | os.PathLike[str] | bytes | os.PathLike[bytes] | Noner�rr�rr�rr�rj)NNN)r�rr�rjr�rr�rr�rr�rr�rj)r�rr�rjr�rr�rr�rr�rr�rj)NNr)r�z!str | list[str] | tuple[str, ...]r�rr�rr�rr�r�r�r�rFr�r�r�)*r��131__module__�__qualname__�__firstlineno__�__doc__r#�__annotations__r$r4r:rr,r8rUrXrLr_rKrernrrr�r�r�r�rJr�r�rr�r�r�r�r�r�r�r�r�r�r�r��__static_attributes__r�r6r3r r "sw��
�>	����	����(�T�$�132��133��
134��
135�N��136��137�29�����.�;��*�138�139�+�L��L�+:�L�	
�L�2��7<����04��	�����=B�� ��6:��	����:?�S�$�S�	�S�140/��G���&�-�&�!�&��	&�141�&�142�
&�$��143#�#���+�&�+��+��	+�144�+��
+��+�145&�+��+��146#�#���/�*�/��/��	/�147�/��
/��/�148*�/��/�#�#���149�C�150�E�151��	152�153�154��
155��156�157J�158�2#�#�"'��159�&�160��161��	162�163�164� �
165��166�167�168�*�HI��)��09��BE��	�����NO�"�-�"�4?�"�HK�"�	�"��"��	-�
@�-�A�-��	-�169170=�-�QR� �'� �6:� �JM� �	
� ��171PT�#� � ������M�	�172���
���173
����� $� � ��)����F�	�174���
���175
����PT�#� � �176�)�177��178�M�	179�180�181��
182��183�184
�185�0 ���% �2�% �E�% �.�	% �186!�% ��
% ��% ��% �187�% �% r6)&r188�189__future__rrLr�r{rb�abcr�collections.abcrr�typingrrr	r190rr�r
rrrr�_logr�errorsrr&r�typing_extensionsrrrrrrr r�r6r3�<module>rsx���#��	�	�191��5�B�B�@�@��(��+�6�192�u�193�C��K�'?�@�	��m�+G�H���K�y�1�	�u �u r6
codekingpro/portable-devtools · Team Ai