
    wg                         d Z ddlZddlmZ ddlmZmZ ddlmZ g dg dg d	d
Z	g dg dg dd
Z
g dg g d
Zg ddgddgd
Z G d de      Zy)a  distutils.zosccompiler

Contains the selection of the c & c++ compilers on z/OS. There are several
different c compilers on z/OS, all of them are optional, so the correct
one needs to be chosen based on the users input. This is compatible with
the following compilers:

IBM C/C++ For Open Enterprise Languages on z/OS 2.0
IBM Open XL C/C++ 1.1 for z/OS
IBM XL C/C++ V2.4.1 for z/OS 2.4 and 2.5
IBM z/OS XL C/C++
    N   )	sysconfig)CompileErrorDistutilsExecError)UnixCCompiler)z-m64z-fvisibility=defaultz-fzos-le-char-mode=asciiz-fno-short-enums)
-q64-qexportall-qascii-qstrict	-qnocsect-Wa,asa,goff
-Wa,xplink
-qgonumber
-qenum=int-Wc,DLL)r   r	   r
   r   r   r   r   r   r   r   z-qlanglvl=extc99)
ibm-openxlibm-xlclangibm-xlc)r   r	   r
   r   r   r   r   r   r   r   z-qlanglvl=extended0x)z-fasmz-fno-integrated-asz	-Wa,--ASAz
-Wa,--GOFFz-Wl,dllr   c                   h     e Zd Zg dZg dZdgZd Zd	 fd	Zd Zd Z		 	 	 	 	 	 	 	 	 	 d
 fd	Z
 xZS )zOSCCompiler)z.c.C.cc.cxx.cppz.m.s)r   r   r   r   r   c                 <   dD cg c]C  }t         j                  j                  |d       x}rt         j                  j	                  |      E }}t        |      dk(  ryi }dD ]  }d||<   	 dD ]  }d||<   	 dD ]  }d||<   	 |j                  |d   d      S c c}w )	N)CCCXXLDSHAREDr   r   )z	ibm-clangzibm-clang64zibm-clang++zibm-clang++64clangzclang++zclang-14)xlclangz	xlclang++njscznjsc++r   )xlcxlCzxlc++r   )osenvirongetpathbasenamelen)selfenvvarbinaryzos_compiler_nameszos_compilerscompilers         g/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/setuptools/_distutils/zosccompiler.py_get_zos_compiler_namez#zOSCCompiler._get_zos_compiler_namem   s     4
**..666 GGV$
 

 !"a'
 		3H '3M(#		3 C 	4H&3M(#	4 0 	0H&/M(#	0   !3A!6EE5
s   ABc                 |    t         |   |||       | j                         | _        t	        j
                  |        y )N)super__init__r2   zos_compilerr   customize_compiler)r+   verbosedry_runforce	__class__s       r1   r5   zzOSCCompiler.__init__   s3    '51 779$$T*    c                 2   g }|| j                   v r/| j                  }|j                  t        | j                            n|| j
                  v rQ| j                  }|j                  t        | j                            |j                  t        | j                            n.| j                  }|j                  t        | j                            |j                  |       	 | j                  ||z   |d|gz   |z          y # t        $ r}	t        |	      d }	~	ww xY w)Nz-o)_cpp_extensionscompiler_cxxextend	_cxx_argsr6   _asm_extensionscompiler_so_cc_args	_asm_argsspawnr   r   )
r+   objsrcextcc_argsextra_postargspp_opts
local_argsr0   msgs
             r1   _compilezzOSCCompiler._compile   s    
$&&&((Hi(9(9:;D(((''Hht'8'89:i(9(9:;''Hht'8'89:'"	$JJx*,T3/??.PQ! 	$s##	$s   C= =	DDDc                     d|z   S )Nz-L )r+   dirs     r1   runtime_library_dir_optionz'zOSCCompiler.runtime_library_dir_option   s    czr<   c                 .   t        j                  d      }t         j                  r8t        j                  j                  t        j                  d      d| d      }nKt        j                  j                  t        j                  d      t        j                  d      d| d      }t        j                  j                  |      r|r|j                  |       n|g}|rw|D ]r  }|d d  D ]h  }t        j                  j                  || d      }t        j                  j                  |      sF|j                  |       |j                  |        r t |j                  t        | j                            t        | 5  |||||||||	|
|||       y )N	LDVERSIONabs_builddir	libpythonz.xinstalled_base
platlibdir)r   get_config_varpython_buildr%   r(   joinexistsappendremover@   _ld_argsr6   r4   link)r+   target_descobjectsoutput_filename
output_dir	librarieslibrary_dirsruntime_library_dirsexport_symbolsdebugextra_preargsrK   
build_temptarget_lang	ldversionside_deck_pathrR   librarylibrary_side_deckr;   s                      r1   ra   zzOSCCompiler.link   ss   $ ,,[9	!!WW\\((8I;b)N
  WW\\(()9:((6I;b)N 77>>.)%%n5"0!1  + (| G(*SWIR.(I%ww~~&78!((1&--.?@ 	ht'8'89: 	
r<   )FFF)
NNNNNFNNNN)__name__
__module____qualname__src_extensionsr>   rB   r2   r5   rO   rS   ra   __classcell__)r;   s   @r1   r   r   h   sU    DN3OfOF:+
$& !@
 @
r<   r   )__doc__r%    r   errorsr   r   unixccompilerr   rD   rA   rE   r`   r   rQ   r<   r1   <module>r{      s    
  4 (' F' 	F M	 v&6"}
= }
r<   