o
    nc                     @  s|   d dl mZ d dlZddlmZ ddlmZmZ ddlmZm	Z	m
Z
mZ ddlmZ dd	lmZ G d
d deZdd ZdS )    )annotationsN   )mesonlib   )ExtensionModule
ModuleInfo)typed_pos_args	noPosargsnoKwargspermittedKwargs)known_shmod_kwargs)ExternalProgramc                      sp   e Zd ZeddddZ fddZeedd Ze	e
d	d
 Ze	e
dd Ze
ededd Z  ZS )Python3Modulepython3z0.38.0z0.48.0)Z
deprecatedc                   s4   t  j|i | | j| j| j| j| jd d S )N)extension_modulefind_pythonlanguage_versionsysconfig_path)super__init__methodsupdater   r   r   r   )selfargskwargs	__class__ yhome/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/modules/python3.pyr      s   zPython3Module.__init__c                 C  sl   d|v r	t dd|v rt d|jj}|dkrd}n	|dkr$d}ng }d	|d< ||d< | jd ||S )
NZname_prefixz=Name_prefix is set automatically, specifying it is forbidden.Zname_suffixz=Name_suffix is set automatically, specifying it is forbidden.darwinsowindowsZpyd )r   MesonExceptionZhost_machinesysteminterpreterZfunc_shared_module)r   stater   r   Zhost_systemsuffixr   r   r   r   &   s   

zPython3Module.extension_modulec                 C  s>   |j tjjd}|d urtd|}|S tdtjdd}|S )Nr   T)Zsilent)environmentZlookup_binary_entryr   ZMachineChoiceZHOSTr   Z
from_entryZpython_command)r   r&   r   r   commandZpy3r   r   r   r   9   s   zPython3Module.find_pythonc                 C  s   t  S N)	sysconfigget_python_version)r   r&   r   r   r   r   r   r   C   s   zPython3Module.language_versionzpython3.sysconfig_pathc                 C  sL   |d }t  }||vrt| d| dt j|ddddddd  S )Nr   z is not a valid path name .r"   )baseplatbaseinstalled_base)varsr   )r+   get_path_namesr   r#   get_path)r   r&   r   r   Z	path_nameZvalid_namesr   r   r   r   H   s
   zPython3Module.sysconfig_path)__name__
__module____qualname__r   INFOr   r   r   r   r	   r
   r   r   r   strr   __classcell__r   r   r   r   r      s    	
r   c                  O  s   t | i |S r*   )r   )r   r   r   r   r   
initializeT   s   r:   )
__future__r   r+   r"   r   r   r   Zinterpreterbaser   r	   r
   r   buildr   Zprogramsr   r   r:   r   r   r   r   <module>   s   ;