
    d.:                     ~    d Z ddlZddlmZmZmZmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZ  G d d	e	          ZdS )
zdistutils.bcppcompiler

Contains BorlandCCompiler, an implementation of the abstract CCompiler class
for the Borland C++ compiler.
    N)DistutilsExecErrorCompileErrorLibError	LinkErrorUnknownFileError)	CCompilergen_preprocess_options)
write_file)newer)logc                       e Zd ZdZdZi ZdgZg dZeez   ZdZ	dZ
dZdxZZd	Z	 	 	 ddZ	 	 ddZ	 	 	 ddZ	 	 	 	 	 	 	 	 	 	 ddZddZ	 	 ddZ	 	 	 	 	 ddZdS )BCPPCompilerzConcrete class that implements an interface to the Borland C/C++
    compiler, as defined by the CCompiler abstract class.
    bcppz.c)z.ccz.cppz.cxxz.objz.libz.dllz%s%sz.exer   c                     t          j        | |||           d| _        d| _        d| _        d | _        g d| _        g d| _        g d| _        g d| _	        g | _
        g d| _        g d| _        d S )	Nz	bcc32.exezilink32.exeztlib.exe)/tWMz/O2/q/g0)r   z/Odr   r   )z/Tpd/Gnr   /x)r   r   r   )r   r   r   z/r)r   __init__cclinkerlibpreprocess_optionscompile_optionscompile_options_debugldflags_sharedldflags_shared_debugldflags_staticldflags_exeldflags_exe_debug)selfverbosedry_runforces       (  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/distutils/bcppcompiler.pyr   zBCPPCompiler.__init__5   s    
 	D'7E::: #"&;;;%A%A%A"999$?$?$?! ...!9!9!9    Nc	                 ~   |                      ||||||          \  }}	}}
}|pg }|                    d           |r|                    | j                   n|                    | j                   |	D ]H}	 ||         \  }}n# t
          $ r Y w xY wt          j                            |          }t          j                            |          }| 	                    t          j        
                    |                     |dk    r|dk    r=	 |                     dd||g           n!# t          $ r}t          |          d }~ww xY w|| j        v rd}n|| j        v rd}nd}d|z   }	 |                     | j        g|z   |
z   ||gz   |z   |gz              )# t          $ r}t          |          d }~ww xY w|	S )	Nz-c.res.rcbrcc32z-fo z-P-o)_setup_compileappendextendr   r   KeyErrorospathnormpathmkpathdirnamespawnr   r   _c_extensions_cpp_extensionsr   )r"   sources
output_dirmacrosinclude_dirsdebugextra_preargsextra_postargsdependsobjectspp_optsbuildcompile_optsobjsrcextmsg	input_opt
output_opts                      r&   compilezBCPPCompiler.compileQ   sF   
 ##Jg$+^= = 	8% %*T""" 	7!;<<<<!5666 ,	( ,	(C :SS    '""3''C'""3''C KK,,---f}}e||,JJ5#s ;<<<<) , , ,&s+++, d(((		,,, 		
 	J
(

TWI4w>&
34*+.1U3 4 4 4 4 & ( ( ("3'''( sB   7B
BBD++
E	5EE	--F
F:&F55F:c                 T   |                      ||          \  }}|                     ||          }|                     ||          rL|dg|z   }|r	 	 |                     | j        g|z              d S # t
          $ r}t          |          d }~ww xY wt          j        d|           d S )N)r;   z/uskipping %s (up-to-date))	_fix_object_argslibrary_filename
_need_linkr7   r   r   r   r   r>   )	r"   rB   output_libnamer;   r>   target_langoutput_filenamelib_argsrI   s	            r&   create_static_libzBCPPCompiler.create_static_lib   s     !% 5 5w
 K K*!!>j!II 	 ??G_55 		C'.8H $

TXJ122222% $ $ $smm#$ I0/BBBBBs   A2 2
B<BBc                    |                      ||          \  }}|                     |||          \  }}}|r"t          j        dt	          |                     | t
          j                            ||          }|                     ||          r|t          j
        k    r$d}|	r| j        d d          }n3| j        d d          }n#d}|	r| j        d d          }n| j        d d          }|d}nt
          j                            |          \  }}t
          j                            |          \  }}t
          j                            |d                   }t
          j                            |d|z            }dg}|pg D ]}|                    d|d	|           |                     t(          ||fd
|z             t+          t
          j        j        |          }|g}g }|D ]r}t
          j                            t
          j                            |                    \  }}|dk    r|                    |           ]|                    |           s|D ]7}|                    dt
          j                            |          z             8|                    d           |                    |           |                    d|g           |                    d           |D ]F}|                     |||	          }||                    |           1|                    |           G|                    d           |                    d           |                    d|g           |                    d           |                    |           |
r|
|d d<   |r|                    |           |                     t
          j                            |                     	 |                     | j        g|z              d S # t:          $ r}t=          |          d }~ww xY wt          j        d|           d S )Nz7I don't know what to do with 'runtime_library_dirs': %sc0w32c0d32r,   r   z%s.defEXPORTSz  z=_z
writing %sr)   z/L%sz/L.,z,,import32cw32mtrN   ) rO   _fix_lib_argsr   warnstrr2   r3   joinrQ   r   
EXECUTABLEr!   r    r   r   splitsplitextr6   r/   executer
   mapr4   normcaser0   find_library_filer5   r7   r   r   r   r>   ) r"   target_descrB   rT   r;   	librarieslibrary_dirsruntime_library_dirsexport_symbolsr>   r?   r@   
build_temprS   startup_objld_argsdef_fileheadtailmodnamerH   temp_dircontentssymobjects2	resourcesfilebaselr   libfilerI   s                                    r&   linkzBCPPCompiler.link   s   $ !% 5 5w
 K K*	<9MNN 	8L"6   	0HN-..0 0 0 ! gllJHHO??G_55 e	C i222% 2"4QQQ7GG".qqq1GG% 5"7:GG"1!!!4G %W]]O<<
d!w//667??71:667<<8g3EFF%;*0b = =COOO###ss$;<<<<Z(H)=)H46 6 6 27+W55H #mGI  ) ) g..rw/?/?/E/EFFs&==$$T****NN4(((( " = =v(8(8(;(;;<<<<NN5!!! NN7### NNC0111NN4     	, 	, 00sEJJ?NN3'''' NN7++++ NNJ'''NNH%%% NNC>***NN3NN9%%%  ,+ /~...KK/::;;;%

T[MG344444% % % %nn$% I0/BBBBBs   0P 
P.P))P.c                     |r|dz   }|dz   |dz   ||f}n|dz   |f}|D ]_}|D ]Z}t           j                            ||                     |                    }t           j                            |          r|c c S [`d S )N_d_bcpp)r2   r3   ra   rP   exists)	r"   dirsr   r>   dlib	try_namesdirnamer}   s	            r&   rh   zBCPPCompiler.find_library_file4  s      	-$JDwcBIIw,I 	 	C! # #',,sD,A,A$,G,GHH7>>'** #"NNNNN## 4r'   r,   c                    |d}g }|D ]=}t           j                            t           j                            |                    \  }}|| j        ddgz   vrt          d|d|d          |rt           j                            |          }|dk    r7|                    t           j                            |||z                        |dk    r8|                    t           j                            ||dz                        |                    t           j                            ||| j	        z                        ?|S )Nr,   r*   r)   zunknown file type 'z	' (from 'z'))
r2   r3   rd   rg   src_extensionsr   basenamer/   ra   obj_extension)r"   source_filenames	strip_dirr;   	obj_namessrc_namer{   rH   s           r&   object_filenameszBCPPCompiler.object_filenamesN  sX    Bz	( 	H 	HH'**BG,<,<X,F,FGGKT34.%?@@&&ssHHH(& ' ' ' /w''..f}}  "',,
D3J"G"GHHHH  "',,
D6M"J"JKKKK  "',,
,043E,E#G #G H H H Hr'   c                 0   |                      d ||          \  }}}t          ||          }dg|z   }	||	                    d|z              |r||	d d<   |r|	                    |           |	                    |           | j        s|t          ||          r||r2|                     t          j        	                    |                     	 | 
                    |	           d S # t          $ r#}
t          |
           t          |
          d }
~
ww xY wd S )Nz	cpp32.exer-   r   )_fix_compile_argsr	   r/   r0   r%   r   r5   r2   r3   r6   r7   r   printr   )r"   sourceoutput_filer<   r=   r?   r@   _rC   pp_argsrI   s              r&   
preprocesszBCPPCompiler.preprocessi  sB    ""4>> 	"FL(>>-')"NN4+-... 	('GBQBK 	+NN>***v
 : 	(,fk0J0J, :BGOOK88999(

7#####% ( ( (c


"3'''( -,s   C& &
D0DD)r   r   r   )NNNr   NNN)Nr   N)
NNNNNr   NNNN)r   )r   r,   )NNNNN)__name__
__module____qualname____doc__compiler_typeexecutablesr8   r9   r   r   static_lib_extensionshared_lib_extensionstatic_lib_formatshared_lib_formatexe_extensionr   rL   rV   r~   rh   r   r    r'   r&   r   r      sa         M K FM---O #_4NM!!,22)M : : : :: HIAE< < < <H '+!"'+C C C C: #'! !BC BC BC BCR   8 %&%'   : !%!%"&#'( ( ( ( ( (r'   r   )r   r2   distutils.errorsr   r   r   r   r   distutils.ccompilerr   r	   distutils.file_utilr
   distutils.dep_utilr   	distutilsr   r   r   r'   r&   <module>r      s     
			9 9 9 9 9 9 9 9 9 9 9 9 9 9' ' ' ' ' ' ' ' * * * * * * $ $ $ $ $ $      n( n( n( n( n(9 n( n( n( n( n(r'   