
    ?e(                         d dl mZ d dlmZ d dlmZ d dlmZmZ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e          Z G d de          ZdS )    )	build_ext)Distribution)	Extension)ERRORINFOset_thresholdN   )BuildableModule)BuilderUserException)Installablec                   <    e Zd ZdZdddZdddZdddZd	 ZdS )
DistutilsBuilderz: The implementation of a distutils-based project builder. T)fatalc                     t          d          )z{ Build an executable from a BuildableExecutable object and return
        the relative pathname of the executable.
        z)DistutilsBuilder cannot build executablesr   )self	buildabler   s      :lib/python3.11/site-packages/sipbuild/distutils_builder.pybuild_executablez!DistutilsBuilder.build_executable(   s    
 GHHH    N)	wheel_tagc                   | j         }d}|j        dk    rJdt          j        vr<|j        r5d                    d |j        D                       }|t          j        d<   d}|j        D ]v}t          |t                    r,|j	        rt          d          |                     |           Ct          d                    t          |          j                            |rt          j        d= d	S d	S )
z Build the project. FdarwinMACOSX_DEPLOYMENT_TARGET.c                 ,    g | ]}t          |          S  )str).0vs     r   
<listcomp>z2DistutilsBuilder.build_project.<locals>.<listcomp>=   s    KKKSVVKKKr   Tz,DistutilsBuilder cannot build static modulesz.DistutilsBuilder cannot build '{0}' buildablesN)projectpy_platformosenvironminimum_macos_versionjoin
buildables
isinstancer
   staticr   _build_extension_moduleformattype__name__)r   
target_dirr   r#   remove_macos_targetmacos_targetr   s          r   build_projectzDistutilsBuilder.build_project/   s0    , $(** *;;0 /#&88KKW-JKKK$M $ML=IBJ9:*.' !+ 
	; 
	;I)_55 	;# L'JL L L ,,Y7777#HOO $Y 8: :; ; ;
  	7
5666	7 	7r   c          
      `   | j         }g }|j        D ]}|                    ||           |j        D ]"}|j        D ]}|                    ||           #|j        rSddlm}  ||                    |          |||j        |                                |j	        |j
        |j                   dS dS )z. Install the project into a target directory. r	   )create_distinfoN)r#   installablesinstallr)   distinfor5   get_distinfo_dirmetadataget_requires_distsroot_dirconsole_scriptsgui_scripts)r   r0   r   r#   	installedinstallabler   r5   s           r   install_projectz DistutilsBuilder.install_projectR   s    ,	 #/ 	7 	7K
I6666 !+ 	; 	;I(5 ; ;##J	::::;  	)111111OG44Z@@)w/1K1K1M1M$g&=') ) ) ) )	) 	)r   c                    | j         }t          |j        rt          nt                     t                      }t          ||          }|j        |_        |j	        |_	        |j	        rd|_
        |                                 g }|j        D ]T}|                    dd          }|d         }	 |d         }	n# t          $ r d}	Y nw xY w|                    ||	f           U|                                 t#          |j        |j        ||j        |j        |j        |j        |j        |j        	  	        g|_        |                    d                    |j                             t;          j                    }
t;          j        |j                   	 |                                  nH# tB          $ r;}tE          d	                    |j                  tG          |          
          d}~ww xY wtI          d|%                                          }|j&                            |'                    |j                             |j(                            |           t;          j        |
           dS )z- Build an extension module from the sources. NDEBUG=r	   )maxsplitr   N)define_macrosextra_compile_argsextra_link_argsextra_objectsinclude_dirs	librarieslibrary_dirszCompiling the '{0}' modulez"Unable to compile the '{0}' module)detailmodule)target_subdir))r#   r   verboser   r   r   ExtensionCommand	build_dir	build_libdebugundefensure_finalizedrF   split
IndexErrorappendmake_names_relativer   fq_namesourcesrG   rH   rI   rJ   rK   rL   
extensionsprogressr-   r%   getcwdchdirrun	Exceptionr   r   r   get_install_subdirfilesget_ext_fullpathr6   )r   r   r#   distributionmodule_builderrF   macropartsnamevalue	saved_cwder@   s                r   r,   z(DistutilsBuilder._build_extension_modulej   s    ,go8dd5999#~~),	BB#,#6 (? 	,#+N ''))) , 	0 	0EKKaK00E8Da      $////%%''' i'):"/'0'C$-$="+"9!*!7'1!*!79 9 9%:! 	,33I4EFF	H 	H 	H IKK	
$%%%	#     	# 	# 	#8??%-/ /q66# # # #	# "('::<<> > >  //	0ABB	D 	D 	D%%k222
s*   -B66CCF) )
G.36G))G.)r/   
__module____qualname____doc__r   r3   rA   r,   r   r   r   r   r   %   s        DD37 I I I I I 6: !7 !7 !7 !7 !7F 8< ) ) ) ) )0@ @ @ @ @r   r   c                   (     e Zd ZdZ fdZd Z xZS )rQ   z< Extend the distutils command to build an extension module. c                 X    t                                          |           || _        dS )z Initialise the object. N)super__init__
_buildable)r   rf   r   	__class__s      r   rt   zExtensionCommand.__init__   s(     	&&&#r   c                     t          j        j        |                    d           | j                                        z   S )z; Reimplemented to handle modules that use the limited API. r   )r%   pathr(   rW   ru   get_module_extension)r   ext_names     r   get_ext_filenamez!ExtensionCommand.get_ext_filename   s2     w|X^^C001DO4X4X4Z4ZZZr   )r/   rn   ro   rp   rt   r{   __classcell__)rv   s   @r   rQ   rQ      sT        FF$ $ $ $ $[ [ [ [ [ [ [r   rQ   )distutils.command.build_extr   distutils.distr   distutils.extensionr   distutils.logr   r   r   r%   r   r
   builderr   
exceptionsr   r@   r   r   rQ   r   r   r   <module>r      s  0 2 1 1 1 1 1 ' ' ' ' ' ' ) ) ) ) ) ) 4 4 4 4 4 4 4 4 4 4 				 & & & & & &       % % % % % % $ $ $ $ $ $E E E E Ew E E EP[ [ [ [ [y [ [ [ [ [r   