
    ϶vg                         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dS )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                     fddD             }t          |          dk    rdS i }dD ]}d||<   dD ]}d||<   dD ]}d	||<   |                    |d         d          S )
Nc                     g | ]C}t           j                            |d           x$t           j                                      DS N)osenvirongetpathbasename).0envvarbinarys     _/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/_distutils/zosccompiler.py
<listcomp>z7zOSCCompiler._get_zos_compiler_name.<locals>.<listcomp>n   sT     
 
 
*..666
GV$$
 
 
    )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   )lenr!   )selfzos_compiler_nameszos_compilerscompilerr&   s       @r'   _get_zos_compiler_namez#zOSCCompiler._get_zos_compiler_namem   s    
 
 
 
3
 
 

 !""a''<
 		3 		3H '3M(##B 	4 	4H&3M(##/ 	0 	0H&/M(##  !3A!6EEEr)   Fc                     t                                          |||           |                                 | _        t	          j        |            d S r   )super__init__r7   zos_compilerr   customize_compiler)r3   verbosedry_runforce	__class__s       r'   r:   zzOSCCompiler.__init__   sJ    '5111 7799$T*****r)   c                 4   g }|| j         v r-| j        }|                    t          | j                            n|| j        v rR| j        }|                    t          | j                            |                    t          | j                            n,| j        }|                    t          | j                            |                    |           	 | 	                    ||z   |d|gz   |z              d S # t          $ r}	t          |	          d }	~	ww xY w)Nz-o)_cpp_extensionscompiler_cxxextend	_cxx_argsr;   _asm_extensionscompiler_so_cc_args	_asm_argsspawnr   r   )
r3   objsrcextcc_argsextra_postargspp_opts
local_argsr6   msgs
             r'   _compilezzOSCCompiler._compile   s%   
$&&&(Hi(9:;;;;D((('Hht'89:::i(9:;;;;'Hht'89:::'"""	$JJx*,T3/??.PQQQQQ! 	$ 	$ 	$s###	$s   !C9 9
DDDc                     d|z   S )Nz-L )r3   dirs     r'   runtime_library_dir_optionz'zOSCCompiler.runtime_library_dir_option   s    czr)   Nc                 d   t          j        d          }t           j        r7t          j                            t          j        d          d| d          }nIt          j                            t          j        d          t          j        d          d| d          }t          j                            |          r|r|                    |           n|g}|r|D ]}}|d d          D ]p}t          j                            || d          }t          j                            |          r,|                    |           |                    |            nq~|	                    t          | j                            t                                          |||||||||	|
|||           d S )N	LDVERSIONabs_builddir	libpythonz.xinstalled_base
platlibdir)r   get_config_varpython_buildr   r"   joinexistsappendremoverD   _ld_argsr;   r9   link)r3   target_descobjectsoutput_filename
output_dir	librarieslibrary_dirsruntime_library_dirsexport_symbolsdebugextra_preargsrO   
build_temptarget_lang	ldversionside_deck_pathrV   librarylibrary_side_deckr@   s                      r'   re   zzOSCCompiler.link   s   $ ,[99	! 
	W\\(88)I))) NN
  W\\()9::(66)I))) N 7>>.)) 	2 2%%n5555"0!1   	+  (|  G(*SW...(I(I%w~~&788 !((111&--.?@@@ 	ht'89::: 	
 	
 	
 	
 	
r)   )FFF)
NNNNNFNNNN)__name__
__module____qualname__src_extensionsrB   rF   r7   r:   rS   rW   re   __classcell__)r@   s   @r'   r   r   h   s        DDDN333OfOF F F:+ + + + + +
$ $ $&   !@
 @
 @
 @
 @
 @
 @
 @
 @
 @
r)   r   )__doc__r    r   errorsr   r   unixccompilerr   rH   rE   rI   rd   r   rU   r)   r'   <module>r      sG    
			       4 4 4 4 4 4 4 4 ( ( ( ( ( (      '   F      '   	F MLL 	 v&6" }
 }
 }
 }
 }
= }
 }
 }
 }
 }
r)   