� ,�Re�E� ���dZddlZddlZddlZddlZddlmZmZdZej dez��Z ej d� ee����Z e �dd ��ZGd �d ��Zd �Zd �ejD��Zd�Zd�ZGd�d��ZedkrGdZdD]DZedez��ed�eee������e���CdSdS)a6distutils.fancy_getopt Wrapper around the standard getopt module that provides the following additional features: * short and long options are tied together * options have help strings, so fancy_getopt could potentially create a complete usage summary * options set attributes of a passed-in object �N�)�DistutilsGetoptError�DistutilsArgErrorz[a-zA-Z](?:[a-zA-Z0-9-]*)z^%s$z ^({})=!({})$�-�_c�p�eZdZdZdd�Zd�Zd�Zdd�Zd�Zd�Z d �Z d �Z d �Z d �Z dd �Zd�Zdd�Zdd�ZdS)� FancyGetopta�Wrapper around the standard 'getopt()' module that provides some handy extra functionality: * short and long options are tied together * options have help strings, and help text can be assembled from them * options set attributes of a passed-in object * boolean options can have "negative aliases" -- eg. if --quiet is the "negative alias" of --verbose, then "--quiet" on the command line sets 'verbose' to false Nc���||_i|_|jr|���i|_i|_g|_g|_i|_i|_i|_ g|_ dS�N) � option_table� option_index� _build_index�alias�negative_alias� short_opts� long_opts� short2long� attr_name� takes_arg� option_order��selfr s ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/_distutils/fancy_getopt.py�__init__zFancyGetopt.__init__,s{��)������ � � � � � � � � ��� �!��� ��������������� �����c�l�|j���|jD]}||j|d<�dS)Nr)r �clearr )r�options rrzFancyGetopt._build_indexTsG�� ����!�!�!��'� 2� 2�F�+1�D� �f�Q�i� (� (� 2� 2rc�<�||_|���dSr )r rrs r�set_option_tablezFancyGetopt.set_option_tableYs"��(��� �������rc��||jvrtd|z���|||f}|j�|��||j|<dS)Nz'option conflict: already an option '%s')r rr �append)r� long_option� short_option� help_stringrs r� add_optionzFancyGetopt.add_option]sb�� �$�+� +� +�&�9�K�G��� �"�<��=�F� � � $� $�V� ,� ,� ,�-3�D� �k� *� *� *rc��||jvS)zcReturn true if the option table for this parser has an option with long name 'long_option'.)r �rr#s r� has_optionzFancyGetopt.has_optiongs���d�/�/�/rc�6�|�t��S)z�Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.�� translate� longopt_xlater(s r� get_attr_namezFancyGetopt.get_attr_namels���$�$�]�3�3�3rc ���t|t��sJ�|���D]I\}}||jvrt d|�d|�d|�d����||jvrt d|�d|�d|�d�����JdS)Nzinvalid z 'z ': option 'z ' not defined�': aliased option ')� isinstance�dict�itemsr r)r�aliases�whatr�opts r�_check_alias_dictzFancyGetopt._check_alias_dictrs����'�4�(�(�(�(�(�#�M�M�O�O� � �L�U�C��D�-�-�-�*�*��t�t�U�U�U�E�E�E�+�����$�+�+�+�*�*��t�t�U�U�U�C�C�C�)����,� � rc�@�|�|d��||_dS)z'Set the aliases for this option parser.rN)r7r)rrs r� set_aliaseszFancyGetopt.set_aliases�s#�� ���u�g�.�.�.��� � � rc�@�|�|d��||_dS)z�Set the negative aliases for this option parser. 'negative_alias' should be a dictionary mapping option names to option names, both the key and value must already be defined in the option table.znegative aliasN)r7r)rrs r�set_negative_aliasesz FancyGetopt.set_negative_aliases�s)�� ���~�/?�@�@�@�,����rc���g|_g|_|j���i|_|jD�]4}t |��dkr |\}}}d}n=t |��dkr|\}}}}n"td�|�����t|t��rt |��dkrtd|z���|�:t|t��rt |��dkstd |z���||j|<|j� |��|d d kr|r|d z}|dd �}d|j |<nS|j�|��}|�-|j |rtd |�d|�d����||jd <d|j |<|j�|��}|�2|j ||j |krtd|�d|�d����t"�|��std|z���|�|��|j|<|r*|j� |��||j|d<��6dS)z�Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. �r�zinvalid option tuple: {!r}�z9invalid long option '%s': must be a string of length >= 2Nrz:invalid short option '%s': must a single character or None������=�:zinvalid negative alias 'r0z' takes a valuezinvalid alias 'z%': inconsistent with aliased option 'z/' (one of them takes a value, the other doesn'tzEinvalid long option name '%s' (must be letters, numbers, hyphens only)rrrr�repeatr �len� ValueError�formatr1�strrr"rr�getr� longopt_re�matchr.r)rr�long�short�helprC�alias_tos r�_grok_option_tablezFancyGetopt._grok_option_table�s��� ������ ��������� ��'�F 1�F 1�F��6�{�{�a���$*�!��e�T�����V����!�!�,2�)��e�T�6�6�!�!=�!D�!D�V�!L�!L�M�M�M��d�C�(�(� �C��I�I��M�M�*�S������ �]� �5�#�(>�(>�]�3�u�:�:�QR�?�?�*�6�8=�>���� !'�D�K�� � �N� !� !�$� '� '� '��B�x�3����(�!�C�K�E��A�b�D�z��'(���t�$�$� �.�2�2�4�8�8���'��~�h�/��2�2�CG�4�4����S���� *.�D�N�2�&�'(���t�$��z�~�~�d�+�+�H��#��>�$�'�4�>�(�+C�C�C�.�.�04�t�t�X�X�X�?�����#�#�D�)�)� �*�>�@D�E���� $(�#5�#5�d�#;�#;�D�N�4� �� 1���&�&�u�-�-�-�,0����a��)��MF 1�F 1rc��|�tjdd�}|�t��}d}nd}|���d�|j��} t j|||j��\}}n&#t j$r}t|���d}~wwxYw|D�].\}}t|��dkr |ddkr|j |d}n-t|��dkr|dd�d ksJ�|dd�}|j � |��} | r| }|j|s3|d ks Jd ���|j� |��} | r| }d}nd}|j|} |r.|j� | ���t%|| d��dz}t'|| |��|j�||f����0|r||fS|S) aParse command-line options in args. Store as attributes on object. If 'args' is None or not supplied, uses 'sys.argv[1:]'. If 'object' is None or not supplied, creates a new OptionDummy object, stores option values there, and returns a tuple (args, object). If 'object' is supplied, it is modified in place and 'getopt()' just returns 'args'; in both cases, the returned 'args' is a modified copy of the passed-in 'args' list, which is left untouched. NrTF� r?rrz--�zboolean option can't have value)�sys�argv� OptionDummyrO�joinr�getoptr�errorrrDrrrHrrrrC�getattr�setattrrr") r�args�object�created_objectr�opts�msgr6�valr�attrs rrWzFancyGetopt.getopt�s�� �<��8�A�B�B�<�D� �>� �]�]�F�!�N�N�"�N� ���!�!�!��X�X�d�o�.�.� � )���t�Z���H�H�J�D�$�$���|� )� )� )�#�C�(�(� (����� )����� 1� 1�H�C���3�x�x�1�}�}��Q��3����o�c�!�f�-����3�x�x�!�|�|��B�Q�B��4������!�"�"�g���J�N�N�3�'�'�E�� ����>�#�&� ��b�y�y�y�"C�y�y�y��+�/�/��4�4�����C��C�C��C��>�#�&�D�� 3�t�{���t�,�,�8��f�d�A�.�.��2�� �F�D�#� &� &� &� � � $� $�c�3�Z� 0� 0� 0� 0� � ���<� ��Ks�A:�:B� B�Bc�<�|j�td���|jS)z�Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet. Nz!'getopt()' hasn't been called yet)r� RuntimeError)rs r�get_option_orderzFancyGetopt.get_option_orders%�� � � $��B�C�C� C��$� $rc���d}|jD]A}|d}|d}t|��}|ddkr|dz }|�|dz}||kr|}�B|dzdzdz}d}||z } d |z} |r|g} nd g} |jD]�}|dd �\}}} t| | ��} |ddkr |dd�}|�?| r"| �d ||| dfz��nm| �d ||fz��nRd�||��}| r"| �d ||| dfz��n| �d|z��| dd�D]}| �| |z�����| S)z�Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object. rrr@rAN�r?�NrQzOption summary:r=z --%-*s %sz --%-*s z{} (-{})z --%-*s)r rD� wrap_textr"rF)r�header�max_optrrKrL�ell� opt_width� line_width� text_width� big_indent�linesrM�text� opt_namess r� generate_helpzFancyGetopt.generate_help&s������'� � �F��!�9�D��1�I�E��d�)�)�C��B�x�3����A�g��� ��A�g���W�}�}�����a�K�!�O�a�'� �0� ��)�+� ��9�_� � � (��H�E�E�&�'�E��'� /� /�F� &�r��r� � �D�%���T�:�.�.�D��B�x�3����A�b�D�z���}��A��L�L��7�D�$�q�'�2J�!J�K�K�K�K��L�L���$��!?�@�@�@�@� '�-�-�d�E�:�:� ��9��L�L��7�I�t�A�w�2O�!O�P�P�P�P��L�L��i�!7�8�8�8��A�B�B�x� /� /��� � �Z�#�-�.�.�.�.� /�� rc��|� tj}|�|��D]}|�|dz���dS)N� )rS�stdoutrs�write)rri�file�lines r� print_helpzFancyGetopt.print_helptsN�� �<��:�D��&�&�v�.�.� $� $�D� �J�J�t�d�{� #� #� #� #� $� $rr )NN)�__name__� __module__� __qualname__�__doc__rrr r&r)r.r7r9r;rOrWrdrsrz�rrr r s������ � �&�&�&�&�P2�2�2� ���4�4�4�4�0�0�0� 4�4�4� � � ���� -�-�-�P1�P1�P1�d;�;�;�;�z%�%�%�L�L�L�L�\$�$�$�$�$�$rr c�v�t|��}|�|��|�||��Sr )r r;rW)�options� negative_optr\r[�parsers r� fancy_getoptr�{s7�� �� !� !�F� ��� �-�-�-� �=�=��v� &� &�&rc�.�i|]}t|��d��S)rQ)�ord)�.0�_wschars r� r��s �� ?� ?� ?�'�C��L�L�#� ?� ?� ?rc��|�gSt|��|kr|gS|���}|�t��}t jd|��}d�|D��}g}|r�g}d}|r\t|d��}||z|kr$|�|d��|d=||z}n|r|dddkr|d=n|�\|rQ|dkr6|�|dd|���|d|d�|d<|dddkr|d=|�d�|����|��|S)z�wrap_text(text : string, width : int) -> [string] Split 'text' into multiple lines of no more than 'width' characters each, and return the list of strings that results. Nz( +|-+)c��g|]}|�|��Srr)r��chs r� zwrap_text..�s�� (� (� (�R�R� (�b� (� (� (rrr@rQrR)rD� expandtabsr,�WS_TRANS�re�splitr"rV)rq�width�chunksrp�cur_line�cur_lenrks rrhrh�s���  �|�� � �4�y�y�E����v� � �?�?� � �D� �>�>�(� #� #�D� �X�j�$� '� '�F� (� (�6� (� (� (�F� �E� � (������ ��f�Q�i�.�.�C���}��%�%�����q� �*�*�*��1�I�!�C�-����%��� �Q��3� 6� 6� �� ��� � � ��!�|�|�����q� �!�E�'� 2�3�3�3�"�1�I�e�f�f�-��q� � �a�y��|�s�"�"��1�I� � � �R�W�W�X�&�&�'�'�'�A � (�D �Lrc�6�|�t��S)zXConvert a long option name to a valid Python identifier by changing "-" to "_". r+)r6s r�translate_longoptr��s�� �=�=�� '� '�'rc��eZdZdZgfd�ZdS)rUz_Dummy class just used as a place to hold command-line option values as instance attributes.c�2�|D]}t||d���dS)zkCreate a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.N)rZ)rr�r6s rrzOptionDummy.__init__�s2��� %� %�C� �D�#�t� $� $� $� $� %� %rN)r{r|r}r~rrrrrUrU�s7������&�&� "�%�%�%�%�%�%rrU�__main__z�Tra-la-la, supercalifragilisticexpialidocious. How *do* you spell that odd word, anyways? (Someone ask Mary -- she'll know [or she'll say, "How should I know?"].))� ���(z width: %dru)r~rS�stringr�rW�errorsrr� longopt_pat�compilerIrF� neg_alias_rerG� maketransr-r r�� whitespacer�rhr�rUr{rq�w�printrVrrr�r�s����� � � � � � � � � � � � � � � � �;�;�;�;�;�;�;�;� +� � �R�Z��+�-� .� .� ��r�z�.�/�/� �[�I�I�J�J� �� � �c�3�'�'� �X$�X$�X$�X$�X$�X$�X$�X$�v '�'�'� @� ?�V�->� ?� ?� ?��3�3�3�l(�(�(�%�%�%�%�%�%�%�%� �z��� �D� ���� ��k�A�o���� ��d�i�i� � �$��*�*�+�+�,�,�,� ���������r