
    09oe9                         d Z ddl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  ej        de            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)logzbcppcompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.c                        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 fd	Z	 	 	 	 	 	 	 ddZ	 ddZ	 	 	 	 	 	 	 	 	 	 ddZddZddZ	 	 	 	 	 ddZ xZ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                                          |||           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)super__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force	__class__s       [D:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/_distutils/bcppcompiler.pyr   zBCPPCompiler.__init__B   s    '5111 #"&;;;%A%A%A"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.compileZ   sQ    ;?:M:Mgw;
 ;
7% %*D!!! 	6 :;;;; 4555 1	( 1	(C :SS    '""3''C'""3''C KK,,---f}}e||,JJ%c:;;;;) , , ,&s+++, d(((		,,, 		
 	J

(

WI"# !*-. %	%
 e    & ( ( ("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_linkr9   r   r   r   r   r@   )	r#   rD   output_libnamer=   r@   target_langoutput_filenamelib_argsrK   s	            r(   create_static_libzBCPPCompiler.create_static_lib   s     !% 5 5gz J J*//:/VV??7O44 		C'.8H $

DH:011111% $ $ $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                    ||                     ,|                     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
writing %sr+   z/L%sz/L.,z,,import32cw32mtrP   )!rQ   _fix_lib_argsr   warnstrr4   r5   joinrS   r   
EXECUTABLEr"   r!   r   r   splitsplitextr8   r1   formatexecuter
   mapr6   normcaser2   find_library_filer7   r9   r   r   r   r@   ) r#   target_descrD   rV   r=   	librarieslibrary_dirsruntime_library_dirsexport_symbolsr@   rA   rB   
build_temprU   startup_objld_argsdef_fileheadtailmodnamerJ   temp_dircontentssymobjects2	resourcesfilebaseellr   libfilerK   s                                    r(   linkzBCPPCompiler.link   s|   ( !% 5 5gz J J*:>:L:L|%9;
 ;
7L"6   	HI())  
 ! gll:GGO??7O44 a	C i222% 2"4QQQ7GG".qqq1GG% 5"7:GG"1!!!4G %W]]?;;
d!w//557??71:667<<(W2DEE%;)/R A ACOOJ$5$5c3$?$?@@@@Z(H)=|h?VWWW 27+W55H #mGI  ) ) g..rw/?/?/E/EFFs&==$$T****NN4((((# ? ?v(8(8(=(==>>>>NN5!!! NN7### NNC1222NN4     	, 	, 00sEJJ?NN3'''' NN7++++ NN:&&&NN8$$$ NNC?+++NN3NN9%%% ,+ /~...KK88999%

DK=7233333% % % %nn$% I0/BBBBBs   >P 
P<(P77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)r4   r5   rc   rR   exists)	r#   dirsr   r@   dlib	try_namesdirnamer   s	            r(   rk   zBCPPCompiler.find_library_fileD  s      	-:DwcBIIw,I 	 	C! # #',,sD,A,A$,G,GHH7>>'** #"NNNNN## 4r)   r.   c                    |d}g }|D ]J}t           j                            t           j                            |                    \  }}|| j        ddgz   vr#t          d                    ||                    |rt           j                            |          }|dk    r7|                    t           j        	                    |||z                        |dk    r8|                    t           j        	                    ||dz                        |                    t           j        	                    ||| j
        z                        L|S )Nr.   r,   r+   z"unknown file type '{}' (from '{}'))r4   r5   rf   rj   src_extensionsr   rg   basenamer1   rc   obj_extension)r#   source_filenames	strip_dirr=   	obj_namessrc_namer~   rJ   s           r(   object_filenameszBCPPCompiler.object_filenames^  sD   J	( 	V 	VH'**27+;+;H+E+EFFKT34.%@AA&8??XNN    .w''--f}}  j$*!E!EFFFF  j$-!H!HIIII  j$AS:S!T!TUUUU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	   r1   r2   r&   r   r7   r4   r5   r8   r9   r   printr   )r#   sourceoutput_filer>   r?   rA   rB   _rE   pp_argsrK   s              r(   
preprocesszBCPPCompiler.preprocessw  s@    %)$:$:4$V$V!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executablesr:   r;   r   r   static_lib_extensionshared_lib_extensionstatic_lib_formatshared_lib_formatexe_extensionr   rN   rX   r   rk   r   r   __classcell__)r'   s   @r(   r   r   '   sp         M K FM---O #_4NM!!,22)M; ; ; ; ; ;6 I I I I\ NRC C C C2 !CC CC CC CCR   4   8 ( ( ( ( ( ( ( (r)   r   )r   r4   warningsdistutils.errorsr   r   r   r   r   distutils.ccompilerr   r	   distutils.file_utilr
   distutils.dep_utilr   	distutilsr   ra   DeprecationWarningr    r)   r(   <module>r      s    
			               B A A A A A A A * * * * * * $ $ $ $ $ $       4 	  o( o( o( o( o(9 o( o( o( o( o(r)   