� ,�Re�y� ���dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZdd lm Z m!Z!m"Z"m#Z#dd l$m%Z&dd l'm(Z(dd l)m*Z*erddl+m,Z,ej-dkrddlm.Z.nerddl/m.Z.nddl0m1Z.ee2efZ3ede3���Z4ej5e6��Z7Gd�de ��Z8dZ9dZ:Gd�de ��Z;Gd�de.��Z<Gd�d��Z=Gd�de=��Z>Gd �d!��Z?d"ed#e@fd$�ZAd%ee2d&ee2e2fd'ed#e@fd(�ZBd)�ZCd*e*d#ee2fd+�ZDd*e*d#ee2fd,�ZEd%ee2d&ee2e2fd-e3d#ee2e2ffd.�ZFd/e3d#e2fd0�ZGd1ee2e2fd#ee2fd2�ZHd%ee2d1ee2e2fd#eee2ee2ffd3�ZId1ee2e2fd#ee2e2ffd4�ZJd5e2d6e2d7e2d8e2d#e@f d9�ZKd:e3d#e2fd;�ZLde2d#e2fd?�ZNGd@�dAe#jO��ZPdBZQd>e2dCee2e2fdDee2ee2fd#e2fdE�ZRGdF�dGeS��ZTGdH�dIe"jU��ZVdS)Ja� Create a wheel that, when installed, will make the source package 'editable' (add it to the interpreter's path, including metadata) per PEP 660. Replaces 'setup.py develop'. .. note:: One of the mechanisms briefly mentioned in PEP 660 to implement editable installs is to create a separated directory inside ``build`` and use a .pth file to point to that directory. In the context of this file such directory is referred as *auxiliary build directory* or ``auxiliary_dir``. �N)�suppress)�Enum)�cleandoc)�chain)�Path)�TemporaryDirectory) � TYPE_CHECKING�Dict�Iterable�Iterator�List�Mapping�Optional�Tuple�TypeVar�Union)�Command�SetuptoolsDeprecationWarning�errors� namespaces)�build_py��find_package_path)� Distribution�� WheelFile)��)�Protocol)�ABC�_P)�boundc�J�eZdZdZdZdZdZedee ddfd���Z dS) � _EditableModea Possible editable installation modes: `lenient` (new files automatically added to the package - DEFAULT); `strict` (requires a new installation when files are added/removed); or `compat` (attempts to emulate `python setup.py develop` - DEPRECATED). �strict�lenient�compat�mode�returnc���|s tjS|���}|tjvrt jd|�d����|dkrd}t j|t��t|S)NzInvalid editable mode: z. Try: 'strict'.�COMPATax The 'compat' editable mode is transitional and will be removed in future versions of `setuptools`. Please adapt your code accordingly to use either the 'strict' or the 'lenient' modes. For more information, please check: https://setuptools.pypa.io/en/latest/userguide/development_mode.html ) r$�LENIENT�upper� __members__r� OptionError�warnings�warnr)�clsr(�_mode�msgs ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/command/editable_wheel.py�convertz_EditableMode.convertGs}��� )� �(� (�� � � � �� � �1� 1� 1��$�%W�t�%W�%W�%W�X�X� X� �H� � ��C� �M�#�;� <� <� <��U�#�#�N) �__name__� __module__� __qualname__�__doc__�STRICTr,r+� classmethodr�strr6�r7r5r$r$;s_���������F��G� �F��$�8�C�=�$�_�$�$�$��[�$�$�$r7r$zU New or renamed files may not be automatically picked up without a new installation. zt Options like `package-data`, `include/exclude-package-data` or `packages.find.exclude/include` may have no effect. c�V�eZdZdZdZddddeejpd��fgZd�Zd �Z d �Z d �Z d �Z d e efd�Zdedededefd�Zd�Zd eeeeeefffd�Zdedededed eeeeeefff d�Zd�Zdefd�Zd�Zdefd�Zdededed dfd �ZdS)!�editable_wheelzkBuild 'editable' wheel for development. (This command is reserved for internal use of setuptools). z!create a PEP 660 'editable' wheel)z dist-dir=�dz-directory to put final built distributions in)zdist-info-dir=�Iz(path to a pre-build .dist-info directoryzmode=N�c�>�d|_d|_d|_d|_dS�N)�dist_dir� dist_info_dir� project_dirr(��selfs r5�initialize_optionsz!editable_wheel.initialize_optionsvs$���� �!�������� � � r7c���|j}|jp tj|_|jpi|_t |jp$tj� |jd����|_dS)N�dist) � distribution�src_root�os�curdirrI� package_dirrrG�path�join)rKrNs r5�finalize_optionszeditable_wheel.finalize_options|sX��� ���=�5�B�I����+�1�r����T�]�T�b�g�l�l�4�;K�V�.T�.T�U�U�� � � r7c�� |j�d���|���|�d��|�d��}|�|j��|�|��dS#t$r<}tj ��d}tj t|����|�d}~wwxYw)NT)�exist_ok� bdist_wheela� Support for editable installs via PEP 660 was recently introduced in `setuptools`. If you are seeing this error, please report to: https://github.com/pypa/setuptools/issues Meanwhile you can try the legacy behavior by setting an environment variable and trying to install again: SETUPTOOLS_ENABLE_FEATURES="legacy-editable" )rG�mkdir�_ensure_dist_info�reinitialize_command�get_finalized_command�write_wheelfilerH�_create_wheel_file� Exception� traceback� print_excr� InternalErrorr)rKrY�exr4s r5�runzeditable_wheel.run�s��� >� �M� � �� � .� .� .� � "� "� $� $� $� � %� %�m� 4� 4� 4��4�4�]�C�C�K� � '� '��(:� ;� ;� ;� � #� #�K� 0� 0� 0� 0� 0��� >� >� >� � � !� !� !� �C��&�x��}�}�5�5�2� =����� >���s�BB � C�7C � Cc�f�|j�W|�d��}|j|_|���|���|j|_dSt |j���d��sJ�t|jd��� ��sJ�dS)N� dist_infoz .dist-info�METADATA) rHr\rG� output_dir�ensure_finalizedrer>�endswithr�exists)rKrgs r5r[z editable_wheel._ensure_dist_info�s��� � � %��1�1�+�>�>�I�#'�=�I� � � &� &� (� (� (� �M�M�O�O�O�!*�!8�D� � � ��t�)�*�*�3�3�L�A�A� A� A� A���*�J�7�7�>�>�@�@� @� @� @� @� @r7c���|j}|jsdSt|j|j�dd�������}t||||��}|���dS)NrD�.) rO�namespace_packagesrrIrS�get�resolve�_NamespaceInstaller�install_namespaces)rK�installation_dir� pth_prefixrNrP� installers r5�_install_namespacesz"editable_wheel._install_namespaces�sw��� ���&� � �F���(�$�*:�*>�*>�r�3�*G�*G�H�H�P�P�R�R��'��.>� �H�U�U� ��$�$�&�&�&�&�&r7r)c���|jrt|j��jn t��}tt|�d����}t |d��S)Nz *.egg-info)rHr�parent�mapr>�glob�next)rK� parent_dir� candidatess r5�_find_egg_info_dirz!editable_wheel._find_egg_info_dir�sT��8<�8J�V�T�$�,�-�-�4�4�PT�PV�PV� ���j�o�o�l�;�;�<�<� ��J��%�%�%r7�name�unpacked_wheel� build_lib�tmp_dirc��|j}t|��}t|��}tt||�d�d����}tt||�d�d����}tt||�d�d����} |�dd���} t|��| _d| _|�dd���} |�d d���} |x| _x| _| _|x| _ x| _ | _ | x| _ | _ || _|| _|�d ��} d| _t|��| _|�d ��}d |_|���|_|���| ���| ���d S)a�Configure commands to behave in the following ways: - Build commands can write to ``build_lib`` if they really want to... (but this folder is expected to be ignored and modules are expected to live in the project directory...) - Binary extensions should be built in-place (editable_mode = True) - Data/header/script files are not part of the "editable" specification so they are written directly to the unpacked_wheel directory. z.data�data�headers�scripts�egg_infoT)�reinit_subcommands�build�install�install_scriptsrFN)rOr>rr\�egg_base�ignore_egg_info_in_manifest� build_platlib� build_purelibr��install_purelib�install_platlib� install_libr�� build_scripts�install_headers� install_data�get_command_obj�no_ep� build_temp�compiler�existing_egg_info_dir�_set_editable_moderj)rKr�r�r�r�rN�wheelr�r�r�r�r�r�r�rs r5�_configure_buildzeditable_wheel._configure_build�s���� ���N�#�#��� �N�N� ��4��4�����?�?�@�@���d�>�d�>�>�>�9�E�E�F�F���d�>�d�>�>�>�9�E�E�F�F���,�,�Z�D�,�Q�Q����L�L���/3��,��)�)�'�d�)�K�K���+�+�I�$�+�O�O��FO�O���O�e�1�E�O�RW�W���W�'�"9�G��>�>���g�~�r7� dist_namec��|�||||��|���|���\}}|�d��|�d��|�d��||fS)Nr�r�r�)r��_run_build_subcommandsr�� _run_install)rKr�r�r�r�r�r�s r5�_run_build_commandsz"editable_wheel._run_build_commandss��� ���i���G�L�L�L� �#�#�%�%�%��4�4�6�6���w� ���)�$�$�$� ���)�$�$�$� ���&�!�!�!��g�~�r7c��|�d��}|���D]`}|�|��}|dkr.t|��tkr|�|���K|�|���adS)a} Issue #3501 indicates that some plugins/customizations might rely on: 1. ``build_py`` not running 2. ``build_py`` always copying files to ``build_lib`` However both these assumptions may be false in editable_wheel. This method implements a temporary workaround to support the ecosystem while the implementations catch up. r�rN)r]r��type� build_py_cls� _safely_run� run_command)rKr�r�r�s r5r�z%editable_wheel._run_build_subcommands s����3�3�G�<�<���*�*�,�,� '� '�D��,�,�T�2�2�C��z�!�!�d�3�i�i�<�&?�&?�� � ��&�&�&�&�� � ��&�&�&�&�  '� 'r7r�c��� |�|��S#t$r<tj���d|�d|�d�}t j|t d���YdSwxYw)Nz� If you are seeing this warning it is very likely that a setuptools plugin or customization overrides the `z�` command, without taking into consideration how editable installs run build steps starting from v64.0.0. Plugin authors and developers relying on custom build steps are encouraged to update their `aO` implementation considering the information in https://setuptools.pypa.io/en/latest/userguide/extension.html about editable installs. For the time being `setuptools` will silence this error and ignore the faulty command, but this behaviour will change in future versions. �)� stacklevel)r�r`ra� format_excr0r1r)rKr�r4s r5r�zeditable_wheel._safely_run"s��� K��#�#�H�-�-� -��� K� K� K� �+�-�-� � �4<� � �'� � � �C� �M�#�;�� J� J� J� J� J� J� J� K���s��AA�Ac ��ddlm}|�d��}|j}d�|�����}d}|�d|�d|�d�}t |j|��}|���r|� ��t|���} td���} td ���} | 5} | 5} | 5}t | t |j ��j��}tj |j |��|�| |j��|�|| | |��\}}|�||| ��}|5||d ��5}||||��|�| ��ddd��n #1swxYwYddd��n #1swxYwYddd��n #1swxYwYddd��n #1swxYwYddd��n #1swxYwY|S) Nrrrg�-z 0.editablez.whl)�suffixz .build-libz .build-temp�w)�wheel.wheelfilerr]r�rU�get_tagrrGrl�unlinkrrH�shutil�copytreerwr��_select_strategy� write_files)rKrYrrgr��tag� build_tag� archive_name� wheel_pathr�r�� build_tmp�unpacked�lib�tmp�unpacked_dist_infor�r��strategy� wheel_objs r5r_z!editable_wheel._create_wheel_file6sJ��-�-�-�-�-�-��.�.�{�;�;� ��N� ��h�h�{�*�*�,�,�-�-�� � �#�;�;�i�;�;�#�;�;�;� ��$�-��6�6� � � � � � � � � � � � � �+�<�@�@�@��&�l�;�;�;� �&�m�<�<�<� � � 0�x�� 0�c�9� 0��!%�h��T�5G�0H�0H�0M�!N�!N� � �O�D�.�0B� C� C� C� � $� $�X�y�~� >� >� >�!�5�5�i��3�PS�T�T�N�E�7��,�,�Y��S�A�A�H�� 0� 0�9�9�Z��5�5� 0�����E�7�3�3�3��%�%�h�/�/�/� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0���� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0���� 0� 0� 0� 0�  0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0���� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0���� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0� 0���� 0� 0� 0� 0��s��G5� G� BG� F0 �*#F � F0 �F�F0 � F�!F0 �$ G�0F4 �4G�7F4 �8G�; G�G � G�G �G� G5�G" �"G5�%G" �&G5�5G9�<G9�categoryc���t|jd|��d��}|rB|��r:t�d|�d���|�d|����dSdSdS)N�has_z Installing z as non editable�install_)�getattrrO�_logger�infor�)rKr�� has_categorys r5r�zeditable_wheel._run_installRs����t�0�2C��2C�2C�T�J�J� � � 4�L�L�N�N� 4� �L�L�A�x�A�A�A� B� B� B� � � �2��2�2� 3� 3� 3� 3� 3� 4� 4� 4� 4r7r��EditableStrategyc�\�d|�d|��}t|j��}t�|j��}|tjur:t t|jd|����}t|j|||��St|j��}t||j |��} |tj u} t|j ��dhkr| s| r@|j �dd��} t|j|t|| ��g��St!|j|��S)zDDecides which strategy to use to implement an editable installation.� __editable__.r�r�rDrn)rrIr$r6r(r<� _empty_dir� _LinkTreerO�_find_packages�_simple_layoutrSr+�setrp� _StaticPth�_TopLevelFinder) rKr�r�r�� build_namerIr(� auxiliary_dir�packages�has_simple_layout�is_compat_mode�src_dirs r5r�zeditable_wheel._select_strategyXs#��2�T�1�1�C�1�1� ��4�+�,�,� ��$�$�T�Y�/�/�� �=�'� '� '�&�t�D�,<�g�z�'R�'R�S�S�M��T�.��m�Y�O�O� O�!�$�"3�4�4��*�8�T�5E�{�S�S����!5�5�� �t�� � �R�D� (� (�->� (�.� (��&�*�*�2�s�3�3�G��d�/���[�'�8R�8R�7S�T�T� T��t�0�$�7�7�7r7)r8r9r:r;� descriptionrr$� user_optionsrLrVrer[rwrr>r�_Pathr�r�rr r r�r�r�r�r_r�r�r?r7r5rArAis��������6�K� L�K� �$����!6�!<�"�=�=�>��L� ��� V�V�V� >�>�>�4 A� A� A�'�'�'�&�H�S�M�&�&�&�&� 0#��0#�).�0#�;@�0#�KP�0#�0#�0#�0#�d #� #� #� ��d�3�i��c�3�h��.G�(H� � � � � �� �.3� �@E� �PU� � �t�C�y�$�s�C�x�.�(� )� � � � �'�'�'�,K�C�K�K�K�K�(���84�S�4�4�4�4� 8��8��8�� 8� � 8�8�8�8�8�8r7rAc�J�eZdZdddeedeeeffd�Zd�Zd�ZdS) r�r�rr�r�c��dSrFr?)rKr�r�r�s r5�__call__zEditableStrategy.__call__t��� �r7c��dSrFr?rJs r5� __enter__zEditableStrategy.__enter__wr�r7c��dSrFr?�rK� _exc_type� _exc_value� _tracebacks r5�__exit__zEditableStrategy.__exit__zr�r7N) r8r9r:r r>r r�r�r�r?r7r5r�r�ssh������ �k� �$�s�)� �d�3�PS�8�n� � � � � � � � � � � � r7r�c�j�eZdZdededeefd�Zdddeedeeeffd �Z d �Z d �Z d S) r�rNr�� path_entriesc�0�||_||_||_dSrF)rNr�r�)rKrNr�r�s r5�__init__z_StaticPth.__init__s���� ��� �(����r7r�rr�r�c��d�d�|jD����}t|�d�d��}|�d|j�d�|��dS)N� c3�XK�|]%}t|�����V��&dSrF)r>rq)�.0�ps r5� z&_StaticPth.__call__..�s2����I�I�!�S������-�-�I�I�I�I�I�Ir7�utf-8r��.pth)rUr��bytes�writestrr�)rKr�r�r��entries�contentss r5r�z_StaticPth.__call__�sb���)�)�I�I�t�7H�I�I�I�J�J���G�����1�1�� ���6�t�y�6�6�6��A�A�A�A�Ar7c��dtttj|j�����d�}t �|tz��|S)Nz_ Editable install will be performed using .pth file to extend `sys.path` with: z )�listrzrQ�fspathr�r��warning�_LENIENT_WARNING�rKr4s r5r�z_StaticPth.__enter__�sQ�� � �c�"�)�T�.�/�/� 0� 0� � � �� ����.�.�/�/�/�� r7c��dSrFr?r�s r5r�z_StaticPth.__exit__�r�r7N) r8r9r:rr>r rr�r r�r�r�r?r7r5r�r�~s�������)�\�)��)�D��J�)�)�)�)� B�k�B�$�s�)�B�d�3�PS�8�n�B�B�B�B� ��� � � � � r7r�c���eZdZdZdedededef�fd� Zddd eed e eeff�fd � Z d ed e efd�Z ddedefd�Z d�Zd�Zd�Z�xZS)r�a` Creates a ``.pth`` file that points to a link tree in the ``auxiliary_dir``. This strategy will only link files (not dirs), so it can be implemented in any OS, even if that means using hardlinks instead of symlinks. By collocating ``auxiliary_dir`` and the original source code, limitations with hardlinks should be avoided. rNr�r�r�c� ��t|��|_t|�����|_|�d��j|_t���|||jg��dS)Nr) rr�rqr�r�� copy_file�_file�superr�)rKrNr�r�r�� __class__s �r5r�z_LinkTree.__init__�sn��� "�-�0�0����i���0�0�2�2����)�)�*�5�5�?�� � ������t�d�&8�%9�:�:�:�:�:r7r�rr�r�c�z��|�||��t���|||��dSrF)� _create_linksrr�)rKr�r�r�rs �r5r�z_LinkTree.__call__�s;��� ���5�'�*�*�*� �������w�/�/�/�/�/r7�filer)c�*�tt��5t|������|j��}t |���tj d��cddd��S#1swxYwYdS)N�/) r� ValueErrorrrq� relative_tor�r>�replacerQ�sep)rKrrTs r5�_normalize_outputz_LinkTree._normalize_output�s��� �j� !� !� 2� 2���:�:�%�%�'�'�3�3�D�N�C�C�D��t�9�9�$�$�R�V�S�1�1� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2���� 2� 2� 2� 2��ts�A&B�B �B N�relative_output�src_filec��|j|z }|j���s|j�d���|�|||���dS)NT)�parents��link)r�ry�is_dirrZr)rKr r!r%�dests r5� _create_filez_LinkTree._create_file�s\���!�O�3���{�!�!�#�#� ,� �K� � �d� � +� +� +� � � �8�T�� �-�-�-�-�-r7c����j�dd���t�j��rdnd}�fd�|���D��}|�dd��|D]3}��|��}|r||vr��||���4|���D]\}}��|||����dS)NT)r#rX�sym�hardc�B��i|]\}}��|��|��Sr?)r)r�k�vrKs �r5� z+_LinkTree._create_links..�s=��� � � ���1� � "� "�1� %� %�q� � � r7r$)r�rZ�_can_symlink_files�items�poprr()rK�outputs�output_mapping� link_type�mappings�output�relative�srcs` r5rz_LinkTree._create_links�s��� �� � ��� �=�=�=�/��0B�C�C�O�E�E�� � � � � �&�,�,�.�.� � � �� � � �T�4� � � �� 4� 4�F��-�-�f�5�5�H�� 4�H�H�4�4��!�!�(�F�3�3�3��%�^�^�-�-� =� =�M�H�c� � � �h��)� � <� <� <� <� =� =r7c�N�d}t�|tz��|S)Nz=Strict editable install will be performed using a link tree. )r�r �_STRICT_WARNINGrs r5r�z_LinkTree.__enter__�s#��N������o�-�.�.�.�� r7c�P�d|j�d�}tj|t��dS)Nz\ Strict editable installation performed using the auxiliary directory: z� Please be careful to not remove this directory, otherwise you might not be able to import/use your package. )r�r0r1�InformationOnly�rKr�r�r�r4s r5r�z_LinkTree.__exit__�s8�� � � � � � �� � �c�?�+�+�+�+�+r7rF)r8r9r:r;rr>r�r�r r r�rrr(rr�r�� __classcell__)rs@r5r�r��s%��������� ;� � ;�� ;�� ;�� ;� ;� ;� ;� ;� ;�0�k�0�$�s�)�0�d�3�PS�8�n�0�0�0�0�0�0��c��h�s�m�����.�.�C�.�3�.�.�.�.� =�=�=�"��� ,�,�,�,�,�,�,r7r�c�Z�eZdZdedefd�Zdddeedeeeffd�Zd �Z d �Z d S) r�rNr�c�"�||_||_dSrF)rNr�)rKrNr�s r5r�z_TopLevelFinder.__init__�s���� ��� � � r7r�rr�r�c ��|jjp tj}t t |j��t |j����}|jjpi}t|||��}tt t|jj pg|��d�t|��D������}d|j �d�} t| ��} tt!| ||��d��} |�| �d�| ��td| �d| �d�d��} |�d|j �d �| ��dS) Nc3�K�|]}|gfV�� dSrFr?)r�nss r5rz+_TopLevelFinder.__call__..�s&���� @� @�"�b�"�X� @� @� @� @� @� @r7r�z.finderrz.pyzimport z; z .install()r)rNrPrQrRrr��_find_top_level_modulesrS�_find_package_roots�dict�_find_namespacesr��_find_virtual_namespacesr��_make_identifierr�_finder_templater) rKr�r�r�rP� top_levelrS�roots� namespaces_r��finder�contents r5r�z_TopLevelFinder.__call__�sE���9�%�2�����.���3�3�5L�T�Y�5W�5W�X�X� ��i�+�1�r� �#�I�{�H�E�E��,0�� �T�Y�/�5�2�u� =� =� @� @� 8�� ?� ?� @� @� @�2 �2 �- �- � � 2�t�y�1�1�1��!�$�'�'���(��u�k�B�B�G�L�L�� ���&�~�~�~�w�/�/�/��>�&�>�>�F�>�>�>��H�H�� ���6�t�y�6�6�6��@�@�@�@�@r7c�N�d}t�|tz��|S)Nz=Editable install will be performed using a meta path finder. )r�r r rs r5r�z_TopLevelFinder.__enter__�s$��N������.�.�/�/�/�� r7c�>�d}tj|t��dS)Nz� Please be careful with folders in your working directory with the same name as your package as they may take precedence during imports. )r0r1r=r>s r5r�z_TopLevelFinder.__exit__�s#�� �� � �c�?�+�+�+�+�+r7N) r8r9r:rr>r�r r r�r�r�r?r7r5r�r��s��������\�������A�k�A�$�s�)�A�d�3�PS�8�n�A�A�A�A�&��� ,�,�,�,�,r7r��base_dirr)c��tt|��������5}t|d��t|d��}}|�dd���t t tt��5tj ||��|� ��r3|� d���dkr ddd��ddd��dSddd��n #1swxYwY tj ||��n$#t$r}d}t|��|�d}~wwxYw ddd��d S#1swxYwYdS) N)�dirz file1.txtz file2.txt�file1r)�encodingTz�File system does not seem to support either symlinks or hard links. Strict editable installs require one of them to be supported.F)rr>rqr� write_textr�AttributeError�NotImplementedError�OSErrorrQ�symlink� is_symlink� read_textr%r`�LinksNotSupported)rSr��path1�path2rdr4s r5r0r0s�� ��H�$4�$4�$6�$6� 7� 7� 8� 8� 8��C��C��-�-�t�C��/E�/E�u�� ����7��3�3�3� �n�&9�7� C� C� � � �J�u�e� $� $� $����!�!� �e�o�o�w�o�&G�&G�7�&R�&R�� � � � � � ��������� � � � � � � � � � � ���� � � � �  1� �G�E�5� !� !� !� !��� 1� 1� 1�P� �$�C�(�(�b� 0�����  1���� �!��������������������sa�AE�AC1� E�% E�1C5 �5E�8C5 �9E�=D�E� D4�D/�/D4�4E�E � E r�rSrIc�"������fd�|D��}|st���idhfvStj�d�|���D�����t �fd�|���D����S)a[Return ``True`` if: - all packages are contained by the same parent directory, **and** - all packages become importable if the parent directory is added to ``sys.path``. >>> _simple_layout(['a'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.b'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.b'], {}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"": "src"}, "/tmp/myproj") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "a", "b": "b"}, ".") True >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a", "b": "_b"}, ".") False >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a"}, "/tmp/myproj") False >>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a.a1.a2": "_a2"}, ".") False >>> _simple_layout(['a', 'a.b'], {"": "src", "a.b": "_ab"}, "/tmp/myproj") False >>> # Special cases, no packages yet: >>> _simple_layout([], {"": "src"}, "/tmp/myproj") True >>> _simple_layout([], {"a": "_a", "": "src"}, "/tmp/myproj") False c�4��i|]}|t|������Sr?r)r�pkgrSrIs ��r5r/z"_simple_layout..4s8������ � � �s�K�� =� =���r7rDc�4�g|]\}}t||����Sr?)� _parent_path)rr-r.s r5� z"_simple_layout..:s&�� O� O� O���1��a��!3�!3� O� O� Or7c 3��K�|]E\}}tt�g|�d���R���t|��kV��FdS�rnN)�_normalize_pathr�split)r�key�valuerys �r5rz!_simple_layout..;sj������� �C�� ��V�5�c�i�i��n�n�5�5�5�6�6�/�%�:P�:P�P������r7)r�rQrT� commonpathr1�all)r�rSrI�layoutrys `` @r5r�r�s������>���������F� �.��;���B���:�-�-� �W� � � O� O�� � ��� O� O� O� P� P�F� ����� �,�,�.�.���� � �r7c��|�|��r|dt|�� �n|}|�dtjz��S)a7Infer the parent path containing a package, that if added to ``sys.path`` would allow importing that package. When ``pkg`` is directly mapped into a directory with a different name, return its own path. >>> _parent_path("a", "src/a") 'src' >>> _parent_path("b", "src/c") 'src/c' Nr)rk�len�rstriprQr)rd�pkg_pathrys r5rfrfAsJ��&.�%6�%6�s�%;�%;� I�X�j��C���y�j� !� !��F� �=�=��r�v�� &� &�&r7rNc#�K�t|jpg��Ed{V��|jpg}d�|D��}|jr |jV�n|jpg}|d�|D��z }|D]}|�d��\}}}|V�� dS)Nc��g|]}d|v�|�� S�rnr?�r�mods r5rgz"_find_packages..Ss��>�>�>�c�3�#�:�:�c�:�:�:r7c�.�g|]}d|jv� |j��Srw�r��r�xs r5rgz"_find_packages..Xs!��H�H�H�a�#���-�-�1�6�-�-�-r7rn)�iterr�� py_modules� ext_package� ext_modules� rpartition)rNr�nested_modulesr��module�package�_s r5r�r�Os������D�M�'�R�(�(�(�(�(�(�(�(�(���&�B�J�>�>�Z�>�>�>�N� ��I��������&�,�"� ��H�H�;�H�H�H�H�� �����)�)�#�.�.� ���A�� � � � ��r7c#�K�|jpg}d�|D��Ed{V��|js|jpg}d�|D��Ed{V��dSdS)Nc3�"K�|] }d|v�|V�� dSrir?rxs r5rz*_find_top_level_modules..as&����<�<��S��^�^��^�^�^�^�<�.es0����E�E�q�3�a�f�3D�3D�A�F�3D�3D�3D�3D�E�Er7)rr�r�)rNrr�s r5rErE_s�������&�B�J�<�<�z�<�<�<�<�<�<�<�<�<�<� � �F��&�,�"� �E�E�K�E�E�E�E�E�E�E�E�E�E�E�E�F�Fr7rPc�\�����fd�t|��D��}t|��S)Nc �N��i|]!}|tt|��������"Sr?)�_absolute_rootr)rrdrSrPs ��r5r/z'_find_package_roots..ms@���!�!�!� � �^�-�c�;��I�I� J� J�!�!�!r7)�sorted�_remove_nested)r�rSrP� pkg_rootss `` r5rFrFhsI���� !�!�!�!�!��(�#�#�!�!�!�I� �)� $� $�$r7rTc���t|��}|j}|���r!t|�����St|���|jz ��S)z(Works for packages and top-level modules)rryrlr>rqr�)rT�path_rys r5r�r�usY�� ��J�J�E� �\�F� �|�|�~�~�2��5�=�=�?�?�#�#�#��6�>�>�#�#�e�j�0�1�1�1r7r�c #�>K�|D]�}d|vr�|�d��}tt|��dz dd��D]Y}d�|d|���}t t ||d����}|���r||vr|V��Z��dS)a8By carefully designing ``package_dir``, it is possible to implement the logical structure of PEP 420 in a package without the corresponding directories. Moreover a parent package can be purposefully/accidentally skipped in the discovery phase (e.g. ``find_packages(include=["mypkg.*"])``, when ``mypkg.foo`` is included by ``mypkg`` itself is not). We consider this case to also be a virtual namespace (ignoring the original directory) to emulate a non-editable installation. This function will try to find these kinds of namespaces. rn�r�����NrD)rk�rangerrrUrrrl)r�rd�parts�i� partial_namerTs r5rIrI�s������ #� #�� �c�>�>� �� � �#�����s�5�z�z�A�~�q�"�-�-� #� #�A��8�8�E�"�1�"�I�.�.�L��)�,� �2�F�F�G�G�D��;�;�=�=� #�L� �$A�$A�"�"�"�"��  #� #� #r7c#��K�|D]]}t||d��}t|�����r)t|d�����s||gfV��^dS)NrDz __init__.py)rrrl)r�r�rdrTs r5rHrH�s|����� � �� ��i��4�4�� ��:�:� � � � � �t�D�-�'@�'@�'G�'G�'I�'I� ����-� � � �� � r7c�:���t|�����}tt|�������D]H\��t ��fd�|���D����r|�����I|S)Nc3�N�K�|]\}}�|kot��||��V�� dSrF)� _is_nested)r�other� other_pathrTrds ��r5rz!_remove_nested..�sR����� � �!��z� �5�L� E�Z��T�5�*�E�E� � � � � � r7)rG�copy�reversedr r1�anyr2)r�r7rTrds @@r5r�r��s����� �)�.�.�"�"� #� #�F��d�9�?�?�#4�#4�5�5�6�6��� ��T� � � � � � �%.�_�_�%6�%6� � � � � � � �J�J�s�O�O�O�� �Mr7rdrtry� parent_pathc��t|��}|�|dd���d���d��}|�|��o|tt |g|�R���kS)a� Return ``True`` if ``pkg`` is nested inside ``parent`` both logically and in the file system. >>> _is_nested("a.b", "path/a/b", "a", "path/a") True >>> _is_nested("a.b", "path/a/b", "a", "otherpath/a") False >>> _is_nested("a.b", "path/a/b", "c", "path/c") False >>> _is_nested("a.a", "path/a/a", "a", "path/a") True >>> _is_nested("b.a", "path/b/a", "a", "path/a") False rDr�rn)rjr�striprk� startswithr)rdrtryr�� norm_pkg_path�rests r5r�r��s|��$�H�-�-�M� �;�;�v�r�1� %� %� +� +�C� 0� 0� 6� 6�s� ;� ;�D� ���v��� G� �_�T�+�-E��-E�-E�-E�F�F� F�r7�filenamec��tjdkrtj�|��n|}tj�tj�tj�|������S)z1Normalize a file/dir name for comparison purposes�cygwin)�sys�platformrQrT�abspath�normcase�realpath�normpath)r�rs r5rjrj�s^��),� ��(@�(@�2�7�?�?�8� $� $� $�h�D� �7� � �B�G�,�,�R�W�-=�-=�d�-C�-C�D�D� E� E�Er7�dir_c�Z�tj|d���tj|��|S)zFCreate a directory ensured to be empty. Existing files may be removed.T)� ignore_errors)r��rmtreerQ�makedirs)r�s r5r�r��s,�� �M�$�d�+�+�+�+��K����� �Kr7r�c�^�tjdd|��}|���sJ�|S)z�Make a string safe to be used as Python identifier. >>> _make_identifier("12abc") '_12abc' >>> _make_identifier("__editable__.myns.pkg-78.9.3_local") '__editable___myns_pkg_78_9_3_local' z \W|^(?=\d)r�)�re�sub� isidentifier)r��safes r5rJrJ�s4�� �6�-��d� +� +�D� � � � � ���� �Kr7c� �eZdZd�Zd�Zd�ZdS)rrc�Z�||_||_||_||_g|_d|_dS)NF)rOrPrt� editable_namer3�dry_run)rKrOrtr�rPs r5r�z_NamespaceInstaller.__init__�s3��(��� �� � 0���*����� ��� � � r7c�V�tj�|j|j��S)zInstallation target.)rQrTrUrtr�rJs r5� _get_targetz_NamespaceInstaller._get_target�s���w�|�|�D�1�4�3E�F�F�Fr7c�D�tt|j����S)z1Where the modules/packages should be loaded from.)�reprr>rPrJs r5� _get_rootz_NamespaceInstaller._get_root�s���C�� �&�&�'�'�'r7N)r8r9r:r�r�r�r?r7r5rrrr�sD���������G�G�G�(�(�(�(�(r7rra< import sys from importlib.machinery import ModuleSpec from importlib.machinery import all_suffixes as module_suffixes from importlib.util import spec_from_file_location from itertools import chain from pathlib import Path MAPPING = {mapping!r} NAMESPACES = {namespaces!r} PATH_PLACEHOLDER = {name!r} + ".__path_hook__" class _EditableFinder: # MetaPathFinder @classmethod def find_spec(cls, fullname, path=None, target=None): for pkg, pkg_path in reversed(list(MAPPING.items())): if fullname == pkg or fullname.startswith(f"{{pkg}}."): rest = fullname.replace(pkg, "", 1).strip(".").split(".") return cls._find_spec(fullname, Path(pkg_path, *rest)) return None @classmethod def _find_spec(cls, fullname, candidate_path): init = candidate_path / "__init__.py" candidates = (candidate_path.with_suffix(x) for x in module_suffixes()) for candidate in chain([init], candidates): if candidate.exists(): return spec_from_file_location(fullname, candidate) class _EditableNamespaceFinder: # PathEntryFinder @classmethod def _path_hook(cls, path): if path == PATH_PLACEHOLDER: return cls raise ImportError @classmethod def _paths(cls, fullname): # Ensure __path__ is not empty for the spec to be considered a namespace. return NAMESPACES[fullname] or MAPPING.get(fullname) or [PATH_PLACEHOLDER] @classmethod def find_spec(cls, fullname, target=None): if fullname in NAMESPACES: spec = ModuleSpec(fullname, None, is_package=True) spec.submodule_search_locations = cls._paths(fullname) return spec return None @classmethod def find_module(cls, fullname): return None def install(): if not any(finder == _EditableFinder for finder in sys.meta_path): sys.meta_path.append(_EditableFinder) if not NAMESPACES: return if not any(hook == _EditableNamespaceFinder._path_hook for hook in sys.path_hooks): # PathEntryFinder is needed to create NamespaceSpec without private APIS sys.path_hooks.append(_EditableNamespaceFinder._path_hook) if PATH_PLACEHOLDER not in sys.path: sys.path.append(PATH_PLACEHOLDER) # Used just to trigger the path hook r�rc��tt|���d������}t�|||���S)z_Create a string containing the code for the``MetaPathFinder`` and ``PathEntryFinder``. c��|dS)Nrr?)rs r5�z"_finder_template..?s ���1��r7)rl�r�r�r)rGr�r1�_FINDER_TEMPLATE�formatr�s r5rKrK9sC�� �6�'�-�-�/�/�~�~�>�>�>�?�?�G� � "� "��g�*� "� U� U�Ur7c��eZdZdZdS)r=z�Currently there is no clear way of displaying messages to the users that use the setuptools backend directly via ``pip``. The only thing that might work is a warning, although it is not the most appropriate tool for the job... N�r8r9r:r;r?r7r5r=r=Cs���������r7r=c��eZdZdZdS)r_zCFile system does not seem to support either symlinks or hard links.Nr�r?r7r5r_r_Ks������M�M�M�Mr7r_)Wr;�loggingrQr�r�r�rar0� contextlibr�enumr�inspectr� itertoolsr�pathlibr�tempfiler�typingr r r r r rrrrr� setuptoolsrrrr�setuptools.command.build_pyrr��setuptools.discoveryr�setuptools.distrr�r� version_infor�typing_extensions�abcr r>r�r!� getLoggerr8r�r$r;r rAr�r�r�r��boolr0r�rfr�rErFr�rIrHr�r�rjr�rJ� Installerrrr�rK� UserWarningr=� FileErrorr_r?r7r5�r�s��� � ����� � � � � � � � � � � � � � � � ���������������������������������������'�'�'�'�'�'� � � � � � � � � � � � � � � � � � � � � � � � �Q�P�P�P�P�P�P�P�P�P�P�P�@�@�@�@�@�@�2�2�2�2�2�2�(�(�(�(�(�(��*�)�)�)�)�)�)���v�����������$�*�*�*�*�*�*�*�#�#�#�#�#�#� �c�4�i��� �W�T������ �'� �H� %� %��!$�!$�!$�!$�!$�D�!$�!$�!$�H���� G8�G8�G8�G8�G8�W�G8�G8�G8�T � � � � �x� � � � � � � � � � � �.D,�D,�D,�D,�D,� �D,�D,�D,�N",�",�",�",�",�",�",�",�J���$�����()��s�m�)�*.�s�C�x�.�)�GK�)� �)�)�)�)�X '� '� '� �� �(�3�-� � � � � F�,�F�8�C�=�F�F�F�F� %��s�m� %���c��"� %�� %� �#�s�(�^� %� %� %� %�2��2�3�2�2�2�2�#��S�#�X��#�8�C�=�#�#�#�#�0 ��3�i� �$(��c��N� � �e�C��c��N�#�$� � � � � �d�3��8�n� ��c�3�h�� � � � ��C��3����#��$�����.F�e�F��F�F�F�F��R��B����� �3� �3� � � � �(�(�(�(�(�*�.�(�(�(�$E��PV� �V���S��)�V�7;�C��c��N�7K�V��V�V�V�V������k����N�N�N�N�N��(�N�N�N�N�Nr7