
    ,hF                    8   d Z ddlmZ ddlZddlZddlZddlZddl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mZmZ ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ erddlm Z m!Z!  e d      Z"d$dZ#d$dZ$ejJ                  dk(  rda&dZ'd Z(d Z)d Z*d%dZ+ed&d       Z,	 	 	 	 	 	 d'dZ-ej\                  d(d       Z/d)dZ0d Z1d*d+dZ2dxa3xa4a5d Z6d,dZ7	 	 	 d-	 	 	 	 	 	 	 	 	 	 	 d.dZ8d/dZ9	 	 	 	 	 	 	 d0	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d1d Z:d2d!Z;d3d"Z<d# Z=y)4zudistutils.util

Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
    )annotationsN)CallableIterableMapping)TYPE_CHECKINGAnyStr)	pass_none   )log)newer)DistutilsByteCompileErrorDistutilsPlatformError)spawn)TypeVarTupleUnpack_Tsc                 *    t        j                         S )z
    Return a string that identifies the current platform. Use this
    function to distinguish platform-specific build directories and
    platform-specific built distributions.
    )	sysconfigget_platform     \/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/_distutils/util.pyget_host_platformr   #   s     !!##r   c                     t         j                  dk(  rCddddd} t         j                  j                  d      }| j                  |      xs
 t	               S t	               S )Nntwin32z	win-amd64z	win-arm32z	win-arm64)x86x64armarm64VSCMD_ARG_TGT_ARCH)osnameenvirongetr   )TARGET_TO_PLATtargets     r   r   r   1   sX    	ww$ 	
  45!!&)@->-@@r   darwinMACOSX_DEPLOYMENT_TARGETc                     da y)zFor testing only. Do not call.N)_syscfg_macosx_verr   r   r   _clear_cached_macosx_verr,   C   s
     r   c                 b    t         $ddlm}   | j                  t              xs d}|r|a t         S )zGet the version of macOS latched in the Python interpreter configuration.
    Returns the version as a string or None if can't obtain one. Cached.r   )r    )r+   	distutilsr   get_config_varMACOSX_VERSION_VAR)r   vers     r   !get_macosx_target_ver_from_syscfgr3   I   s4     !'&i&&'9:@b!$r   c                     t               } t        j                  j                  t              }|rB| r>t        |       ddgk\  r.t        |      ddgk  rdt        z   d| d|  dz   }t        |      |S | S )a  Return the version of macOS for which we are building.

    The target version defaults to the version in sysconfig latched at time
    the Python interpreter was built, unless overridden by an environment
    variable. If neither source has a value, then None is returned
      $z mismatch: now "z" but "z*" during configure; must use 10.3 or later)r3   r"   r$   r%   r1   split_versionr   )
syscfg_verenv_vermy_msgs      r   get_macosx_target_verr<   V   s     34Jjjnn/0G j)b!W4g&"a0 (( ,y
| 4),) ) 
 )00r   c                \    | j                  d      D cg c]  }t        |       c}S c c}w )zEConvert a dot-separated string into a list of numbers for comparisons.)splitint)sns     r   r8   r8   v   s"    GGCL)qCF)))s   )c                R    t        j                  t        j                  |             S )a.  
    Allow for pathlib.Path inputs, coax to a native path string.

    If None is passed, will just pass it through as
    Setuptools relies on this behavior.

    >>> convert_path(None) is None
    True

    Removes empty paths.

    >>> convert_path('foo/./bar').replace('\\', '/')
    'foo/bar'
    )r"   fspathpathlibPurePath)pathnames    r   convert_pathrH   {   s      99W%%h/00r   c                   t         j                  dk(  rbt         j                  j                  |      s t         j                  j	                  | |      S t         j                  j	                  | |dd       S t         j                  dk(  r]t         j                  j                  |      \  }}|d   t         j                  k(  r|dd }t         j                  j	                  | |      S t        dt         j                   d      )a	  Return 'pathname' with 'new_root' prepended.  If 'pathname' is
    relative, this is equivalent to "os.path.join(new_root,pathname)".
    Otherwise, it requires making 'pathname' relative and then joining the
    two, which is tricky on DOS/Windows and Mac OS.
    posixr
   Nr   r   znothing known about platform '')r"   r#   pathisabsjoin
splitdrivesepr   )new_rootrG   driverL   s       r   change_rootrS      s     
ww'ww}}X&77<<(3377<<(12,77	D**847bff8Dww||Hd++
 #A"''!!L
MMr   c                 L   t         j                  dk(  rNdt         j                  vr<	 ddl} | j	                  t        j
                               d   t         j                  d<   dt         j                  vrt               t         j                  d<   yy# t        t        f$ r Y @w xY w)aL  Ensure that 'os.environ' has all the environment variables we
    guarantee that users can use in config files, command-line options,
    etc.  Currently this includes:
      HOME - user's home directory (Unix only)
      PLAT - description of the current platform, including hardware
             and OS (see 'get_platform()')
    rJ   HOMEr   N   PLAT)	r"   r#   r$   pwdgetpwuidgetuidImportErrorKeyErrorr   )rX   s    r   check_environr]      s     
ww'fBJJ6	!$biik!:1!=BJJv RZZ)^

6   X& 	 	s   ;B B#"B#c                   t                t        t        j                        }|j	                  d |j                         D               	 t        |       j                  |      S # t        $ r}t        d|       d}~ww xY w)a  
    Perform variable substitution on 'string'.
    Variables are indicated by format-style braces ("{var}").
    Variable is substituted by the value found in the 'local_vars'
    dictionary or in 'os.environ' if it's not in 'local_vars'.
    'os.environ' is first checked/augmented to guarantee that it contains
    certain values: see 'check_environ()'.  Raise ValueError for any
    variables not found in either 'local_vars' or 'os.environ'.
    c              3  <   K   | ]  \  }}|t        |      f  y wNstr).0r#   values      r   	<genexpr>zsubst_vars.<locals>.<genexpr>   s     Ku4U$Ks   zinvalid variable N)
r]   dictr"   r$   updateitems_subst_compat
format_mapr\   
ValueError)rA   
local_varslookupvars       r   
subst_varsro      sp     O"**F
MMK
8H8H8JKK4Q**622 4,SE2334s   A% %	B.A<<Bc                x    d }t        j                  d||       }|| k7  rddl}|j                  dt               |S )zb
    Replace shell/Perl-style variable substitution with
    format-style. For compatibility.
    c                ,    d| j                  d       dS )N{r
   })group)matchs    r   _substz_subst_compat.<locals>._subst   s    EKKN#2&&r   z\$([a-zA-Z_][a-zA-Z_0-9]*)r   Nz-shell/Perl-style substitutions are deprecated)resubwarningswarnDeprecationWarning)rA   rv   replry   s       r   ri   ri      s?    ' 66/;Dqy;	
 Kr   c                    |t        |       z   S r`   ra   )excprefixs     r   grok_environment_errorr      s     CHr   c                     t        j                  dt        j                   d      at        j                  d      at        j                  d      ay )Nz[^\\\'\"z ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")rw   compilestring
whitespace_wordchars_re
_squote_re
_dquote_rer   r   r   _init_regexr      s>    JJ(6+<+<*=SABM01J01Jr   c                .   t         
t                | j                         } g }d}| rmt         j                  | |      }|j	                         }|t        |       k(  r|j                  | d|        	 |S | |   t        j                  v r*|j                  | d|        | |d j                         } d}n| |   dk(  r| d| | |dz   d z   } |dz   }n| |   dk(  rt        j                  | |      }n1| |   dk(  rt        j                  | |      }nt        d| |    d      |t        d	| |    d
      |j                         \  }}| d| | |dz   |dz
   z   | |d z   } |j	                         dz
  }|t        |       k\  r|j                  |        	 |S | rm|S )a  Split a string up according to Unix shell-like rules for quotes and
    backslashes.  In short: words are delimited by spaces, as long as those
    spaces are not escaped by a backslash, or inside a quoted string.
    Single and double quotes are equivalent, and the quote characters can
    be backslash-escaped.  The backslash is stripped from any two-character
    escape sequence, leaving only the escaped character.  The quote
    characters are stripped from any quoted string.  Returns a list of
    words.
    Nr   \r
   rK   "zthis can't happen (bad char 'z')zbad string (mismatched z	 quotes?)   )r   r   stripru   endlenappendr   r   lstripr   r   RuntimeErrorrk   span)rA   wordsposmr   begs         r   split_quotedr      s    		AE
C
3'eeg#a&=LL4C!D LA S6V&&& LL4C!#$ ACsVt^ $3!C!GI,&A'C v}$$Q,33$$Q,"%B1S6("#MNNy #:1S6()!LMMJS#$3!C!GcAg..348A%%'A+C#a&=LLOLO N Lr   c                    | | j                    |}|dd dk(  r|dd dz   }t        j                  |       |s | |  yy)a}  
    Perform some action that affects the outside world (e.g. by
    writing to the filesystem). Such actions are special because they
    are disabled by the 'dry_run' flag. This method handles that
    complication; simply supply the
    function to call and an argument tuple for it (to embody the
    "external action" being performed) and an optional message to
    emit.
    Nz,)r   ))__name__r   info)funcargsmsgverbosedry_runs        r   executer   7  sR      {x(rs8ta)c/CHHSMd r   c                R    | j                         } | dv ry| dv ryt        d|       )zConvert a string representation of truth to true (1) or false (0).

    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
    'val' is anything else.
    )yyesttrueon1T)rB   noffalseoff0Fzinvalid truth value )lowerrk   )vals    r   	strtoboolr   Q  s:     ))+C
22	5	5/w788r   c                   t         j                  rt        d      ||dk(  }|s*t        j                  d      \  }}	t        j                  d|	       |st        j                  |dd      }
|
5  |
j                  d	       |
j                  d
j                  t        t        |             dz          |
j                  d|d|d|d|d|d       ddd       t         j                  g}|j                  t        j                                 |j#                  |	       t%        ||       t'        t        j(                  |	fd|	 |       yddlm} | D ]  }|dd dk7  r|dk\  r+|dk(  rdn|}t.        j0                  j3                  ||      }nt.        j0                  j3                  |      }|}|r0|dt5        |       |k7  rt7        d|d|      |t5        |      d }|r t        j8                  j                  ||      }t        j8                  j;                  |      }|s|st=        ||      r&t        j                  d||       |r ||||       t        j>                  d||       ! y# 1 sw Y   xY w)a~  Byte-compile a collection of Python source files to .pyc
    files in a __pycache__ subdirectory.  'py_files' is a list
    of files to compile; any files that don't end in ".py" are silently
    skipped.  'optimize' must be one of the following:
      0 - don't optimize
      1 - normal optimization (like "python -O")
      2 - extra optimization (like "python -OO")
    If 'force' is true, all files are recompiled regardless of
    timestamps.

    The source filename encoded in each bytecode file defaults to the
    filenames listed in 'py_files'; you can modify these with 'prefix' and
    'basedir'.  'prefix' is a string that will be stripped off of each
    source filename, and 'base_dir' is a directory name that will be
    prepended (after 'prefix' is stripped).  You can supply either or both
    (or neither) of 'prefix' and 'base_dir', as you wish.

    If 'dry_run' is true, doesn't actually do anything that would
    affect the filesystem.

    Byte-compilation is either done directly in this interpreter process
    with the standard py_compile module, or indirectly by writing a
    temporary script and executing it.  Normally, you should let
    'byte_compile()' figure out to use direct compilation or not (see
    the source for details).  The 'direct' flag is used by the script
    generated in indirect mode; unless you know what you're doing, leave
    it set to None.
    zbyte-compiling is disabled.Nr   z.pyz$writing byte-compilation script '%s'wzutf-8)encodingz2from distutils.util import byte_compile
files = [
z,
z]
z
byte_compile(files, optimize=z, force=z,
             prefix=z, base_dir=z,
             verbose=z+, dry_run=False,
             direct=True)
)r   z	removing )r   r.   )optimizationzinvalid prefix: filename z doesn't start with zbyte-compiling %s to %sz%skipping byte-compilation of %s to %s) sysdont_write_bytecoder   tempfilemkstempr   r   r"   fdopenwriterN   maprepr
executableextend
subprocess"_optim_args_from_interpreter_flagsr   r   r   remove
py_compiler   	importlibutilcache_from_sourcer   rk   rL   basenamer   debug)py_filesoptimizeforcer   base_dirr   r   direct	script_fdscript_namescriptcmdr   fileoptcfiledfile
cfile_bases                     r   byte_compiler   a  sl   P '(EFF ~'1} #+#3#3E#: K7EYYy#@F " UZZD((;<uDE&\% ;Jk( 6[ !'8 ~~

:@@BC

;c7#		K>Y{m+DgV 	' 	YDBCyE! 
 1}$Mbx!88C8P!88>E#f+&&0$3D8;OPVzZ  c&km,Xu5))%0JE$.HH6jI"eU3IIEtZX?	YS s   0A$I;;Jc                    d}| j                  d      }|xr |d   j                         d   |d   k7  }|r|nd}|j                  |      |z   S )zReturn a version of the string escaped for inclusion in an
    RFC-822 header, by ensuring there are 8 spaces space after each newline.
    z        T)keependsr   r.   )
splitlinesrN   )headerindentlinesends_in_newlinesuffixs        r   rfc822_escaper     s`     Ft,E Fb	 4 4 6q 9U2Y FO&VBF;;u&&r   c                 ^    t         j                  dk(  xr t               j                  d      S )zReturns True if the current platform is mingw.

    Python compiled with Mingw-w64 has sys.platform == 'win32' and
    get_platform() starts with 'mingw'.
    r   mingw)r   platformr   
startswithr   r   r   is_mingwr     s%     <<7"I|~'@'@'IIr   c                 >    t        t        j                  d            S )zKReturn True if the Python interpreter is built with free threading support.Py_GIL_DISABLED)boolr   r0   r   r   r   is_freethreadedr     s    	(():;<<r   )returnrb   )rA   rb   r   z	list[int])rG   zstr | os.PathLike[str]r   rb   )rQ   AnyStr | os.PathLike[AnyStr]rG   r   r   r   )r   None)rl   zMapping[str, object]r   rb   )zerror: )r~   objectr   rb   r   rb   )rA   rb   r   z	list[str])NFF)r   zCallable[[Unpack[_Ts]], object]r   ztuple[Unpack[_Ts]]r   r   r   r   r   r   r   r   )r   rb   r   r   )r   FNNTFN)r   zIterable[str]r   r@   r   r   r   
str | Noner   r   r   r   r   r   r   zbool | Noner   r   )r   rb   r   rb   )r   r   )>__doc__
__future__r   	functoolsimportlib.utilr   r"   rE   rw   r   r   r   r   r   collections.abcr   r   r   typingr   r   jaraco.functoolsr	   _logr   	_modifiedr   errorsr   r   r   typing_extensionsr   r   r   r   r   r   r+   r1   r,   r3   r<   r8   rH   rS   	lru_cacher]   ro   ri   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   #   	  	   
   7 7 ( &   E 6
u
C$
 <<8/ 
@*
 1 1$N*N6RNN. , ,,4&( +/ . .
Z2<J 
)
 
 	
  
49$ HYHYHY HY 	HY
 HY HY HY HY 
HYV'J=r   