
    ?e#                         d dl Z ddlmZ e j                            e j                            e          d          Zd Zd Z	d	dZ
dS )
    N   )UserExceptionsourcec                 L    t           j                            t          |           S )z Return the name of the directory containing the latest source of the
    sip module that implements the given ABI version.
    )ospathjoin_module_source_dir)abi_major_versions    ;lib/python3.11/site-packages/sipbuild/module/abi_version.pyget_module_source_dirr   !   s    
 7<<*,=>>>    c                    dx}}t          t          j                            t	          |           d                    5 }|D ]h}|                                                                }t          |          dk    r-|d         dk    r!|d         }|d         }|dk    r|}`|d	k    r|}i	 ddd           n# 1 swxY w Y   |t          d
|            |t          d|            |  d| d| S )zr Return the version number of the latest implementation of the sip
    module with the given ABI as a string.
    Nzsip.h.in   r   z#define   r   SIP_ABI_MINOR_VERSIONSIP_MODULE_PATCH_VERSIONz*'SIP_ABI_MINOR_VERSION' not found for ABI z-'SIP_MODULE_PATCH_VERSION' not found for ABI .)	openr   r   r	   r   stripsplitlen
ValueError)r   abi_minor_versionpatch_versionvflinepartsnamevalues           r   get_sip_module_versionr!   )   s   
 )-, 
bgll01BCCZPP	Q	Q 
*UW 		* 		*DJJLL&&((E5zzQ58y#8#8Qxa222(-%%777$)M		*
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
*  P=NPPR R 	R S@QSSU U 	U  EE"3EEmEEEs   A,B88B<?B<Tc                    | r|                      d          }|d         }t          j                            t	          |                    st          d|  d          t          |          dk    rd}n	 t          |d                   }n# t          $ r d}Y nw xY wt          |          dk    s|t          d|  d          n5t          t          j
        t                    t          	          d
         }d}t          |          }|                     d          \  }}}t          |          |k     rt          d|  d          |r| d| S | d| S )z= Return a valid ABI version or the latest if none was given. r   r   'z ' is not a supported ABI versionr   Nr   z' is not a valid ABI version)key)r   r   r   isdirr   r   r   intr   sortedlistdirr
   r!   )abi_versionmoduler   r   minimum_minor_versionmodule_version_r   s           r   resolve_abi_versionr/   I   s     "!!#&&!!Hw}}23DEEFF 	GEEEEG G G u::??$%!!-(+E!H%% - - -(,%%%- 5zzA~~!6!>#EKEEEG G G "? #2:.@#A#AsKKKBO ! ,,=>>N,22377A!  555MMMMNNN :#99&7999  99"7999s   6B BB)T)r   
exceptionsr   r   r	   dirname__file__r
   r   r!   r/    r   r   <module>r4      s   0 
			 & & & & & & W\\"'//(";";XFF ? ? ?F F F@(: (: (: (: (: (:r   