o
    yAf:                     @  s   d dl mZ d dlZd dlmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ er:d d	lmZ G d
d dee ZdS )    )annotationsN)TYPE_CHECKINGAnyGeneric)BuilderInterface)ProjectMetadata)PluginManagerBound)load_plugin_from_script)DEFAULT_BUILD_SCRIPT)Applicationc                   @  s$   e Zd ZdZ				ddddZdS )CustomBuilderZcustomNrootstrplugin_managerPluginManagerBound | Noneconfigdict[str, Any] | NonemetadataProjectMetadata | NoneappApplication | Nonereturnr   c                 C  s   t |||}|jj| ji }t|tsd| j d}t||dt}	t|	t	s5d| j d}t||	sBd| j d}t
|tjtj||	}
tj|
s\d|	 }t|t|
|	td}||||||d	}| j|_|S )
Nz Field `tool.hatch.build.targets.z` must be a tablepathzOption `path` for builder `z` must be a stringz` must not be empty if definedzBuild script does not exist: Zbuilder)r   r   r   r   )r   ZhatchZbuild_targetsgetPLUGIN_NAME
isinstancedict	TypeErrorr
   r   
ValueErrorosr   normpathjoinisfileOSErrorr	   r   )clsr   r   r   r   r   Zproject_metadataZtarget_configmessageZbuild_scriptr   Z
hook_classhook r'   >/usr/lib/python3.10/site-packages/hatchling/builders/custom.py__new__   s(   


zCustomBuilder.__new__)NNNN)r   r   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   r   r   Z#hatchling.builders.plugin.interfacer   Zhatchling.metadata.corer   Zhatchling.plugin.managerr   Zhatchling.plugin.utilsr	   Zhatchling.utils.constantsr
   Zhatchling.bridge.appr   r   r'   r'   r'   r(   <module>   s    