o
    yAf\                     @  sV   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 G dd dZdS )	    )annotationsN)Any)BuildHookInterface)load_plugin_from_script)DEFAULT_BUILD_SCRIPTc                   @  s   e Zd ZdZdddZdS )CustomBuildHookZcustomrootstrconfigdict[str, Any]argsr   kwargsreturnr   c           
      O  s   | dt}t|tsd| j d}t||s#d| j d}t|tj	tj
||}tj|s=d| }t|t||td}|||g|R i |}	| j|	_|	S )NpathzOption `path` for build hook `z` must be a stringz` must not be empty if definedzBuild script does not exist: Z
build_hook)getr   
isinstancer	   PLUGIN_NAME	TypeError
ValueErrorosr   normpathjoinisfileOSErrorr   r   )
clsr   r
   r   r   Zbuild_scriptmessager   Z
hook_classhook r   D/usr/lib/python3.10/site-packages/hatchling/builders/hooks/custom.py__new__   s   

zCustomBuildHook.__new__N)
r   r	   r
   r   r   r   r   r   r   r   )__name__
__module____qualname__r   r   r   r   r   r   r      s    r   )
__future__r   r   typingr   Z)hatchling.builders.hooks.plugin.interfacer   Zhatchling.plugin.utilsr   Zhatchling.utils.constantsr   r   r   r   r   r   <module>   s    