� ,�Re�?� �(�dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZdd lmZdd l m!Z!d d l"m#Z$erdd l%m&Z&ddl'm(Z(ddl)m*Z*ej+Z,ee-ej.fZ/ed��Z0edd���Z1Gd�d��Z2 d@dee-dee/dee-fd�Z3d@dee-e4ee/fde-fd�Z5dee/dee/fd�Z6dee4e/fde-fd�Z7de/de-fd�Z8 dAd e-d!eee-e-fdee/fd"�Z9d#e-d$ee/de fd%�Z:d&e d#e-defd'�Z;d#e-d!eee-e-fde/dee/ee-e-ffd(�Z< dAd)e-d!eee-e-fdee/defd*�Z= dAd+ee-e-fd!eee-e-fdee/dee-effd,�Z>dddd-�d.eee-e-fdee/dee-fd/�Z?d0e/d1e/de-fd2�Z@d3eeeee-eAfe-fde-fd4�ZBd5eCdeCfd6�ZD d@d7eeEeCfdee/deee-ee-ffd8�ZFdBd:e-dee-eCffd;�ZGGd<�d=��ZHGd>�d?ee0e1f��ZIdS)CaiUtility functions to expand configuration directives or special values (such glob patterns). We can split the process of interpreting configuration files into 2 steps: 1. The parsing the file contents from strings to value objects that can be understand by Python (for example a string with a comma separated list of keywords into an actual Python list of strings). 2. The expansion (or post-processing) of these values according to the semantics ``setuptools`` assign to them (for example a configuration field with the ``file:`` directive should be expanded from a list of file paths to a single string with the contents of those files concatenated) This module focus on the second step, and therefore allow sharing the expansion functions among several configuration file formats. **PRIVATE MODULE**: API reserved for setuptools internal usage only. �N)�iglob)� ConfigParser)� ModuleSpec)�chain) � TYPE_CHECKING�Callable�Dict�Iterable�Iterator�List�Mapping�Optional�Tuple�TypeVar�Union�cast)�Path)� ModuleType)�DistutilsOptionError�)� same_path)� Distribution)�ConfigDiscovery)�DistributionMetadata�_K�_VT)� covariantc�d�eZdZdZdedefd�Zdeee j e j ffd�Z d�Z dS) � StaticModulez>Proxy to a module object that avoids executing arbitrary code.�name�specc���tjtj|j�������}t |���t����|` dS�N) �ast�parse�pathlibr�origin� read_bytes�vars�update�locals�self)r,r r!�modules ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/config/expand.py�__init__zStaticModule.__init__BsP����7�<�� �4�4�?�?�A�A�B�B�� �T� � ���&�(�(�#�#�#� �I�I�I��returnc#���K�|jjD]g�t�tj��r�fd��jD��Ed{V���6t�tj��r�jr�j�jfV��hdS)Nc3�*�K�|] }|�jfV��dSr#��value)�.0�target� statements �r.� z1StaticModule._find_assignments..Js*�����V�V�&�V�Y�_�5�V�V�V�V�V�Vr0) r-�body� isinstancer$�Assign�targets� AnnAssignr5r7)r,r8s @r.�_find_assignmentszStaticModule._find_assignmentsGs��������)� :� :�I��)�S�Z�0�0� :�V�V�V�V�I�DU�V�V�V�V�V�V�V�V�V�V�V��I�s�}�5�5� :�)�/� :� �'���9�9�9�9��  :� :r0c��� t�fd�|���D����S#t$r}t|j�d�����|�d}~wwxYw)zHAttempt to load an attribute "statically", via :func:`ast.literal_eval`.c3��K�|]@\}}t|tj��r!|j�k�*tj|��V��AdSr#)r;r$�Name�id� literal_eval)r6r7r5�attrs �r.r9z+StaticModule.__getattr__..Qsa�������!�F�E��f�c�h�/�/��5;�I��4E�4E�� ��'�'�4E�4E�4E�4E��r0z has no attribute N)�nextr?� Exception�AttributeErrorr )r,rE�es ` r.� __getattr__zStaticModule.__getattr__Ns���� P������%)�%;�%;�%=�%=������ �� � P� P� P� �D�I�!G�!G��!G�!G�H�H�a� O����� P���s�,0� A�A�AN) �__name__� __module__� __qualname__�__doc__�strrr/r rr$�ASTr?rJ�r0r.rr?s~������H�H��S�� ����� :�8�E�#�'�3�7�2B�,C�#D�:�:�:�:� P� P� P� P� Pr0r�patterns�root_dirr1c ����hd�}g}�ptj���|D]�t�fd�|D����r{tj�tj�������}|�t�fd�t|d���D��������tj� ����� tj d��}|� |����|S)aExpand the list of glob patterns, but preserving relative paths. :param list[str] patterns: List of glob patterns :param str root_dir: Path to which globs should be relative (current directory by default) :rtype: list >�*�{�}�?�[�]c3� �K�|]}|�vV�� dSr#rQ)r6�charr5s �r.r9z glob_relative..js'�����9�9��t�u�}�9�9�9�9�9�9r0c3��K�|]B}tj�|����tjd��V��CdS)�/N)�os�path�relpath�replace�sep�r6r`rSs �r.r9z glob_relative..msY�����*>�*>�������h�/�/�7�7����D�D�*>�*>�*>�*>�*>�*>r0T)� recursiver^) r_�getcwd�anyr`�abspath�join�extend�sortedrrarbrc�append)rRrS�glob_characters�expanded_values� glob_pathr`r5s ` @r.� glob_relativerpZs!����5�4�4�O��O��&�2�9�;�;�H�� )� )�� �9�9�9�9��9�9�9� 9� 9� )������� � �X�u�(E�(E�F�F�I� � "� "�6�*>�*>�*>�*>�!�)�t�<�<�<�*>�*>�*>�$>�$>� ?� ?� ?� ?� �7�?�?�5�(�3�3�;�;�B�F�C�H�H�D� � "� "�4� (� (� (� (� �r0� filepathsc����ddlm}tj��ptj������fd�||��D��}d��fd�t|��D����S)z�Return the content of the files concatenated using `` `` as str This function is sandboxed and won't reach anything outside ``root_dir`` (By default ``root_dir`` is the current directory). r)�always_iterablec3�X�K�|]$}tj��|��V��%dSr#)r_r`rirds �r.r9zread_files..�s3�����V�V�4�"�'�,�,�x��.�.�V�V�V�V�V�Vr0� c3�V�K�|]#}t|����t|��V��$dSr#)� _assert_local� _read_filerds �r.r9zread_files..�sO������� � ��x� (� (���4��������r0)� setuptools.extern.more_itertoolsrsr_r`rhrfri�_filter_existing_files)rqrSrs� _filepathss ` r.� read_filesr|ys����A�@�@�@�@�@��w���x�6�2�9�;�;�7�7�H�V�V�V�V�?�?�9�;U�;U�V�V�V�J� �9�9�����*�:�6�6���� � �r0c#�K�|D]>}tj�|��r|V��&tjd|�d����?dS)NzFile z cannot be found)r_r`�isfile�warnings�warn)rqr`s r.rzrz�s_�����<�<�� �7�>�>�$� � � <��J�J�J�J� �M�:�$�:�:�:� ;� ;� ;� ;� <�� 1� 1�+�{� K� K�D� � 8�9�>�+�+�K�8�8�D� �|�!�+�.�.�.� �Kr0r!c���t|d|��}|tjvrtj|Stj�|��}|tj|<|j�|��|S)NrK)r��sys�modulesr�r��module_from_spec�loader� exec_module)r!r�r r-s r.r�r��si�� �4��[� 1� 1�D� �s�{����{�4� � � �^� ,� ,�T� 2� 2�F��C�K����K���F�#�#�#� �Mr0c���|}|�d��}|r�|d|vr�||d}|�dd��}t|��dkr/tj�||d��}|d}n|}d�|g|dd����}n*d|vr&tj�||d��}tjj|g|�d���R�}t |�d�tj�|d��ft|�d �����} td �| D��d��} || |fS) a0Given a module (that could normally be imported by ``module_name`` after the build is complete), find the path to the parent directory where it is contained and the canonical name that could be used to import it considering the ``package_dir`` in the build configuration and ``root_dir`` r�rr^�N�z.pyz __init__.pyz.*c3�XK�|]%}tj�|���!|V��&dSr#)r_r`r~)r6�xs r.r9z_find_module..�s5����C�C�a������1B�1B�C��C�C�C�C�C�Cr0) r��rsplit�lenr_r`rirrrF) r�r�rS� parent_path� module_parts� custom_path�parts� parent_module� path_start� candidatesr�s r.r�r��so���K��$�$�S�)�)�L�� B� ��?�k� )� )�%�l�1�o�6�K��&�&�s�A�.�.�E��5�z�z�A�~�~� �g�l�l�8�U�1�X�>�>� � %�a�� � � +� ��(�(�M�#E�L����4D�#E�F�F�K�K� �;� � ��'�,�,�x��R��A�A�K����k�C�K�,=�,=�c�,B�,B�C�C�C�J�� � � � �R�W�\�\�*�m�D�D�E� ����� � ���J��C�C�:�C�C�C�T�J�J�K� � �[� 0�0r0�qualified_class_namec� �|ptj��}|�d��}||dzd�}|d|�}t|||��\}}}t t ||��|��} t | |��S)z@Given a qualified class name, return the associated class objectr�r�N)r_rf�rfindr�r�r�r�) r�r�rS�idx� class_name�pkg_namer�r`r�r-s r.� resolve_classr��s��� �&�2�9�;�;�H� � $� $�S� )� )�C�%�c�A�g�i�i�0�J�#�D�S�D�)�H�&2�8�[�(�&S�&S�#�L�$� � � �;��5�5�{� C� C�F� �6�:� &� &�&r0�valuesc�H�����fd�|���D��S)z�Given a dictionary mapping command names to strings for qualified class names, apply :func:`resolve_class` to the dict values. c�:��i|]\}}|t|������SrQ)r�)r6�k�vr�rSs ��r.� zcmdclass..s+��� R� R� R�4�1�a�A�}�Q� �X�6�6� R� R� Rr0)�items)r�r�rSs ``r.�cmdclassr� s,���� S� R� R� R� R�6�<�<�>�>� R� R� R�Rr0)� namespaces�fill_package_dirrSr�c �� �ddlm}ddlm}m}|rddlm}nddlm}|p tj}|� ddg��}g} |�in|}t|||������� t� ��d kr9t� fd �d|fD����r|� d � d��� D]�} t|| ��} |j| fi|��} | �| ��| rX|�d ��| ks?tj�| |��s|�|| | ������| S) aWorks similarly to :func:`setuptools.find_packages`, but with all arguments given as keyword arguments. Moreover, ``where`` can be given as a list (the results will be simply concatenated). When the additional keyword argument ``namespaces`` is ``True``, it will behave like :func:`setuptools.find_namespace_packages`` (i.e. include implicit namespaces as per :pep:`420`). The ``where`` argument will be considered relative to ``root_dir`` (or the current working directory when ``root_dir`` is not given). If the ``fill_package_dir`` argument is passed, this function will consider it as a similar data structure to the ``package_dir`` configuration parameter add fill-in any missing package location. :rtype: list r)�construct_package_dir)�unique_everseenrs)�PEP420PackageFinder)� PackageFinder�wherer�Nr�c3�F�K�|]}t�d|�� V��dS)rN)� _same_path)r6r��searchs �r.r9z find_packages..=s4�����V�V��J�v�a�y�!�$<�$<� <�V�V�V�V�V�Vr0r�)�setuptools.discoveryr�ryr�rsr�r�r_�curdirr��listr��all� setdefault� _nest_path�findrj�getr`�samefiler*)r�r�rS�kwargsr�r�rsr�r��packagesr`� package_path�pkgsr�s @r.� find_packagesr�s����0;�:�:�:�:�:�Q�Q�Q�Q�Q�Q�Q�Q��7�M�M�M�M�M�M�M�6�6�6�6�6�6��$�2�9�H� �J�J�w��� &� &�E��H�-�5�r�r�;K�� �/�/�/�/�%�"8�"8�9�9� :� :�F� �6�{�{�a���C�V�V�V�V�s�H�o�V�V�V�V�V���#�#�B��q� �2�2�2��G�G��!�(�D�1�1� �!�}�!�,�9�9�&�9�9��������� � G� � � �� $� $�� ,� ,��w��� �h�7�7� -� � #� #�$9�$9�$��$E�$E� F� F� F�� �Or0�parentr`c��|dvr|ntj�||��}tj�|��S)N>r�r�)r_r`ri�normpath)r�r`s r.r�r�Ms;���Y�&�&�6�6�B�G�L�L���,F�,F�D� �7� � �D� !� !�!r0r5c�B�t|��r |��}ttttt f|��}t |t��s>t|d��r)d�tt|����}nd|z}|S)z`When getting the version directly from an attribute, it should be normalised to string. �__iter__r�z%s) �callablerr rrO�intr;�hasattrri�mapr4s r.�versionr�Rs������������� ��%��S��/�*�E� 2� 2�E� �e�S� !� !�!� �5�*� %� %� !��H�H�S��e�_�_�-�-�E�E��5�L�E� �Lr0� package_datac�>�d|vr|�d��|d<|S)NrUr�)r�)r�s r.�canonic_package_datar�ds+�� �l���'�+�+�C�0�0� �R�� �r0� data_filesc�r��t|t��r|S�fd�|���D��S)z�For compatibility with ``setup.py``, ``data_files`` should be a list of pairs instead of a dict. This function also expands glob patterns. c�:��g|]\}}|t|���f��SrQ)rp)r6�destrRrSs �r.� z&canonic_data_files..us<��� � � � �D�(� �}�X�x�0�0�1� � � r0)r;r�r�)r�rSs `r.�canonic_data_filesr�jsT����*�d�#�#���� � � � �(�.�.�0�0� � � �r0� entry-points�textc���tdd���}t|_|�||��d�|���D��}|�|jd��|S)a?Given the contents of entry-points file, process it into a 2-level dictionary (``dict[str, dict[str, str]]``). The first level keys are entry-point groups, the second level keys are entry-point names, and the second level values are references to objects (that correspond to the entry-point value). N)�=)�default_section� delimitersc�X�i|]'\}}|t|�������(SrQ)�dictr�)r6r�r�s r.r�z entry_points..�s,�� <� <� <�T�Q��a��a�g�g�i�i��� <� <� >> def obtain_mapping(): ... print("Running expensive function!") ... return {"key": "value", "other key": "other value"} >>> mapping = LazyMappingProxy(obtain_mapping) >>> mapping["key"] Running expensive function! 'value' >>> mapping["other key"] 'other value' �obtain_mapping_valuec�"�||_d|_dSr#)�_obtain�_value)r,rs r.r/zLazyMappingProxy.__init__�s��+�� �15�� � � r0r1c�P�|j�|���|_|jSr#)rrrs r.�_targetzLazyMappingProxy._target�s!�� �;� ��,�,�.�.�D�K��{�r0�keyc�6�|���|Sr#)r)r,rs r.� __getitem__zLazyMappingProxy.__getitem__�s���|�|�~�~�c�"�"r0c�D�t|�����Sr#)r�rrs r.�__len__zLazyMappingProxy.__len__�s���4�<�<�>�>�"�"�"r0c�D�t|�����Sr#)�iterrrs r.r�zLazyMappingProxy.__iter__�s���D�L�L�N�N�#�#�#r0N)rKrLrMrNrr rrr/rr!r�r#r r�rQr0r.rr�s������� � �6�X�b�'�"�b�&�/�6I�-J�6�6�6�6����R������� #�r�#�b�#�#�#�#�#��#�#�#�#�$�(�2�,�$�$�$�$�$�$r0rr#)NN)r�)JrNr$r�r�r_r&r�r�globr� configparserr�importlib.machineryr� itertoolsr�typingrrr r r r r rrrrrr�typesr�distutils.errorsr�_pathrr��setuptools.distrr�r�distutils.distr� from_iterable� chain_iterrO�PathLike�_Pathrrrrp�bytesr|rzrxrwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrQr0r.�r5s�����& � � � ����� � � � � � � � ����� � � � �����������%�%�%�%�%�%�*�*�*�*�*�*������� � � � � � � � � � � � � � � � � � � � � � � � � � � � �������������1�1�1�1�1�1�+�+�+�+�+�+��4�,�,�,�,�,�,�4�4�4�4�4�4�3�3�3�3�3�3� � � � �c�2�;���� �W�T�]�]�� �W�T�T�"�"�"��P�P�P�P�P�P�P�P�8:>����s�m��'/���� �#�Y�����>��%��U�H�U�O� ;�<��PS�����$<�h�u�o�<�(�5�/�<�<�<�<���u�e�|�,������� �E��S�����04� $�#*�#*��#*��'�#�s�(�+�,�#*��u�o�#*�#*�#*�#*�L�C��h�u�o��*������Z��c��j�����1��1�#+�G�C��H�,=�#>�1�JO�1� �5�(�3�-�� $�%�1�1�1�1�H04� $� '� '�� '��'�#�s�(�+�,� '��u�o� '�� '� '� '� '�$04� $�S�S� ��c��N�S��'�#�s�(�+�,�S��u�o�S� �#�x�-�� S�S�S�S��15� $� 3�3�3��t�C��H�~�.�3��u�o� 3�  �#�Y� 3�3�3�3�l"�u�"�E�"�c�"�"�"�"� �5��8�E�#�s�(�O�#<�c�A�B��s�����$�t�������@D����d�D�j�!��-5�e�_�� �%��T�#�Y�� � �����" � �s� �4��T� �?� � � � �#7�#7�#7�#7�#7�#7�#7�#7�L$�$�$�$�$�w�r�2�v��$�$�$�$�$r0