ok
Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/distlib/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/distlib/__pycache__/manifest.cpython-311.pyc |
� �܋fX7 � � � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ dgZ ej e� � Z ej dej � � Z ej d ej ej z � � Zej dd � Z G d� de� � ZdS )zu Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. � N� )�DistlibException)�fsdecode��convert_path�Manifestz\\w* z#.*?(?= )| (?=$)� c �p � e Zd ZdZdd�Zd� Zd� Zd� Zdd�Zd � Z d � Z d� Z dd �Z dd�Z dd�Zd� ZdS )r z� A list of files built by exploring the filesystem and filtered by applying various patterns to what we find there. Nc � � t j � t j � |pt j � � � � � � | _ | j t j z | _ d| _ t � � | _ dS )zd Initialise an instance. :param base: The base directory to explore under. N)�os�path�abspath�normpath�getcwd�base�sep�prefix�allfiles�set�files)�selfr s �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/distlib/manifest.py�__init__zManifest.__init__, sZ � � �G�O�O�B�G�$4�$4�T�5H�R�Y�[�[�$I�$I�J�J�� ��i�"�&�(����� ��U�U�� � � � c �� � ddl m}m}m} g x| _ }| j }|g}|j }|j }|r� |� � }t j |� � } | D ]�} t j � || � � }t j |� � }|j } || � � r#|� t |� � � � �k || � � r || � � s ||� � ��|��dS dS )zmFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. r )�S_ISREG�S_ISDIR�S_ISLNKN)�statr r r r r �pop�appendr �listdirr �join�st_moder )r r r r r �root�stackr �push�names�name�fullnamer �modes r �findallzManifest.findall; s � � 3�2�2�2�2�2�2�2�2�2�#%�%�� ���y������i���|��� #��3�5�5�D��J�t�$�$�E�� #� #���7�<�<��d�3�3�� �w�x�(�(���|���7�4�=�=� #��O�O�H�X�$6�$6�7�7�7�7��W�T�]�]� #�7�7�4�=�=� #��D��N�N�N�� � #� #� #� #� #r c �� � |� | j � � s%t j � | j |� � }| j � t j � |� � � � dS )zz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N) � startswithr r r r# r r �addr )r �items r r/ zManifest.addV s[ � � ���t�{�+�+� 1��7�<�<�� �4�0�0�D�� ���r�w�'�'��-�-�.�.�.�.�.r c �: � |D ]}| � |� � �dS )z� Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N)r/ )r �itemsr0 s r �add_manyzManifest.add_many` s. � � � � �D��H�H�T�N�N�N�N� � r Fc � � �� �� fd��t � j � � }|rAt � � }|D ]+} �|t j � |� � � � �,||z }d� t d� |D � � � � D � � S )z8 Return sorted files in directory order c �� �� | � |� � t � d|� � |�j k r6t j � |� � \ }}|dvsJ � �| |� � d S d S )Nzadd_dir added %s)� �/)r/ �logger�debugr r r �split)�dirs�d�parent�_�add_dirr s ��r r? z Manifest.sorted.<locals>.add_dirn sy �� ��H�H�Q�K�K�K��L�L�+�Q�/�/�/��D�I�~�~��G�M�M�!�,�,� ����Y�.�.�.�.����f�%�%�%�%�%� �~r c �4 � g | ]}t j j |� ��S � )r r r# )�.0� path_tuples r � <listcomp>z#Manifest.sorted.<locals>.<listcomp>| s3 � � @� @� @�j����j�)� @� @� @r c 3 �T K � | ]#}t j � |� � V � �$d S �N)r r r: )rB r s r � <genexpr>z"Manifest.sorted.<locals>.<genexpr>} s0 � � � �>�>�t�r�w�}�}�T�*�*�>�>�>�>�>�>r )r r r r �dirname�sorted)r �wantdirs�resultr; �fr? s ` @r rI zManifest.sortedi s� ��� � &� &� &� &� &� &� �T�Z����� ��5�5�D�� 2� 2�����b�g�o�o�a�0�0�1�1�1�1��d�N�F�@� @��>�>�v�>�>�>�>�>�@� @� @� @r c �: � t � � | _ g | _ dS )zClear all collected files.N)r r r )r s r �clearzManifest.clear s � ��U�U�� ��� � � r c � � | � |� � \ }}}}|dk r9|D ]4}| � |d�� � st � d|� � �5dS |dk r|D ]}| � |d�� � �dS |dk r9|D ]4}| � |d�� � st � d|� � �5dS |d k r|D ]}| � |d�� � �dS |d k r:|D ]5}| � ||�� � st � d||� � �6dS |d k r|D ]}| � ||�� � �dS |dk r6| � d|�� � st � d|� � dS dS |dk r6| � d|�� � st � d|� � dS dS t d|z � � �)av Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands �includeT)�anchorzno files found matching %r�exclude�global-includeFz3no files found matching %r anywhere in distribution�global-exclude�recursive-include)r z-no files found matching %r under directory %r�recursive-exclude�graftNz no directories found matching %r�prunez4no previously-included directories found matching %rzinvalid action %r)�_parse_directive�_include_patternr8 �warning�_exclude_patternr )r � directive�action�patterns�thedir� dirpattern�patterns r �process_directivezManifest.process_directive� s� � � 04�/D�/D�Y�/O�/O�,���&�*� �Y���#� J� J���,�,�W�T�,�B�B� J��N�N�#?��I�I�I�� J� J� �y� � �#� <� <���%�%�g�d�%�;�;�;�;� <� <� �'� '� '�#� H� H���,�,�W�U�,�C�C� H��N�N� $>�?F�H� H� H�� H� H� �'� '� '�#� =� =���%�%�g�e�%�<�<�<�<� =� =� �*� *� *�#� J� J���,�,�W�V�,�D�D� J��N�N� $8�9@�&�J� J� J�� J� J� �*� *� *�#� >� >���%�%�g�f�%�=�=�=�=� >� >� �w� � ��(�(��j�(�A�A� +����A�)�+� +� +� +� +� +� +� �w� � ��(�(��j�(�A�A� :���� -�.8�:� :� :� :� :� :� :� #�#�f�,�.� .� .r c �| � |� � � }t |� � dk r |d dvr|� dd� � |d }dx}x}}|dv r:t |� � dk rt d|z � � �d � |dd� D � � }n�|d v rOt |� � dk rt d|z � � �t |d � � }d � |dd� D � � }nQ|dv r;t |� � dk rt d|z � � �t |d � � }nt d|z � � �||||fS )z� Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns r r )rP rR rS rT rU rV rW rX rP N)rP rR rS rT r z$%r expects <pattern1> <pattern2> ...c �, � g | ]}t |� � ��S rA r �rB �words r rD z-Manifest._parse_directive.<locals>.<listcomp>� � � �A�A�A�t��T�*�*�A�A�Ar )rU rV � z*%r expects <dir> <pattern1> <pattern2> ...c �, � g | ]}t |� � ��S rA r rf s r rD z-Manifest._parse_directive.<locals>.<listcomp>� rh r )rW rX z!%r expects a single <dir_pattern>zunknown action %r)r: �len�insertr r )r r] �wordsr^ r_ r` �dir_patterns r rY zManifest._parse_directive� s� � � ���!�!���u�:�:��?�?�u�Q�x� 0B� B� B� �L�L��I�&�&�&��q���*.�.��.�6�K�� :� :� :��5�z�z�A�~�~�&�:�V�C�E� E� E� B�A�u�Q�R�R�y�A�A�A�H�H� �A� A� A��5�z�z�A�~�~�&�@�6�I�K� K� K� "�%��(�+�+�F�A�A�u�Q�R�R�y�A�A�A�H�H� �)� )� )��5�z�z�Q���&�7�&�@�B� B� B� '�u�Q�x�0�0�K�K� #�#6��#?�@�@�@��x���4�4r Tc �� � d}| � ||||� � }| j �| � � � | j D ]3}|� |� � r| j � |� � d}�4|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. FNT)�_translate_patternr r, �searchr r/ )r rb rQ r �is_regex�found� pattern_rer) s r rZ zManifest._include_pattern� s � �8 ���,�,�W�f�f�h�O�O� � �=� ��L�L�N�N�N��M� � �D�� � ��&�&� �� ���t�$�$�$�����r c �� � d}| � ||||� � }t | j � � D ]3}|� |� � r| j � |� � d}�4|S )at 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. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions FT)rp �listr rq �remove)r rb rQ r rr rs rt rL s r r\ zManifest._exclude_pattern sr � � ���,�,�W�f�f�h�O�O� ��d�j�!�!� � �A�� � ��#�#� �� �!�!�!�$�$�$�����r c � � |r+t |t � � rt j |� � S |S t dk r,| � d� � � d� � \ }}}|rM| � |� � }t dk r,|� |� � r|� |� � sJ �nd}t j t j � | j d� � � � } |��Ot dk rA| � d� � } | � |� � dt | � � � }nu| � |� � }|� |� � r|� |� � sJ �|t |� � t |� � t |� � z � }t j }t j dk rd}t dk r!d| z |� |d|z f� � z }nw|t |� � t |� � t |� � z � }|�| �|�|�d|�|��}n3|r1t dk r d| z |z }n|�| �|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). )ri r r>