
    F\h                     F    S r SSKrSSKrS
S jrS rS rS rS rS rS	 r	g)zShared AIX support functions.    Nc                 V   SSK nSSKn[        SUR                  5       < 3S5      nUR	                  U5       nU(       a  U < SUR
                  < S3nOU < SUR
                  < S3nUR                  U5      (       d  UR                  5       OSsSSS5        $ ! , (       d  f       g= f)	z0Output from successful command execution or Noner   Nz/tmp/_aix_support.zw+bz >'z' 2>&1z 2>/dev/null >'')os
contextlibopengetpidclosingnamesystemread)commandstringcapture_stderrr   r   fpcmds         #/usr/lib/python3.13/_aix_support.py_read_cmd_outputr      sy    
 	
		
B 
		B	2%2BGG<C,9277CC "		#rwwyD 
 		s   AB
B(c                     [         R                  S:X  a  SOSnUS:w  a  UOSnSR                  U S   U S   U S   X25      $ )	Ni    @   r   '  zaix-{:1x}{:1d}{:02d}-{:04d}-{}      )sysmaxsizeformat)vrtlbd_sz_bds       r   _aix_tagr       sF     ("bCa"TC+2247DGT!WcWW    c                 v    U R                  S5      S S u  pn[        US   5      [        U5      [        U5      /$ )N.   )splitint)vrmfvrtls       r   	_aix_vrtlr,   $   s7    zz#r"HA""JAB((r!   c                      SSK n U R                  / SQ5      nUR	                  S5      nUR                  5       R                  S5      nUS   S:w  a  [        US   5      OS	n[        US
   5      U4$ ! [         a    [        S5      n Npf = f)a  
Return a Tuple[str, int] e.g., ['7.1.4.34', 1806]
The fileset bos.rte represents the current AIX run-time level. It's VRMF and
builddate reflect the current ABI levels of the runtime environment.
If no builddate is found give a value that will satisfy pep425 related queries
r   N)z/usr/bin/lslppz-Lqczbos.rtez/usr/bin/lslpp -Lqc bos.rtezutf-8:r%    r   r   )	
subprocesscheck_outputImportErrorr   decodestripr&   r'   str)r0   outr   s      r   _aix_bos_rter7   *   s    >%%&KL **W
C
))+

C
 Cb'R-#c"g,TCAK  ><=>s   A2 2B
	B
c                  D    [        5       u  p[        [        U 5      U5      $ )ap  
AIX filesets are identified by four decimal values: V.R.M.F.
V (version) and R (release) can be retrieved using ``uname``
Since 2007, starting with AIX 5.3 TL7, the M value has been
included with the fileset bos.rte and represents the Technology
Level (TL) of AIX. The F (Fix) value also increases, but is not
relevant for comparing releases and binary compatibility.
For binary compatibility the so-called builddate is needed.
Again, the builddate of an AIX release is associated with bos.rte.
AIX ABI compatibility is described  as guaranteed at: https://www.ibm.com/    support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html

For pep425 purposes the AIX platform tag becomes:
"aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(v, r, tl, builddate, bitsize)
e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit
and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit
)r7   r    r,   )r(   r   s     r   aix_platformr9   ?   s    & ~HDIdOR((r!   c                  d    [         R                  " S5      n U (       d  [        S5      e[        U S9$ )NBUILD_GNU_TYPEzBUILD_GNU_TYPE is not defined)r(   )	sysconfigget_config_var
ValueErrorr,   )gnu_types    r   _aix_bgtr@   W   s-    ''(89H899(##r!   c                      [         R                  " S5      n  [        U 5      n [        [        5       U 5      $ ! [        [        4 a    [        SU < 35      ef = f)z<
Return the platform_tag of the system Python was built on.
AIX_BUILDDATEz)AIX_BUILDDATE is not defined or invalid: )r<   r=   r'   r>   	TypeErrorr    r@   )
build_dates    r   aix_buildtagrE   _   sc     ))/:J,_
 HJ
++ 	" ,D&>+ , 	,,s	   7  A)F)
__doc__r   r<   r   r    r,   r7   r9   r@   rE    r!   r   <module>rH      s2    # 
 9$X)*)0$,r!   