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)MetadataHookInterface)load_plugin_from_script)DEFAULT_BUILD_SCRIPTc                   @  s   e Zd ZdZdddZdS )CustomMetadataHookZ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 metadata hook `z` must be a stringz` must not be empty if definedzBuild script does not exist: Zmetadata_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   >/usr/lib/python3.10/site-packages/hatchling/metadata/custom.py__new__   s   

zCustomMetadataHook.__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.metadata.plugin.interfacer   Zhatchling.plugin.utilsr   Zhatchling.utils.constantsr   r   r   r   r   r   <module>   s    