Edit File: filelist.cpython-311.pyc
� �����f 2����������������������������d�Z�ddlZddlZddlZddlZddlmZ�ddlmZm Z �ddl mZ��G�d��d������������Zd��Z ej��������fd �Zd ��Zd d�ZdS�)zsdistutils.filelist Provides the FileList class, used for poking about the filesystem and building lists of files. �����N��convert_path)�DistutilsTemplateError�DistutilsInternalError)�logc��������������������p�����e�Zd�ZdZdd�Zd��Zej��������fd�Zd��Z d��Z d��Zd ��Zd ��Z d��Zd��Zdd�Z �dd�ZdS�)�FileLista���A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. Instance attributes: dir directory from which files will be taken -- only used if 'allfiles' not supplied to constructor files list of filenames currently being built/filtered/manipulated allfiles complete list of files under consideration (ie. without any filtering applied) Nc������������������"�����d�|�_���������g�|�_��������d�S��N)�allfiles�files)�self�warn�debug_prints��� �9/opt/alt/python311/lib64/python3.11/distutils/filelist.py�__init__zFileList.__init__���s��������� ��� � � �����c�����������������������||�_���������d�S�r���)r���)r���r���s��� r����set_allfileszFileList.set_allfiles#���s ������ �� � � r���c������������������.�����t����������|������������|�_��������d�S�r���)�findallr���)r����dirs��� r���r���zFileList.findall&���s����������� � � r���c������������������8�����ddl�m}�|rt����������|�������������dS�dS�)z~Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true. r���)�DEBUGN)�distutils.debugr����print)r����msgr���s��� r���r���zFileList.debug_print)���s7������� *�)�)�)�)�)��� ��#�J�J�J�J�J� �� r���c������������������:�����|�j������������������������������|�������������d�S�r���)r ����append)r����items��� r���r���zFileList.append3���s������� ���$�����r���c������������������:�����|�j������������������������������|�������������d�S�r���)r ����extend)r����itemss��� r���r"���zFileList.extend6���s������� ���%� � � � � r���c������������������������t����������t����������t����������j��������j��������|�j��������������������������������}g�|�_��������|D�]-}|�j�����������������������������t����������j��������j��������|����������������.d�S�r���)�sorted�map�os�path�splitr ���r����join)r����sortable_files� sort_tuples��� r����sortz FileList.sort9���sa��������B�G�M�4�:� >� >�?�?���� �(�� 9�� 9�J��J���b�g�l�J�7�8�8�8�8� 9�� 9r���c�����������������������t����������t����������|�j��������������������dz ��dd������������D�])}|�j��������|���������|�j��������|dz �����������k����r|�j��������|=��*d�S�)N����r������)�range�lenr ���)r����is��� r����remove_duplicateszFileList.remove_duplicatesC���sZ�������s�4�:����*�A�r�2�2�� "�� "�A��z�!�}�� �1�q�5� 1�1�1��J�q�M�� "�� "r���c����������������������|������������������������������������}|d���������}d�x}x}}|dv�r:t����������|������������dk�����rt����������d|z���������������d��|dd�����������D���������������}n�|dv�rOt����������|������������dk�����rt����������d |z���������������t����������|d���������������������}d ��|dd�����������D���������������}nQ|dv�r;t����������|������������dk����rt����������d|z���������������t����������|d���������������������}nt����������d |z���������������||||fS�)Nr���)�include�exclude�global-include�global-exclude����z&'%s' expects <pattern1> <pattern2> ...c������������������,�����g�|�]}t����������|��������������S���r�����.0�ws��� r���� <listcomp>z1FileList._parse_template_line.<locals>.<listcomp>W����������;�;�;�A��Q���;�;�;r���r/���)�recursive-include�recursive-exclude����z,'%s' expects <dir> <pattern1> <pattern2> ...c������������������,�����g�|�]}t����������|��������������S�r<���r���r=���s��� r���r@���z1FileList._parse_template_line.<locals>.<listcomp>]���rA���r���)�graft�prunez#'%s' expects a single <dir_pattern>zunknown action '%s')r)���r2���r���r���)r����line�words�action�patternsr����dir_patterns��� r����_parse_template_linezFileList._parse_template_lineL���sV������ � �����q���'+�+��+�3����:��:��:��5�z�z�A�~�~�,�>��G�I��I��I�;�;��q�r�r��;�;�;�H�H� �A� A� A��5�z�z�A�~�~�,�D�v�M�O��O��O��u�Q�x�(�(�C�;�;��q�r�r��;�;�;�H�H� �)� )� )��5�z�z�Q���,�;�f�D�F��F��F�&�u�Q�x�0�0�K�K�(�)>��)G�H�H�H���#�{�3�3r���c������������������R����|�����������������������|������������\��}}}}|dk����r^|����������������������dd���������������������|������������z����������������|D�].}|����������������������|d�������������st ����������j��������d|��������������/d�S�|dk����r^|����������������������dd���������������������|������������z����������������|D�].}|����������������������|d�������������st ����������j��������d |��������������/d�S�|d k����r^|����������������������dd���������������������|������������z����������������|D�].}|����������������������|d�������������st ����������j��������d |��������������/d�S�|dk����r^|����������������������dd���������������������|������������z����������������|D�].}|����������������������|d�������������st ����������j��������d|��������������/d�S�|dk����rb|����������������������d|�dd���������������������|���������������������������|D�]/}|����������������������||�������������st ����������j��������d||��������������0d�S�|dk����rb|����������������������d|�dd���������������������|���������������������������|D�]/}|����������������������||�������������st ����������j��������d||��������������0d�S�|dk����rH|����������������������d|z����������������|����������������������d�|�������������st ����������j��������d|�������������d�S�d�S�|dk����rH|����������������������d|z����������������|����������������������d�|�������������st ����������j��������d|�������������d�S�d�S�t����������d|z���������������)Nr6���zinclude � r/���)�anchorz%warning: no files found matching '%s'r7���zexclude z9warning: no previously-included files found matching '%s'r8���zglobal-include r���z>warning: no files found matching '%s' anywhere in distributionr9���zglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionrB���zrecursive-include )�prefixz:warning: no files found matching '%s' under directory '%s'rC���zrecursive-exclude zNwarning: no previously-included files matching '%s' found under directory '%s'rF���zgraft z+warning: no directories found matching '%s'rG���zprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')rM���r���r*����include_patternr���r����exclude_patternr���)r���rH���rJ���rK���r���rL����patterns��� r����process_template_linezFileList.process_template_lineh���si������04�/H�/H��/N�/N�,���3�� ��Y������Z�#�(�(�8�*<�*<�<�=�=�=�#�� &�� &���+�+�G�A�+�>�>��&��H�D�$�&��&��&�� &�� &� ��y� � ����Z�#�(�(�8�*<�*<�<�=�=�=�#�� ?�� ?���+�+�G�A�+�>�>��?��H��4�6=�?��?��?�� ?�� ?� ��'� '� '����.����(�1C�1C�C�D�D�D�#�� D�� D���+�+�G�A�+�>�>��D��H��9�;B�D��D��D�� D�� D� ��'� '� '����.����(�1C�1C�C�D�D�D�#�� &�� &���+�+�G�A�+�>�>��&��H��D�$�&��&��&�� &�� &���*� *� *�����!�c�c�3�8�8�H�#5�#5�#5�7�� 8�� 8�� 8�#�� +�� +���+�+�G�C�+�@�@��+��H��7�$�c�+��+��+�� +�� +���*� *� *�����!�c�c�3�8�8�H�#5�#5�#5�7�� 8�� 8�� 8�#�� +�� +���+�+�G�C�+�@�@��+��H��@�$�c�+��+��+�� +�� +���w� � ����X��3�4�4�4��'�'��[�'�A�A�� &���F�$�&��&��&��&��&� &�� &���w� � ����X��3�4�4�4��'�'��[�'�A�A�� 9����*�,7�9��9��9��9��9� 9�� 9��)�;�f�D�F��F�� Fr���r/���r���c������������������D����d}t����������||||������������}|����������������������d|j��������z���������������|�j���������|�������������������������������������|�j��������D�]K}|���������������������|������������r4|����������������������d|z����������������|�j�����������������������������|�������������d}�L|S�)a���Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform- dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found, False otherwise. Fz%include_pattern: applying regex r'%s'Nz adding T)�translate_patternr���rT���r���r����searchr ���r���)r���rT���rP���rQ����is_regex�files_found� pattern_re�names��� r���rR���zFileList.include_pattern����s�������4���&�w����I�I� ����@�#�+�,�� -�� -�� -���=� ��L�L�N�N�N��M�� #�� #�D�� � ��&�&�� #�� � ��d�!2�3�3�3�� �!�!�$�'�'�'�"����r���c������������������T����d}t����������||||������������}|����������������������d|j��������z���������������t����������t ����������|�j��������������������dz ��dd������������D�]O}|���������������������|�j��������|���������������������r-|����������������������d|�j��������|���������z����������������|�j��������|=�d}�P|S�)a��Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found, False otherwise. Fz%exclude_pattern: applying regex r'%s'r/���r0���z removing T)rW���r���rT���r1���r2���r ���rX���)r���rT���rP���rQ���rY���rZ���r[���r3���s��� r���rS���zFileList.exclude_pattern����s����������&�w����I�I� ����@�#�+�,�� -�� -�� -��s�4�:���q�(�"�b�1�1�� #�� #�A�� � ���A��/�/�� #�� � ��� �1� �!=�>�>�>��J�q�M�"����r���)NN�r/���Nr���)�__name__� __module__�__qualname__�__doc__r���r���r'����curdirr���r���r���r"���r-���r4���rM���rU���rR���rS���r<���r���r���r ���r ������s�������������������������!��!��!���)��%��%��%��%������ �� �� �!��!��!�9��9��9�"��"��"�4��4��4�8GF��GF��GF�X(��(��(��(�X�:;�����������r���r ���c�����������������������d��t����������j��������|�d�������������D���������������}t����������t�����������j��������j��������|������������S�)z% Find all files under 'path' c��������������3����h���K����|�]-\��}}}|D�]$}t�����������j�����������������������������||������������V����%�.d�S�r���)r'���r(���r*���)r>����base�dirsr ����files��� r���� <genexpr>z#_find_all_simple.<locals>.<genexpr>����sc���������������D�$������� �� ����T�4� � �������������r���T)�followlinks)r'����walk�filterr(����isfile)r(����resultss��� r����_find_all_simplero�������sE���������!#���4�!@�!@�!@������G� ��"�'�.�'�*�*�*r���c������������������������t����������|�������������}|�t����������j��������k����r5t����������j��������t����������j��������j��������|��������������}t����������||������������}t����������|������������S�)z� Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. )�start) ro���r'���rc���� functools�partialr(����relpathr&����list)r���r ����make_rels��� r���r���r�����sR������ � �S�!�!�E� �b�i����$�R�W�_�C�@�@�@���H�e�$�$����;�;�r���c�����������������������t����������j��������|�������������}t����������j��������}t����������j��������dk����rd}d|z��}t ����������j��������d||������������}|S�)z�Translate a shell-like glob pattern to a regular expression; return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). �\z\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)�fnmatch� translater'����sep�re�sub)rT���r[���r{����escapeds��� r���� glob_to_rer�����sS��������"�7�+�+�J�� �&�C� �v��~�~�����3��G���-�w� �C�C�J��r���r/���c������������������0����|r+t����������|�t����������������������rt����������j��������|�������������S�|�S�t ����������d���������������������������������d������������\��}}}|�r<t ����������|�������������}|���������������������|������������r|���������������������|������������sJ��nd}|��t ����������|������������}|���������������������|������������r|���������������������|������������sJ��|t����������|������������t����������|������������t����������|������������z ������������}t����������j ��������} t����������j ��������dk����rd} |t����������|������������t����������|������������t����������|������������z ������������}|�d|�| �d|�|��}n|r|�d|t����������|������������d������������}t����������j��������|������������S�)a��Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). �_��Nrx���z\\z\Az.*)� isinstance�strr|����compiler���� partition� startswith�endswithr2���r'���r{���) rT���rP���rQ���rY���rq���r�����endr[���� prefix_rer{���s ��� r���rW���rW���%��s�����������g�s�#�#�� ��:�g�&�&�&��N���s�O�O�-�-�c�2�2�M�E�1�c������(�(� ��$�$�U�+�+�H� �0C�0C�C�0H�0H�H�H�H�H�� � ���v�&�&� ��#�#�E�*�*�F�y�/A�/A�#�/F�/F�F�F�F��c�%�j�j�#�i�.�.�3�s�8�8�*C�C�D� ��f�� �6�T�>�>��C���E� � �C� �O�O�c�#�h�h�,F� F�G� �*/�%�%���C�C�C���S�S�Q� � ��� F�&+�e�e�Z��E� � ���-D�-D�E�J� �:�j�!�!�!r���r^���)rb���r'���r|���ry���rr����distutils.utilr����distutils.errorsr���r���� distutilsr���r ���ro���rc���r���r���rW���r<���r���r����<module>r�������s����������� � � � � � � ���������������'��'��'��'��'��'��K��K��K��K��K��K��K��K�������������b��b��b��b��b��b��b��b�P +�� +�� +��� �� �� �� �� ������.""��""��""��""��""��""r���