Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/setuptools/command/__pycache__/editable_wheel.cpython-37.pyc
Назад
B �5�g�| � @ sV d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZ ddlmZ dd lmZmZmZmZmZmZmZmZmZmZ d dlmZmZm Z m!Z!m"Z" d dl#m$Z$ d d l%m&Z& d dl'm(Z(m)Z)m*Z* ddl+m+Z, e�r ddl-m.Z. ej/dk�r$ddlm0Z0 n e�r8ddl1m0Z0 nddl2m3Z0 ee4ef Z5ede5d�Z6e�7e8�Z9G dd� de �Z:dZ;dZ<G dd� de�Z=G dd� de0�Z>G dd � d �Z?G d!d"� d"e?�Z@G d#d$� d$�ZAeeBd%�d&d'�ZCee4 ee4e4f eeBd(�d)d*�ZDd+d,� ZEe&ee4 d-�d.d/�ZFe&ee4 d-�d0d1�ZGee4 ee4e4f e5ee4e4f d2�d3d4�ZHe5e4d5�d6d7�ZIee4e4f ee4 d8�d9d:�ZJee4 ee4e4f eee4ee4 f d;�d<d=�ZKee4e4f ee4e4f d8�d>d?�ZLe4e4e4e4eBd@�dAdB�ZMe6e6dC�dDdE�ZNG dFdG� dGe"jO�ZPdHZQe4ee4e4f ee4ee4 f e4dI�dJdK�ZRG dLdM� dMe!jS�ZTG dNdO� dOe*�ZUdS )Pa� 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�_normalization�_path�errors� namespaces)�find_package_path)�Distribution)�InformationOnly�SetuptoolsDeprecationWarning�SetuptoolsWarning� )�build_py)� WheelFile)� � )�Protocol)�ABC�_P)Zboundc @ s4 e Zd ZdZdZdZdZeee d d�dd��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). �strictZlenient�compat)�mode�returnc C sN |s t jS |�� }|t jkr.t�d|�d���|dkrFtjdddd� t | S )NzInvalid editable mode: z. Try: 'strict'.�COMPATzCompat editable installsa 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. zuserguide/development_mode.html)Zsee_docs)r% �LENIENT�upper�__members__r �OptionErrorr �emit)�clsr( �_mode� r2 �I/tmp/pip-install-251nq386/setuptools/setuptools/command/editable_wheel.py�convertP s z_EditableMode.convertN)�__name__� __module__�__qualname__�__doc__�STRICTr+ r* �classmethodr �strr4 r2 r2 r2 r3 r% D s r% 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 @ s e Zd ZdZdZddddeejp"d�fgZdd � Zd d� Z dd � Z dd� Zdd� Ze e d�dd�Zeeeed�dd�Zdd� Zeee eeef f d�dd�Zeeeeeee eeef f d�dd�Zdd � Zed!�d"d#�Zd$d%� Zed&�d'd(�Zeeed)d*�d+d,�ZdS )-�editable_wheelz�Build 'editable' wheel for development. This command is private and reserved for internal use of setuptools, users should rely on ``setuptools.build_meta`` APIs. zBDO NOT CALL DIRECTLY, INTERNAL ONLY: create 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 C s d | _ d | _d | _d | _d S )N)�dist_dir� dist_info_dir�project_dirr( )�selfr2 r2 r3 �initialize_options� s z!editable_wheel.initialize_optionsc C s@ | j }|jptj| _|jpi | _t| jp6tj� | jd��| _d S )N�dist) �distribution�src_root�os�curdirrB �package_dirr r@ �path�join)rC rE r2 r2 r3 �finalize_options� s zeditable_wheel.finalize_optionsc C s� yD| j jdd� | �� | �d� | �d�}|�| j� | �|� W n< tk r� t � � | jjpl| j� � }tj|d� � Y nX d S )NT)�exist_ok�bdist_wheel)�project)r@ �mkdir�_ensure_dist_info�reinitialize_command�get_finalized_commandZwrite_wheelfilerA �_create_wheel_file� Exception� traceback� print_excrF �name�get_name�_DebuggingTipsr/ )rC rO rP r2 r2 r3 �run� s zeditable_wheel.runc C sb | j d kr6| �d�}| j|_|�� |�� |j | _ n(t| j ��d�sJt�t | j d�� � s^t�d S )N� dist_infoz .dist-info�METADATA)rA rS r@ � output_dir�ensure_finalizedr\ r; �endswith�AssertionErrorr �exists)rC r] r2 r2 r3 rR � s z editable_wheel._ensure_dist_infoc C sD | j }|jsd S t| j| j�dd���� }t||||�}|�� d S )Nr? �.) rF Znamespace_packagesr rB rJ �get�resolve�_NamespaceInstallerZinstall_namespaces)rC �installation_dirZ pth_prefixrE rG � installerr2 r2 r3 �_install_namespaces� s z"editable_wheel._install_namespaces)r) c C s2 | j rt| j �jnt� }tt|�d��}t|d �S )Nz *.egg-info)rA r �parent�mapr; �glob�next)rC � parent_dir� candidatesr2 r2 r3 �_find_egg_info_dir� s z!editable_wheel._find_egg_info_dir)rY �unpacked_wheel� build_lib�tmp_dirc C s | j }t|�}t|�}tt||� d�d��}tt||� d�d��}tt||� d�d��} |jddd�} t|�| _d| _|jddd�}|jd dd�}| |_ |_|_| |_ |_ |_| |_|_ ||_||_|�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_scriptsr FN)rF r; r rS Zegg_baseZignore_egg_info_in_manifest� build_platlib� build_purelibrs �install_purelib�install_platlib�install_libr| � build_scripts�install_headers�install_data�get_command_objZno_ep� build_temp�compilerq Zexisting_egg_info_dir�_set_editable_moder` )rC rY rr rs rt rE �wheelru rv rw rx rz r{ r| r r2 r2 r3 �_configure_build� s2 zeditable_wheel._configure_buildc C sR | j }|�d�}x<|�� D ]0}|�|�}t|d�r:d|_qt|d�rd|_qW dS )z8Set the ``editable_mode`` flag in the build sub-commandsrz � editable_modeT�inplaceN)rF r� �get_sub_commands�hasattrr� r� )rC rE rz �cmd_name�cmdr2 r2 r3 r� � s z!editable_wheel._set_editable_modec C sn g }i }| � d�}xR|�� D ]F}| � |�}t|d�rF|�|�� pBg � t|d�r|�|�� p^i � qW ||fS )Nrz �get_outputs�get_output_mapping)rT r� r� �extendr� �updater� )rC �files�mappingrz r� r� r2 r2 r3 �_collect_build_outputs� s z%editable_wheel._collect_build_outputs)� dist_namerr rs rt r) c C sJ | � ||||� | �� | �� \}}| �d� | �d� | �d� ||fS )Nrv rw ru )r� �_run_build_subcommandsr� �_run_install)rC r� rr rs rt r� r� r2 r2 r3 �_run_build_commands s z"editable_wheel._run_build_commandsc C sT | � d�}xD|�� D ]8}| � |�}|dkrBt|�tkrB| �|� q| �|� qW dS )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. rz r N)rT r� �type�build_py_cls�_safely_run�run_command)rC rz rY r� r2 r2 r3 r� s z%editable_wheel._run_build_subcommands)r� c C sH y | � |�S tk rB t�ddt�� � d|� d|� d�� Y nX d S )Nz0Customization incompatible with editable installz z� If you are seeing this warning it is very likely that a setuptools plugin or customization overrides the `a ` command, without taking into consideration how editable installs run build steps starting from setuptools v64.0.0. Plugin authors and developers relying on custom build steps are encouraged to update their `ab ` implementation considering the information about editable installs in https://setuptools.pypa.io/en/latest/userguide/extension.html. For the time being `setuptools` will silence this error and ignore the faulty command, but this behaviour will change in future versions. )r� rV r r/ rW � format_exc)rC r� r2 r2 r3 r� ( s zeditable_wheel._safely_runc C s> ddl m} | �d�}|j}d�|�� �}d}|� d|� d|� d�}t| j|�}|�� r`|� � t |d�} t dd�} t d d�}| ��}| ��} |��}t|t| j�j�}t� | j|� | �||j� | �||| |�\}}| �||| �}|�2 ||d ��}||||� |�|� W d Q R X W d Q R X W d Q R X W d Q R X W d Q R X |S )Nr )r r] �-z 0.editablez.whl)�suffixz .build-libz.build-temp�w)�wheel.wheelfiler rT rY rL Zget_tagr r@ rc �unlinkr rA �shutil�copytreerj r� �_select_strategyZwrite_files)rC rO r r] r� �tag� build_tag�archive_name� wheel_pathrr rs Z build_tmpZunpacked�lib�tmpZunpacked_dist_infor� r� ZstrategyZ wheel_objr2 r2 r3 rU D s, <z!editable_wheel._create_wheel_file)�categoryc C sD t | jd|� �d �}|r@|� r@t�d|� d�� | �d|� �� d S )NZhas_zInstalling z as non editable�install_)�getattrrF �_logger�infor� )rC r� Zhas_categoryr2 r2 r3 r� ` s zeditable_wheel._run_install�EditableStrategy)rY r� rs r) c C s� d|� d|� �}t | j�}t�| j�}|tjkrRtt | jd|��}t| j|||�S t | j�}t || j|�} |tjk} t | j�dhkr�| s�| r�| j�dd�}t| j|t ||�g�S t| j|�S )zDDecides which strategy to use to implement an editable installation.z __editable__.r� rz r? rd )r rB r% r4 r( r9 � _empty_dir� _LinkTreerF �_find_packages�_simple_layoutrJ r* �setre � _StaticPth�_TopLevelFinder)rC rY r� rs Z build_namerB r( � auxiliary_dir�packagesZhas_simple_layoutZis_compat_mode�src_dirr2 r2 r3 r� f s zeditable_wheel._select_strategy)r5 r6 r7 r8 �descriptionr r% �user_optionsrD rM r\ rR rj r r; rq �_Pathr� r� r r r r� r� r� r� rU r� r� r2 r2 r2 r3 r<