
    IgVI                        d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ dej        v Zej                            ej                  Zej                            ej                  Zej                            ej                  Zej                            ej                  Zdej        v r&ej                            ej        d                   ZnNej        r8ej                            ej                            ej                            Zn ej                    Zd	 Z eed
d          Z d Z!ej"        dk    r!ed             Z# e#e          Z e#e           Z d Z$ e$            Z%dZ&	 e%sej'        Z&n# e($ r Y nw xY wd Z)d$dZ*d Z+d Z,d Z-d Z.d Z/d Z0d%dZ1d Z2d Z3d Z4d&dZ5 ej6        d          Z7 ej6        d          Z8 ej6        d          Z9d&d Z:d! Z;da<d" Z=d# Z>dS )'a  Provide access to Python's configuration information.  The specific
configuration variables available depend heavily on the platform and
configuration.  The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys().  Additional convenience functions are also
available.

Written by:   Fred L. Drake, Jr.
Email:        <fdrake@acm.org>
    N   )DistutilsPlatformError)
py39compat)	pass_none__pypy___PYTHON_PROJECT_BASEc                     t          j        |                               d          t          fddD                       S )z]
    Return True if the target directory appears to point to an
    un-installed Python.
    Modulesc              3   f   K   | ]+}                     |                                          V  ,d S N)joinpathis_file).0fnmoduless     [/var/www/html/4nations/venv/lib/python3.11/site-packages/setuptools/_distutils/sysconfig.py	<genexpr>z(_is_python_source_dir.<locals>.<genexpr>2   s=      QQ"w##++--QQQQQQ    )SetupzSetup.local)pathlibPathr   any)dr   s    @r   _is_python_source_dirr   ,   sD    
 l1oo&&y11GQQQQ8PQQQQQQr   _homec                     t           j                            |                               t           j                            |                    S )z,
    Return True if a is a parent of b.
    )ospathnormcase
startswith)dir_adir_bs     r   
_is_parentr#   8   s8     7E""--bg.>.>u.E.EFFFr   ntc                 \     t           t          f} fd|D             }t          |           S )Nc              3   x   K   | ]4}t          t          j                            |d                     0|V  5dS )PCbuildN)r#   r   r   join)r   prefixr   s     r   r   z_fix_pcbuild.<locals>.<genexpr>E   sW       
 
!RW\\&)<<==

 
 
 
 
 
r   )PREFIXBASE_PREFIXnext)r   prefixesmatcheds   `  r   _fix_pcbuildr/   A   sI     ;&
 
 
 
"
 
 

 GQr   c                  `    t           rt          t                     S t          t                    S r   )	_sys_homer   project_base r   r   _python_buildr4   P   s&     0$Y/// ...r    c                  0    dt           j        dd         z  S )zReturn a string containing the major and minor Python version,
    leaving off the patchlevel.  Sample return values could be '1.5'
    or '2.2'.
    z%d.%dN   )sysversion_infor3   r   r   get_python_versionr:   f   s    
 S%bqb)))r   c                     | rt           nt          }||n|}	 t                      dt          j                  }n*# t
          $ r t          dt          j        z            w xY w ||||           S )a  Return the directory containing installed Python header files.

    If 'plat_specific' is false (the default), this is the path to the
    non-platform-specific header files, i.e. Python.h and so on;
    otherwise, this is the path to platform-specific header files
    (namely pyconfig.h).

    If 'prefix' is supplied, use it instead of sys.base_prefix or
    sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
    N_get_python_inc_zFI don't know where Python installs its C header files on platform '%s')BASE_EXEC_PREFIXr+   globalsr   nameKeyErrorr   )plat_specificr)   default_prefixresolved_prefixgetters        r   get_python_incrE   n   s     *7G%%KN & 2ffO
7bg778 
 
 
$!#)
 
 	


 6/6=999s	   !: 'A!c                     t           r0t          j        dk     r t          j                            | d          S t          |          pt          ||          pt          |           S )N      include)	IS_PYPYr8   r9   r   r   r(   _get_python_inc_posix_python_get_python_inc_from_config_get_python_inc_posix_prefixr)   spec_prefixrA   s      r   _get_python_inc_posixrQ      s_     /3#f,,w||FI...$]33 	0&}kBB	0'//r   c                     t           sdS | rt          pt          S t          j                            t          d          d          }t          j                            |          S )z
    Assume the executable is in the build directory. The
    pyconfig.h file should be in the same directory. Since
    the build directory may not be the source directory,
    use "srcdir" from the makefile to find the "Include"
    directory.
    NsrcdirInclude)python_buildr1   r2   r   r   r(   get_config_varnormpath)rA   incdirs     r   rL   rL      sW       )(L(W\\.22I>>F7F###r   c                 4    |t          d| z  dz             S dS )aj  
    If no prefix was explicitly specified, provide the include
    directory from the config vars. Useful when
    cross-compiling, since the config vars may come from
    the host
    platform Python installation, while the current Python
    executable is from the build platform installation.

    >>> monkeypatch = getfixture('monkeypatch')
    >>> gpifc = _get_python_inc_from_config
    >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower)
    >>> gpifc(False, '/usr/bin/')
    >>> gpifc(False, '')
    >>> gpifc(False, None)
    'includepy'
    >>> gpifc(True, None)
    'confincludepy'
    NCONF	INCLUDEPY)rV   )rA   rP   s     r   rM   rM      s*    & f}4{BCCC r   c                     t           rdnd}|t                      z   t          z   }t          j                            | d|          S )NpypypythonrJ   )rK   r:   build_flagsr   r   r(   )r)   implementation
python_dirs      r   rN   rN      s>    &4VVHN"4"6"66DJ7<<	:666r   c                     t           rSt          j                            | d          t          j        j        z   t          j                            | d          z   S t          j                            | d          S )NrJ   PC)rU   r   r   r(   pathseprO   s      r   _get_python_inc_ntre      s`     
 GLL++gogll64(()	

 7<<	***r   c                 J    | r|S t           j                            |d          S )Nsite-packages)r   r   r(   )standard_lib	libpythonearly_prefixr)   s       r   
_posix_librk      s&     8w||I777r   c                    t           rlt          j        dk     r\|t          }|r1t          j                            |dt          j        d                   S t          j                            |d          S |}|#|r| rt          pt          }n| rt          pt          }t          j        dk    rj| s|rt          t          dd          }nd}t           rd	nd
}t          j                            |||t                      z             }t          ||||          S t          j        dk    rC|r t          j                            |d          S t          j                            |dd          S t          dt          j        z            )aS  Return the directory containing the Python library (standard or
    site additions).

    If 'plat_specific' is true, return the directory containing
    platform-specific modules, i.e. any module from a non-pure-Python
    module distribution; otherwise, return the platform-shared library
    directory.  If 'standard_lib' is true, return the directory
    containing standard Python library modules; otherwise, return the
    directory for site-specific modules.

    If 'prefix' is supplied, use it instead of sys.base_prefix or
    sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
    rG   Nz
lib-pythonr   rg   posix
platlibdirlibr]   r^   r$   Libz?I don't know where Python installs its library on platform '%s')rK   r8   r9   r*   r   r   r(   versionr=   r+   EXEC_PREFIXr?   getattrr:   rk   r   )rA   rh   r)   rj   libdirr`   ri   s          r   get_python_libru      ss     53#f,,>F 	F7<<ck!nEEEw||FO444L~ 	="7'7F;FF"2{<fF	w' 	L 	 S,66FF F#*8GLLBTBVBV1VWW	,	<HHH	D 	@7<<...7<<???$!#)
 
 	
r   c           
         | j         dk    rt          j        dk    r7t          d          s(ddl}|                    t                     dt          d<   t          ddd	d
dddd          \  }}}}}}}}	dt          j	        v rQt          j	        d         }
dt          j	        vr/|
                    |          r|
|t          |          d         z   }|
}dt          j	        v rt          j	        d         }dt          j	        v rt          j	        d         }dt          j	        v rt          j	        d         }n|dz   }dt          j	        v r|dz   t          j	        d         z   }d	t          j	        v r0|dz   t          j	        d	         z   }|dz   t          j	        d	         z   }dt          j	        v rH|dz   t          j	        d         z   }|dz   t          j	        d         z   }|dz   t          j	        d         z   }dt          j	        v rt          j	        d         }dt          j	        v r|dz   t          j	        d         z   }n|dz   |	z   }|dz   |z   }|                     |||dz   |z   ||||           dt          j	        v rA| j                            dd          r&|                     t          j	        d                    || _        dS dS )zDo any platform-specific customization of a CCompiler instance.

    Mainly needed on Unix, so we can plug in the information that
    varies across Unices and is stored in Python's Makefile.
    unixdarwinCUSTOMIZED_OSX_COMPILERr   NTrueCCCXXCFLAGSCCSHAREDLDSHAREDSHLIB_SUFFIXARARFLAGSCPPz -ELDFLAGS CPPFLAGS)preprocessorcompilercompiler_socompiler_cxx	linker_so
linker_exearchiverRANLIBranlib)r   )compiler_typer8   platformrV   _osx_supportcustomize_compiler_config_varsget_config_varsr   environr    lenset_executablesexecutablesgetshared_lib_extension)r   r   cccxxcflagsccsharedldsharedshlib_suffixarar_flagsnewcccppr   cc_cmds                 r   r   r     s    ''<8## "";<< A####//===:@67 	
 	
		
 2:Jt$E++0C0CB0G0G+ !8CGGII#66BBJ*U#C##z*-HBJ*U#CCu*C
""#~
9(==Hrz!!c\BJx$88F#~
8(<<H##)bj44Cc\BJz$::F#~
:(>>H2:D!B
""Cx"*Y"77HHCx(*HcF"  x/ 	! 	
 	
 	
 rz!!h&:&>&>x&N&N!$$BJx,@$AAA(4%%%g ('r   c                     t           rkt          j        dk    r-t          j                            t
          pt          d          } nt
          pt          } t          j                            | d          S t          j                    S )z2Return full pathname of installed pyconfig.h file.r$   rc   z
pyconfig.h)	rU   r   r?   r   r(   r1   r2   	sysconfigget_config_h_filename)inc_dirs    r   r   r   b  s`     17d??gll9#<dCCGG/<Gw||G\222.000r   c                  (    t          j                    S )zAReturn full pathname of installed Makefile from the Python build.)r   get_makefile_filenamer3   r   r   r   r   n  s    *,,,r   c                 .    t          j        | |          S )zParse a config.h-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    )vars)r   parse_config_h)fpgs     r   r   r   s  s     #BQ////r   z"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}c                 6   ddl m}  || dddd          }|i }i }i }	 |                                }|nt                              |          }|r|                    dd          \  }}	|	                                }	|	                    d	d
          }
d|
v r|	||<   n?	 t          |	          }	|	||<   n)# t          $ r |	                    d	d          ||<   Y nw xY wd}|rt          |          D ]}||         }t                              |          pt                              |          }|rl|                    d          }d}||v rt          ||                   }nz||v rd}ns|t          j        v rt          j        |         }nR||v rG|                    d          r|dd         |v rd
}n*d|z   |v rd}n t          |d|z                      }nd
x||<   }|r||                                d         }|d|                                         |z   |z   }d|v r|||<   8	 t          |          }|||<   n'# t          $ r |                                ||<   Y nw xY w||= |                    d          r|dd         |v r|dd         }||vr|||<   ||= ||                                 |                                D ]1\  }}	t-          |	t                    r|	                                ||<   2|                    |           |S )zParse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    r   )TextFiler   surrogateescape)strip_commentsskip_blanks
join_lineserrorsNTr7   z$$r5   $)r}   r   r   FPY_rH   )distutils.text_filer   readline_variable_rxmatchgroupstripreplaceint
ValueErrorlist_findvar1_rxsearch_findvar2_rxstrr   r   r    endstartcloseitems
isinstanceupdate)r   r   r   r   donenotdonelinemnvtmpvrenamed_variablesr?   valuefounditemafterks                     r   parse_makefiler     s    -,,,,,	
1!BS
 
 
B 	yDG {{}}<t$$ 	 771a==DAq		A99T2&&Dd{{

 AA
  DGG	 " 3 3 3iic22DGGG3! 4 :  0"MM /	" /	"DDME##E**Hl.A.A%.H.HA ,"GGAJJ99tAw<<DD'\\!EE"*__:a=DD+++u-- 4$qrr(>O2O2O!g-- %  #4	?33%''DGd 3!!%%'')),E!+AGGII+.5=Ee||(-/$'JJE */DJJ  * 7 7 7).DJJJ7 $DM??511 3d122hBS6S6S#'8D#4//-2T
 DMMa  0"d HHJJJ 

    1a 	 ggiiDG HHTNNNHs$   !B6 6#CC-I!I&%I&c                 $   	 t                               |           pt                              |           }|rV|                                \  }}| d|         |                    |                    d                    z   | |d         z   } nn| S )a  Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
    'string' according to 'vars' (a dictionary mapping variable names to
    values).  Variables not present in 'vars' are silently expanded to the
    empty string.  The variable values in 'vars' should not contain further
    variable expansions; if 'vars' is the output of 'parse_makefile()',
    you're fine.  Returns a variable-expanded version of 's'.
    Tr   r   N)r   r   r   spanr   r   )sr   r   begr   s        r   expand_makefile_varsr     s    ""<l&9&9!&<&< 	JS#!C%488AGGAJJ///!CDD'9AA Hr   c                      t           >t          j                                                    a t	          j        t                      | rd | D             nt           S )a  With no arguments, return a dictionary of all configuration
    variables relevant for the current platform.  Generally this includes
    everything needed to build extensions and install both pure modules and
    extensions.  On Unix, this means every variable defined in Python's
    installed Makefile; on Windows it's a much smaller set.

    With arguments, return a list of values that result from looking up
    each argument in the configuration variable dictionary.
    Nc                 B    g | ]}t                               |          S r3   )r   r   )r   r?   s     r   
<listcomp>z#get_config_vars.<locals>.<listcomp>  s&    444tLT""444r   )r   r   r   copyr   add_ext_suffix)argss    r   r   r     sT      0227799!,///8<N44t4444,Nr   c                     | dk    r ddl }|                    dt          d           t                                          |           S )zReturn the value of a single variable using the dictionary
    returned by 'get_config_vars()'.  Equivalent to
    get_config_vars().get(name)
    SOr   Nz SO is deprecated, use EXT_SUFFIXr7   )warningswarnDeprecationWarningr   r   )r?   r   s     r   rV   rV     sH    
 t||8:LaPPP  &&&r   )r   N)r   r   Nr   )?__doc__r   rer8   r   r   r   r   r5   r   
_functoolsr   builtin_module_namesrK   r   rW   r)   r*   exec_prefixrr   base_prefixr+   base_exec_prefixr=   r   abspathr2   
executabledirnamegetcwdr   rs   r1   r#   r?   r/   r4   rU   r_   abiflagsAttributeErrorr:   rE   rQ   rL   rM   rN   re   rk   ru   r   r   r   r   compiler   r   r   r   r   r   r   rV   r3   r   r   <module>r      s  	 	 
			 				 



      * * * * * *       ! ! ! ! ! !
0
0 
		#*	%	%gs//gs//7##C$899 
 RZ''7??2:.D#EFFLL
~ #wrws~'F'FGG !ry{{R R R GC$''	G G G 7d??    Y   <--LY''I/ / / } 	 #l 	 	 	 	D	* * *: : : :.  $ $ $ D D D.7 7 7	+ 	+ 	+8 8 83
 3
 3
 3
lY5 Y5 Y5x	1 	1 	1- - -
0 0 0 0 rz?@@rz:;;rz899j j j jZ  2 O O O$	' 	' 	' 	' 	's   :	F FF