o
    yAf}                     @  sd   d dl mZ d dlmZmZmZmZ d dlmZ er&d dl	m
Z
 d dlmZ G dd dee ZdS )	    )annotations)TYPE_CHECKINGAnyGenericcast)BuilderConfigBoundApplication)ProjectMetadatac                   @  s   e Zd ZdZdZ	 	d.d/ddZed0ddZed1ddZed2ddZ	ed3ddZ
ed4ddZed1dd Zed1d!d"Zd5d%d&Zd6d)d*Zd7d,d-ZdS )8BuildHookInterfacea  
    Example usage:

    ```python tab="plugin.py"
    from hatchling.builders.hooks.plugin.interface import BuildHookInterface


    class SpecialBuildHook(BuildHookInterface):
        PLUGIN_NAME = 'special'
        ...
    ```

    ```python tab="hooks.py"
    from hatchling.plugin import hookimpl

    from .plugin import SpecialBuildHook


    @hookimpl
    def hatch_register_build_hook():
        return SpecialBuildHook
    ```
     Nrootstrconfigdict[str, Any]build_configr   metadatar
   	directorytarget_nameappApplication | NonereturnNonec                 C  s.   || _ || _|| _|| _|| _|| _|| _d S N)_BuildHookInterface__root_BuildHookInterface__config!_BuildHookInterface__build_config_BuildHookInterface__metadata_BuildHookInterface__directory _BuildHookInterface__target_name_BuildHookInterface__app)selfr   r   r   r   r   r   r    r"   N/usr/lib/python3.10/site-packages/hatchling/builders/hooks/plugin/interface.py__init__(   s   

zBuildHookInterface.__init__r	   c                 C  s.   | j du rddlm} t||  | _ | j S )za
        An instance of [Application](../utilities.md#hatchling.bridge.app.Application).
        Nr   r   )r    hatchling.bridge.appr	   r   Zget_safe_application)r!   r	   r"   r"   r#   r   :   s   
zBuildHookInterface.appc                 C     | j S )z/
        The root of the project tree.
        )r   r!   r"   r"   r#   r   F      zBuildHookInterface.rootc                 C  r&   )z
        The cumulative hook configuration.

        ```toml config-example
        [tool.hatch.build.hooks.<PLUGIN_NAME>]
        [tool.hatch.build.targets.<TARGET_NAME>.hooks.<PLUGIN_NAME>]
        ```
        )r   r'   r"   r"   r#   r   M   s   
zBuildHookInterface.configc                 C  r&   r   )r   r'   r"   r"   r#   r   Y   s   zBuildHookInterface.metadatac                 C  r&   )zj
        An instance of [BuilderConfig](../utilities.md#hatchling.builders.config.BuilderConfig).
        )r   r'   r"   r"   r#   r   ^   r(   zBuildHookInterface.build_configc                 C  r&   )z&
        The build directory.
        )r   r'   r"   r"   r#   r   e   r(   zBuildHookInterface.directoryc                 C  r&   )z6
        The plugin name of the build target.
        )r   r'   r"   r"   r#   r   l   r(   zBuildHookInterface.target_nameversions	list[str]c                 C     dS )z
        This occurs before the build process if the `-c`/`--clean` flag was passed to
        the [`build`](../../cli/reference.md#hatch-build) command, or when invoking
        the [`clean`](../../cli/reference.md#hatch-clean) command.
        Nr"   )r!   r)   r"   r"   r#   cleans       zBuildHookInterface.cleanversion
build_datac                 C  r+   )z
        This occurs immediately before each build.

        Any modifications to the build data will be seen by the build target.
        Nr"   )r!   r.   r/   r"   r"   r#   
initializez   r-   zBuildHookInterface.initializeartifact_pathc                 C  r+   )a  
        This occurs immediately after each build and will not run if the `--hooks-only` flag
        was passed to the [`build`](../../cli/reference.md#hatch-build) command.

        The build data will reflect any modifications done by the target during the build.
        Nr"   )r!   r.   r/   r1   r"   r"   r#   finalize   r-   zBuildHookInterface.finalizer   )r   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   )r   r	   )r   r   )r   r   )r   r
   )r   r   )r)   r*   r   r   )r.   r   r/   r   r   r   )r.   r   r/   r   r1   r   r   r   )__name__
__module____qualname____doc__ZPLUGIN_NAMEr$   propertyr   r   r   r   r   r   r   r,   r0   r2   r"   r"   r"   r#   r      s.    


r   N)
__future__r   typingr   r   r   r   Zhatchling.builders.configr   r%   r	   Zhatchling.metadata.corer
   r   r"   r"   r"   r#   <module>   s    