
    <h+Z             	         % S r SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJrJr  SSKJr  SSKJrJr  SSKrSSKrSSK r SSK!r!SSK"r"SSK#r#SSK$J%r%  S	S
K&J'r'J(r(  \RR                  (       ah  SSK*J+r+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:   " S S\,5      r; " S S\,5      r<\Rz                  " S\R|                  \;\<4   S9r?\R|                  S\@4   rA\Rz                  " S5      rB\Rz                  " S5      rC/ SQrD " S S5      rE0 rFS \GS!'   SS"KHJHrH  \I" \S#S$5      (       a  \R                  S%/rKO\R                  /rKSqLS&\GS''    " S( S)\'5      rM " S* S+\'5      rN\R                  " S,5      rPSSS- jjrQSSS. jjrRSSS/ jjrSSS0 jrTSS1 jrUSS2 jrVSS3 jrW " S4 S5\(\R                  S69rY " S7 S85      rZS9r[ " S: S\(5      r\SS; jr]SS< jr^S=S>/r_S?S@/r` " SA SB\R                  5      rb\#R                  " S$S$SC9 " SD SE\R                  \B   5      5       re\#R                  " S$S$SC9 " SF SG\e\B   5      5       rf\#R                  " S$S$SC9 " SH SI\e\R                  \B      5      5       rh\#R                  " S$S$SC9 " SJ SK\h\R                  \B      \f\R                  \B      5      5       riSSL jrjSSM jrkSSN jrlSSO jrmSSP jrnSSQ jroSSR jrpSSS jrqSST jrrSSU jrsSSV jrtSSW jruSSX jrvSSY jrwSSZ jrxSS[ jrySS\ jrz\" SS]9SS^ j5       r{SS_ jr|\#R                   " S` Sa5      5       r}SSb jr~SSc jr\GR                   " Sd5      r " Se Sf5      rSSg jrSSh jrSSi jrSSj jrSSk jrSSl jrSSm jrSSn jrSSo jrSSp jrSSq jrSSr jrSSs jrSSt jrSSu jrSSSv jjrSSw jrSSSx jjr\p" 5       (       a/  Syr\GR                   " Sz\ S{35      GR,                  rSS| jrSS} jrO
SS~ jrSS jrSS jr      SS jr    SS jr    SS jr S   SS jjr S   SS jjrSSS jjr S     SS jjr S   SS jjr S   SS jjr S       SS jjrSrSr        SS jr      SS jrSS jrSSS jjrSSS jjrSSS jjr    SS jrSS jrSS jrSS jrS\GRb                  \GRd                  \GRd                  4         SS jjrS\GRb                  \GRd                  \GRd                  4         SS jjrSSS jjrSS jrSS jrSS jrSS jrSS jrSS jrSS jr " S S\5      r  S   SS jjrSS jr " S S\GR                  \B   5      rSS jrSSS jjrSSS jjr " S S\R                  5      r " S S5      r SSKJr   " S S\5      r\r " S S\GR                  5      r S   SS jjrGS S jrGSS jrSGSS jjrGSS jrGSS jr " S S\R                  \B   5      rg! \ a
    \rS\GS'    Nif = f(  z)A library of random helper functionality.    )annotations)PathN)	lru_cachewrapstee)TemporaryDirectoryNamedTemporaryFile)mlog   )MesonExceptionHoldableObject)LiteralProtocol   )ImmutableListProtocol)ConfigurationData)StrOrBytesPath)Environment)Compiler)
SubProject)programsc                       \ rS rSr% S\S'   Srg)_EnvPickleLoadable+   r   environment N__name__
__module____qualname____firstlineno____annotations____static_attributes__r       {/mnt/mint/home/seanl/mnt/public/Repos/ladybird/Build/vcpkg/downloads/tools/meson-1.9.0-d1fcc2/mesonbuild/utils/universal.pyr   r   +   s      r%   r   c                       \ rS rSr% S\S'   Srg)_VerPickleLoadable/   strversionr   Nr   r   r%   r&   r(   r(   /   s    r%   r(   _PL)boundFile_T_U)hGITpython_commandNoProjectVersionproject_meson_versionsSecondLevelHolderr.   FileModeGitExceptionLibTypeMachineChoiceEnvironmentExceptionFileOrStringr7   dump_conf_header
OrderedSet
PerMachinePerMachineDefaultablePerThreeMachinePerThreeMachineDefaultableProgressBarRealPathActionTemporaryDirectoryWinProofVersioncheck_direntry_issuesclassify_unity_sourcescurrent_vs_supports_modulesdarwin_get_object_archsdefault_libdirdefault_libexecdirdefault_prefixdefault_datadirdefault_includedirdefault_infodirdefault_localedirdefault_mandirdefault_sbindirdefault_sysconfdirdetect_subprojects
detect_vcsdetermine_worker_countdo_conf_filedo_conf_strdo_replacementexpand_argumentsextract_as_listfirstgenerate_listget_compiler_for_sourceget_filenames_templates_dictget_rsp_thresholdget_variable_regexget_wine_shortpathgithas_path_sepis_aix
is_androidis_ascii_string	is_cygwinis_debianlikeis_dragonflybsd
is_freebsdis_haikuis_hurdis_irixis_linux	is_netbsd
is_openbsdis_osxis_parent_pathis_qnxis_sunos
is_windowsis_wsliter_regexin_iter	join_argslazy_propertylistifylistify_array_value	partitionpath_is_in_rootpickle_load
Popen_safePopen_safe_logged	quiet_git	quote_argrelative_to_if_possiblerelpathreplace_if_differentrun_onceget_meson_commandset_meson_command
split_argsstringlistifysubstitute_valuessubstring_is_in_listtypeslistifyverbose_gitversion_compare"version_compare_condition_with_minversion_compare_manysearch_versionwindows_detect_native_archwindows_proof_rmwindows_proof_rmtreec                      \ rS rSrSrg)r3      r   N)r   r    r!   r"   r$   r   r%   r&   r3   r3      s    r%   r3   z+T.Dict[str, T.Union[str, NoProjectVersion]]r4   )globfrozenF	runpython(T.Optional['ImmutableListProtocol[str]']_meson_commandc                      \ rS rSrSrSrg)r:      zEExceptions thrown while processing and creating the build environmentr   N)r   r    r!   r"   __doc__r$   r   r%   r&   r:   r:      s    Or%   r:   c                  0   ^  \ rS rSrSSU 4S jjjrSrU =r$ )r7      c                l   > [         TU ]  U5        U(       a  UR                  5       U l        g SU l        g )N )super__init__stripoutput)selfmsgr   	__class__s      r&   r   GitException.__init__   s%    (.fllnBr%   )r   N)r   r*   r   T.Optional[str]r   r    r!   r"   r   r$   __classcell__r   s   @r&   r7   r7      s    7 7r%   r7   rc   c                    [         c   S5       e[         /U Qn [        U 4SU0UD6u  pEnU(       a(  UR                  S:w  a  [        S[	        U 5      -   U5      eXEU4$ )Nz"Callers should make sure it existscwdr   zGit command failed: )r1   r   
returncoder7   r*   )cmd
workingdircheckkwargspoes          r&   rc   rc      sc    ?@@@?++C7*77GA!"1CH<a@@7Nr%   c                    [         (       d  SnU(       a  [        U5      eSU4$ [        XU5      u  pEnUR                  S:w  a  SU4$ SU4$ )NGit program not found.Fr   Tr1   r7   rc   r   )r   r   r   mr   r   r   s          r&   r   r      sP    3$q/!ax#5)GA!||qax7Nr%   c                    [         (       d  SnU(       a  [        U5      eg[        XUS S S9u  n  nUR                  S:H  $ )Nr   Fstdoutstderrr   r   )r   r   r   r   r   _s         r&   r   r      sA    3$q/!#5dCGAq!<<1r%   c                >   U R                  S5      (       d  U /qOP[        R                  R	                  U 5      (       a"  U R                  S5      (       a  [
        SS/-   qO
[
        U /-   qS[        R                  ;   a  [        R                  " S[        < 35        g g )Nz.pyzmesonmain.pyz-mzmesonbuild.mesonmainMESON_COMMAND_TESTSzmeson_command is )	endswithr   ospathisabsr2   environr   log)mainfiles    r&   r   r      s     U##"	x	 	 X%6%6~%F%F'41G*HH (8*4

*$^$678 +r%   c                     [         $ r   )r   r   r%   r&   r   r      s    r%   c                     [        U [        5      (       a  U R                  S5        g[        U [        5      (       a  U R	                  S5        g! [
         a     gf = f)NasciiFT)
isinstancer*   encodebytesdecodeUnicodeDecodeError)astrings    r&   rg   rg      sY    gs##NN7#
 	 ''NN7#   s   &A &A 
AAc           
     N   SS K nUR                  5       nUR                  5       S:w  a}  [        5       (       dm  [	        U [
        [        45      (       a  U /n U  HH  n[        U5      (       a  M  [        R                  " [        R                  " SU< SU< S35      5        MJ     g g g )Nr   UTF-8z
                You are using zr which is not a Unicode-compatible
                locale but you are trying to access a file system entry called zS which is
                not pure ASCII. This may cause problems.
                )localegetpreferredencodingupperrv   r   r*   r   rg   r   warningtextwrapdedent)direntry_arrayr   r   des       r&   rF   rF     s    
 	##%AwwyGJLLnsEl33,-N Br""LL . e $PPRv V*   ! %1r%   c                  @    \ rS rSrSr\R                  SS j5       rSrg)r5   i  zwA second level object holder. The primary purpose
of such objects is to hold multiple objects with one
default option. c                    g r   r   r   s    r&   get_default_object$SecondLevelHolder.get_default_object  s    47r%   r   N)returnr   )	r   r    r!   r"   r   abcabstractmethodr   r$   r   r%   r&   r5   r5     s     	7 7r%   r5   )	metaclassc                  j    \ rS rSr\R
                  " S5      r  S S	S jjrS
S jr\	SS j5       r
Srg)r6   i  z*[r-][w-][xsS-][r-][w-][xsS-][r-][w-][xtT-]Nc                T    Xl         U R                  U5      U l        X l        X0l        g r   )perms_sperms_s_to_bitspermsownergroup)r   r   r   r   s       r&   r   FileMode.__init__8  s#    ))%0


r%   c                h    SnUR                  U R                  U R                  U R                  5      $ )Nz!<FileMode: {!r} owner={} group={})formatr   r   r   r   rets     r&   __repr__FileMode.__repr__?  s&    1zz$,,

DJJ??r%   c                   Uc  gSn[        U[        5      (       d  [        SU< 35      e[        U5      S:w  d   U R                  R                  U5      (       d  [        SU< SU< 35      eSnUS   S:X  a  U[        R                  -  nUS	   S
:X  a  U[        R                  -  nUS   S:X  a  U[        R                  -  nOLUS   S:X  a  U[        R                  -  nO/US   S:X  a&  U[        R                  -  nU[        R                  -  nUS   S:X  a  U[        R                  -  nUS   S
:X  a  U[        R                  -  nUS   S:X  a  U[        R                  -  nOLUS   S:X  a  U[        R                  -  nO/US   S:X  a&  U[        R                  -  nU[        R                  -  nUS   S:X  a  U[        R                  -  nUS   S
:X  a  U[        R                   -  nUS   S:X  a  U[        R"                  -  nU$ US   S:X  a  U[        R$                  -  nU$ US   S:X  a&  U[        R"                  -  nU[        R$                  -  nU$ )z
Does the opposite of stat.filemode(), converts strings of the form
'rwxr-xr-x' to st_mode enums which can be passed to os.chmod()
z	rwxr-xr-xz-Install perms must be a string. For example, 	   zFile perms z' must be exactly 9 chars. For example, r   rr   wr   xSs                  Tt)r   r*   r   lensymbolic_perms_regexmatchstatS_IRUSRS_IWUSRS_IXUSRS_ISUIDS_IRGRPS_IWGRPS_IXGRPS_ISGIDS_IROTHS_IWOTHS_IXOTHS_ISVTX)clsr   egr   s       r&   r   FileMode.perms_s_to_bitsC  s<    ?'3'' #PQSPV!WXXw<1C$<$<$B$B7$K$K ;wk9`ac`f!ghh1:T\\!E1:T\\!E1:T\\!EQZ3T\\!EQZ3T\\!ET\\!E1:T\\!E1:T\\!E1:T\\!EQZ3T\\!EQZ3T\\!ET\\!E1:T\\!E1:T\\!E1:T\\!E  QZ3T\\!E  QZ3T\\!ET\\!Er%   )r   r   r   r   )NNN)r   r   r   T.Union[str, int, None]r   r  r   r*   )r   r   r   int)r   r    r!   r"   recompiler	  r   r   classmethodr   r$   r   r%   r&   r6   r6     sI    , :: '7 8 X\26/@ 2 2r%   r6   a  You are using .C or .H files in your project. This is deprecated.
         Currently, Meson treats this as C++ code, but they
            used to be treated as C code.
         Note that the situation is a bit more complex if you are using the
         Visual Studio compiler, as it treats .C files as C code, unless you add
         the /TP compiler flag, but this is unreliable.
         See https://github.com/mesonbuild/meson/pull/8747 for the discussions.c                  Z   \ rS rSrSS jrSS jrSS jr\\" SS9SS j5       5       r	\\" SS9SS j5       5       r
\\" SS9SS	 j5       5       r\SS
 j5       r\" SS9SS j5       r\" SS9SS j5       r\SS j5       rSS jrSSS jjrSSS jjrS S jrS!S jr\" SS9SS j5       rSrg)"r.   i  c                    UR                  S5      (       d  UR                  S5      (       a  [        R                  " [        SS9  Xl        X l        X0l        [        XU45      U l        g )Nz.Cz.HT)once)r   r   r   dot_C_dot_H_warningis_builtsubdirfnamehash)r   r%  r&  r'  s       r&   r   File.__init__  sN    >>$5>>$#7#7LL,48 
(E23	r%   c                "    U R                  5       $ r   )relative_namer   s    r&   __str__File.__str__  s    !!##r%   c                z    SnU R                   (       d  US-  nUS-  nUR                  U R                  5       5      $ )Nz
<File: {0}z (not built)>)r%  r   r+  r   s     r&   r   File.__repr__  s9    }}>!Cs
zz$,,.//r%   Nmaxsizec                    [         R                  R                  [         R                  R                  XU5      5      (       d  [	        SU S35      e[        SX5      $ )NzFile z does not exist.F)r   r   isfilejoinr   r.   )source_rootr&  r'  s      r&   from_source_fileFile.from_source_file  sH     ww~~bggll;FGG 5/?!@AAE6))r%   c                    [        SX5      $ )NTr.   )r&  r'  s     r&   from_built_fileFile.from_built_file  s     D&((r%   c                n    [         R                  R                  U 5      u  p[        R	                  X5      $ r   )r   r   splitr.   r;  )relativedirpart	fnameparts      r&   from_built_relativeFile.from_built_relative  s*      WW]]84##G77r%   c                    [        SSU 5      $ )NFr   r:  )r'  s    r&   from_absolute_fileFile.from_absolute_file  s    E2u%%r%   c                    U R                   (       a  U R                  5       $ [        R                  R	                  XR
                  U R                  5      $ r   )r%  r+  r   r   r5  r&  r'  )r   build_to_srcs     r&   rel_to_builddirFile.rel_to_builddir  s5    ==%%''77<<kk4::FFr%   c                    UnU R                   (       a  Un[        R                  R                  [        R                  R	                  X0R                  5       5      5      $ r   )r%  r   r   normpathr5  r+  )r   srcdirbuilddirabsdirs       r&   absolute_pathFile.absolute_path  s>    ==FwwV5G5G5I JKKr%   c                |    [         R                  R                  U R                  5      S   SS  R	                  5       $ )Nr   )r   r   splitextr'  lowerr   s    r&   suffixFile.suffix  s0    ww

+A.qr288::r%   c                8    U R                   R                  U5      $ r   )r'  r   )r   endings     r&   r   File.endswith  s    zz""6**r%   c                4    U R                   R                  XS9$ N)maxsplit)r'  r>  r   r   r\  s      r&   r>  
File.split  s    zz55r%   c                4    U R                   R                  XS9$ r[  )r'  rsplitr]  s      r&   r`  File.rsplit  s    zz   66r%   c                    [        U[        5      (       d  [        $ U R                  UR                  :w  a  gU R                  U R
                  U R                  4UR                  UR
                  UR                  4:H  $ )NF)r   r.   NotImplementedr(  r'  r&  r%  r   others     r&   __eq__File.__eq__  s\    %&&!!99

"

DKK7EKKW\WeWe;fffr%   c                    U R                   $ r   )r(  r   s    r&   __hash__File.__hash__  s    yyr%   c                j    [         R                  R                  U R                  U R                  5      $ r   )r   r   r5  r&  r'  r   s    r&   r+  File.relative_name  s    ww||DKK44r%   )r'  r(  r%  r&  )r%  boolr&  r*   r'  r*   r  )r6  r*   r&  r*   r'  r*   r   r.   )r&  r*   r'  r*   r   'File')r?  r*   r   rn  )r'  r*   r   rn  )rH  r*   r   r*   )rM  r*   rN  r*   r   r*   )rX  zT.Union[str, T.Tuple[str, ...]]r   rm  )r   )r   r*   r\  r  r   T.List[str]re  objectr   rm  r   r  )r   r    r!   r"   r   r,  r   staticmethodr   r7  r;  rB  rE  rI  rP  propertyrU  r   r>  r`  rf  ri  r+  r$   r   r%   r&   r.   r.     s   4$0 t*  *
 t)  ) t8  8 & & tG G tL L ; ;+67g t5 5r%   c                f    U  H  nUR                  U5      (       d  M  Us  $    [        SU< 35      e)zNGiven a set of compilers and a source, find the compiler for that source type.z&No specified compiler can handle file )can_compiler   )	compilerssrccomps      r&   r^   r^     s7    C  K  A#I
JJr%   c                p    0 nU H-  n[        X5      nXB;  a  U/X$'   M  X$   R                  U5        M/     U$ r   )r^   append)rw  sourcescompsrclistrx  ry  s        r&   rG   rG     sD    >@K&y6"!$K$$S)  r%   buildhostzbuild.r   c                  >    \ rS rSrSrSrSrS
S jrS
S jrS
S jr	Sr
g	)r9   i  zrEnum class representing one of the two abstract machine names used in
most places: the build, and host, machines.
r   r   c                (    U R                  5        S3$ )Nz machine)get_lower_case_namer   s    r&   r,  MachineChoice.__str__  s    **,-X66r%   c                (    [         U R                     $ r   )MACHINE_NAMESvaluer   s    r&   r  !MachineChoice.get_lower_case_name  s    TZZ((r%   c                (    [         U R                     $ r   )MACHINE_PREFIXESr  r   s    r&   
get_prefixMachineChoice.get_prefix  s    

++r%   r   Nr  )r   r    r!   r"   r   BUILDHOSTr,  r  r  r$   r   r%   r&   r9   r9     s"     ED7),r%   r9   )eqorderc                  R    \ rS rSr% S\S'   S\S'   SS jrSS jrSS jrSS jrS	r	g
)r>   i  r/   r~  r  c                L    U R                   U R                  /UR                     $ r   )r~  r  r  r   machines     r&   __getitem__PerMachine.__getitem__  s    

DII&w}}55r%   c                8    [        XR                  5       U5        g r   )setattrr  )r   r  vals      r&   __setitem__PerMachine.__setitem__  s    113S9r%   c                    [        5       nU R                  Ul        U R                  Ul        UR                  UR                  :X  a  SUl        U$ zUnset definition duplicated from their previous to None

This is the inverse of ''default_missing''. By removing defaulted
machines, we can elaborate the original and then redefault them and thus
avoid repeating the elaboration explicitly.
N)r?   r~  r  r   unfreezes     r&   miss_defaultingPerMachine.miss_defaulting  s?     ;P:Q		==HNN* HMr%   c                    Xl         X l        g r   r~  r  )r   r~  r  s      r&   assignPerMachine.assign  s    
	r%   r  N)r  r9   r   r/   )r  r9   r  r/   r   None)r   z%PerMachineDefaultable[T.Optional[_T]])r~  r/   r  r/   r   r  )
r   r    r!   r"   r#   r  r  r  r  r$   r   r%   r&   r>   r>     s     I
H6:r%   r>   c                  8    \ rS rSr% SrS\S'   S	S jrS
S jrSrg)r@   i  zLike `PerMachine` but includes `target` too.

It turns out just one thing do we need track the target machine. There's no
need to computer the `target` field so we don't bother overriding the
`__getitem__`/`__setitem__` methods.
r/   targetc                   [        5       nU R                  Ul        U R                  Ul        U R                  Ul        UR                  UR                  :X  a  SUl        UR                  UR                  :X  a  SUl        U$ r  )rA   r~  r  r  r  s     r&   r  PerThreeMachine.miss_defaulting%  sb     @Z?[		++??hmm+"HO==HNN* HMr%   c                $    U R                   X   :H  $ r   )r~  r  s     r&   matches_build_machine%PerThreeMachine.matches_build_machine6  s    zzT]**r%   r   N)r   z,'PerThreeMachineDefaultable[T.Optional[_T]]')r  r9   r   rm  )	r   r    r!   r"   r   r#   r  r  r$   r   r%   r&   r@   r@     s     J"+r%   r@   c                  T    \ rS rSr% SrSrS\S'   SrS\S'   S
S jr\	SS j5       r
S	rg)r?   i:  zCExtends `PerMachine` with the ability to default from `None`s.
    NT.Optional[_T]r~  r  c                    U R                   c   S5       e[        U R                   U R                  b  U R                  5      $ U R                   5      $ )z}Default host to build

This allows just specifying nothing in the native case, and just host in the
cross non-compiler case.
z0Cannot fill in missing when all fields are empty)r~  r>   r  r   s    r&   default_missing%PerMachineDefaultable.default_missingB  sD     zz%Y'YY%$**4993HdiiYYdjjYYr%   c                L    U " U5      nU(       a  X4l         UR                  5       $ )a  Easy way to get a defaulted value

This allows simplifying the case where you can control whether host and
build are separate or not with a boolean. If the is_cross value is set
to true then the optional host value will be used, otherwise the host
will be set to the build value.
)r  r  )r  is_crossr~  r  r   s        r&   defaultPerMachineDefaultable.defaultK  s$     JF  ""r%   r   )r   PerMachine[_T])r  rm  r~  r/   r  r/   r   r  )r   r    r!   r"   r   r~  r#   r  r  r   r  r$   r   r%   r&   r?   r?   :  s7     !E> D.Z # #r%   r?   c                  2    \ rS rSr% SrSrS\S'   SS jrSrg)	rA   iZ  zHExtends `PerThreeMachine` with the ability to default from `None`s.
    Nr  r  c                    U R                   c   S5       eU R                  b  U R                  OU R                   nU R                  b  U R                  OUn[        U R                   X5      $ )zDefault host to build and target to host.

This allows just specifying nothing in the native case, just host in the
cross non-compiler case, and just target in the native-built
cross-compiler case.
z4Cannot default a PerMachine when all values are None)r~  r  r  r@   )r   r  r  s      r&   r  *PerThreeMachineDefaultable.default_missinga  sW     zz%]']]% II1tyytzz $ 7Ttzz488r%   r   )r   zPerThreeMachine[_T])	r   r    r!   r"   r   r  r#   r  r$   r   r%   r&   rA   rA   Z  s     "FN!
9r%   rA   c                 N    [         R                  " 5       R                  5       S:H  $ )NsunosplatformsystemrT  r   r%   r&   ru   ru   n      ??""$//r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Ndarwinr  r   r%   r&   rr   rr   r      ??""$00r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nlinuxr  r   r%   r&   ro   ro   v  r  r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nandroidr  r   r%   r&   rf   rf   z      ??""$	11r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nhaikur  r   r%   r&   rl   rl   ~  r  r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nopenbsdr  r   r%   r&   rq   rq     r  r%   c                 R    [         R                  " 5       R                  5       n U S:H  $ )Nwindowsr  )platnames    r&   rv   rv     s"     &&(Hy  r%   c                 p    [        5       =(       a&    S[        R                  " 5       R                  5       ;   $ )N	microsoft)ro   r  releaserT  r   r%   r&   rw   rw     s&    :C+)9)9);)A)A)CCCr%   c                 (    [         R                  S:H  $ )Ncygwin)sysr  r   r%   r&   rh   rh     s    <<8##r%   c                 @    [         R                  R                  S5      $ )Nz/etc/debian_version)r   r   r4  r   r%   r&   ri   ri     s    77>>/00r%   c                 N    [         R                  " 5       R                  5       S:H  $ )N	dragonflyr  r   r%   r&   rj   rj     s    ??""$33r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nnetbsdr  r   r%   r&   rp   rp     r  r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nfreebsdr  r   r%   r&   rk   rk     r  r%   c                 J    [         R                  " 5       R                  S5      $ )Nirix)r  r  
startswithr   r%   r&   rn   rn     s    ??''//r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Ngnur  r   r%   r&   rm   rm         ??""$--r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Nqnxr  r   r%   r&   rt   rt     r  r%   c                 N    [         R                  " 5       R                  5       S:H  $ )Naixr  r   r%   r&   re   re     r  r%   r1  c                B   [        SSU /5      u  pnU(       d  [        R                  " SU  SU 35        gUR                  SS5      S   nSSSS	S	S
.nUR	                  5       nU Vs/ s H  odR                  Xf5      PM     nnSU;   a  UR                  S5        U$ s  snf )z
For a specific object (executable, static library, dylib, etc), run `lipo`
to fetch the list of archs supported by it. Supports both thin objects and
'fat' objects.
lipoz-infozlipo : Nr   x86aarch64ppc)i386arm64arm64eppc7400ppc970armv7arm)r   r   debugr`  r>  getr{  )objpathr   stdor   map_arch
lipo_archs	lipo_archmeson_archss           r&   rI   rI     s     !&'7!;<OAV

U7)2fX./;;tQ"D H JGQRz)<<	5zKR $5! Ss   'Bc                    [         R                  S:w  a  g SSKn U R                  5       nU R                  5       nU R                  R
                  nU R                  UR                  5       5      nUR                  X@R                  U5      U R                  U5      5      (       aD  UR                  S:X  a  gUR                  S:X  a  gUR                  S	:X  a  g
UR                  S:X  a  g[        R                  R                  SS5      R!                  5       nU(       d$   [        R                  S   R!                  5       nU$ U$ ! [        [        4 a     Nmf = f! ["         a    [%        S5      ef = f)z9
The architecture of Windows itself: x86, amd64 or arm64
win32r   r   Nid  amd64iL  r  id  r  i  r  PROCESSOR_ARCHITEW6432PROCESSOR_ARCHITECTUREz'Unable to detect native OS architecture)r  r  ctypesc_ushortwindllkernel32c_void_pGetCurrentProcessIsWow64Process2byrefr  OSErrorAttributeErrorr   r   r  rT  KeyErrorr:   )r   process_archnative_archr  processarchs         r&   r   r     sF    ||w(oo'==))//("<"<">?##G\\,-GVaIbcc  F*""f,""f,""f, ::>>2B7==?D	R::67==?D K4K ^$   	R&'PQQ	Rs0   BE 6E E E !E EEE0c                  x    \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S'   S\S	'   S
rS\S'   SrS\S'   SS jrSrg
)VcsDatai  r*   namer   repo_dirro  get_rev	rev_regexdepNr   wc_dirFrm  repo_can_be_filec                    [         R                  " U R                  5      (       d  gXR                  -  nUR	                  5       (       a  gUR                  5       (       a  U R                  (       a  ggNFT)shutilwhichr   r  is_diris_filer  )r   curdirrepos      r&   repo_existsVcsData.repo_exists  sK    ||DHH%%%;;==<<>>d33r%   r   )r  r   r   rm  )	r   r    r!   r"   r#   r  r  r   r$   r   r%   r&   r  r    s;    
I	HMN	H"FO""d"
r%   r  c                   [        SSS/ SQSSSS9[        SS	S
/ SQSSS9[        SSSSS/SSS9[        SSSSS/SSS9/n[        U [        5      (       a  [        U 5      n [        R
                  " U R                  5      nUR                  U 5        U H8  nU H/  nUR                  U5      (       d  M  [        U5      Ul	        Us  s  $    M:     g )Nrc   z.git)rc   describez	--dirty=+z--alwaysz(.*)z.git/logs/HEADT)r  r   r  r  r  r  r  	mercurialhgz.hg)r%  idz-iz.hg/dirstate)r  r   r  r  r  r  
subversionsvnz.svninfozRevision: (.*)z
.svn/wc.dbbazaarbzrz.bzrrevno)
r  r   r*   r   collectionsdequeparents
appendleftr   r  )
source_dirvcs_systemsparent_paths_and_selfr  vcss        r&   rU   rU     s    B"!	
 	(	
 	fo(	
 	g&	
5"KF *c""*%
'--j.@.@A $$Z0'Cv&& [

  (
 r%   c                     [         R                  R                  SS5      n U R                  SS5      n[	        US   5      nUS:  a  gUS:X  a  [	        US	   5      S
:  a  gU R                  S5      =(       a    SU ;   $ )N	VSCMD_VERr   .r   r      T   r   
   z16.9.0z-pre.)r   r   r  r>  r  r  )vsvernumsmajors      r&   rH   rH   9  sq    JJNN;+E;;sADQLE{{s47|r)H%:'U*::r%   z(\d+)|([a-zA-Z]+)c                  x    \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSrg)rE   iF  c                    Xl         [        R                  U5       Vs/ s HD  nUR                  S5      (       a  [	        UR                  S5      5      OUR                  S5      PMF     snU l        g s  snf )Nr   r   )_s_VERSION_TOK_REfinditerr   r  _v)r   r   r   s      r&   r   Version.__init__G  s]     )11!464A $%771::AGGAJ1771:=46 6s   AA2c                `    SR                  U R                  [        U R                  5      5      $ )Nz	{} (V={}))r   r@  r*   rC  r   s    r&   r,  Version.__str__P  s!    !!$''3tww<88r%   c                "    SU R                    S3$ )Nz
<Version: r/  )r@  r   s    r&   r   Version.__repr__S  s    DGG9A&&r%   c                x    [        U[        5      (       a   U R                  U[        R                  5      $ [
        $ r   )r   rE   _Version__cmpoperatorltrc  rd  s     r&   __lt__Version.__lt__V  *    eW%%::eX[[11r%   c                x    [        U[        5      (       a   U R                  U[        R                  5      $ [
        $ r   )r   rE   rJ  rK  gtrc  rd  s     r&   __gt__Version.__gt__[  rO  r%   c                x    [        U[        5      (       a   U R                  U[        R                  5      $ [
        $ r   )r   rE   rJ  rK  lerc  rd  s     r&   __le__Version.__le__`  rO  r%   c                x    [        U[        5      (       a   U R                  U[        R                  5      $ [
        $ r   )r   rE   rJ  rK  gerc  rd  s     r&   __ge__Version.__ge__e  rO  r%   c                j    [        U[        5      (       a  U R                  UR                  :H  $ [        $ r   r   rE   rC  rc  rd  s     r&   rf  Version.__eq__j  (    eW%%77ehh&&r%   c                j    [        U[        5      (       a  U R                  UR                  :g  $ [        $ r   r]  rd  s     r&   __ne__Version.__ne__o  r_  r%   c                .   [        U R                  UR                  5       HC  u  p4[        U[        5      n[        U[        5      nXV:w  a
  U" XV5      s  $ X4:w  d  M;  U" X45      s  $    U" [	        U R                  5      [	        UR                  5      5      $ r   )ziprC  r   r  r  )r   re  
comparatorourstheirsours_is_inttheirs_is_ints          r&   __cmpVersion.__cmpt  su    2LD$T3/K&vs3M+!+==~!$// 3 #dgg,EHH66r%   )r@  rC  N)r   r*   r   r  r  rp  )re  z	'Version're  z T.Callable[[T.Any, T.Any], bool]r   rm  )r   r    r!   r"   r   r,  r   rM  rR  rV  rZ  rf  ra  rJ  r$   r   r%   r&   rE   rE   F  s4    69'





7r%   rE   c                   U R                  S5      (       a  [        R                  nU SS  n X4$ U R                  S5      (       a  [        R                  nU SS  n X4$ U R                  S5      (       a  [        R                  nU SS  n X4$ U R                  S5      (       a  [        R
                  nU SS  n X4$ U R                  S5      (       a  [        R
                  nU SS  n X4$ U R                  S5      (       a  [        R                  nU SS  n X4$ U R                  S	5      (       a  [        R                  nU SS  n X4$ [        R
                  nX4$ )
N>=r   <=!====r   r/  <)r  rK  rY  rU  ner  rQ  rL  )vstr2cmpops     r&   _version_extract_cmpoprv    sj   ab	, >+ 
		$		ab	& >% 
		$		ab	  > 
		$		ab	 > 
		#		ab	 > 
		#		ab	 > 
		#		ab	 > >r%   c                R    [        U5      u  p!U" [        U 5      [        U5      5      $ r   )rv  rE   )vstr1rt  ru  s      r&   r   r     s#    +E2NU00r%   c                    [        U[        5      (       a  U/n/ n/ nU H7  n[        X5      (       d  UR                  U5        M&  UR                  U5        M9     U(       + X24$ r   )r   r*   r   r{  )rx  
conditionsfound	not_foundreqs        r&   r   r     s^    *c"" \
EIu**S!LL	 
 =)**r%   c           	        U R                  S5      (       a  [        R                  nU SS  n OU R                  S5      (       a  gU R                  S5      (       a  gU R                  S5      (       a  [        R                  nU SS  n OU R                  S5      (       a  [        R                  nU SS  n OSU R                  S	5      (       a  [        R                  nU SS  n O'U R                  S
5      (       a  g[        R                  nU R	                  5       n [
        R                  " SU 5      (       a  U S-  n [        R                  " SU" [        U5      [        U 5      5      5      $ )Nrm  r   rn  Fro  rp  rq  r   r/  rr  z	^\d+.\d+$z.0rm  )
r  rK  rU  rL  r   r  r
  r  castrE   )	conditionminimumru  s      r&   r   r     s&   D!!abM				d	#	#			d	#	#			d	#	#abM				c	"	"abM				c	"	"abM				c	"	" !I	xxi((T	66&% 0')2DEFFr%   c                   [         R                  " S[         R                  5      nUR                  U 5      nU(       a  UR	                  S5      $ [         R                  " S5      nUR                  U 5      nU(       a  UR	                  S5      $ g)NaS  
    (?<!                # Zero-width negative lookbehind assertion
        (
            \d          # One digit
            | \.        # Or one period
        )               # One occurrence
    )
    # Following pattern must not follow a digit or period
    (
        \d{1,2}         # One or two digits
        (
            \.\d+       # Period and one or more digits
        )+              # One or more occurrences
        (
            -[a-zA-Z0-9]+   # Hyphen and one or more alphanumeric
        )?              # Zero or one occurrence
    )                   # One occurrence
    r   z(\d{1,4}\.\d{1,4}\.?\d{0,4})zunknown version)r  r  VERBOSEsearchr   )textversion_regexr
  s      r&   r   r     sx     JJ  " 
#M$   &E{{1~ JJ>?M  &E{{1~r%   c                    [        5       (       a{   [        R                  " SS/[        R                  [        R                  S9n U R                  5       u  pU R                  S:X  a#  UR                  5       R                  5       nSU-   $  [        5       (       d  [        5       (       a  g[        R                  R                  S5      (       a%  [        R                  R                  S5      (       d  gg! [         a     Nuf = f)	Nzdpkg-architecturez-qDEB_HOST_MULTIARCHr   r   zlib/libz
/usr/lib64lib64)ri   
subprocessPopenPIPEDEVNULLcommunicater   r   r   	Exceptionrk   rn   r   r   isdirislink)pcr  r   archpaths       r&   rJ   rJ     s    		!!#68N"O)3)3););=B (IT}}!;;=..0(( "
 ||wyy	ww}}\""277>>,+G+G  		s   A8C4 4
D Dc                 $    [        5       (       a  gg)Nr  libexecrl   r   r%   r&   rK   rK     s    zzr%   c                 D    [        5       (       a  g[        5       (       a  gg)Nzc:/z/boot/system/non-packagedz
/usr/local)rv   rl   r   r%   r&   rL   rL   !  s    ||zz*r%   c                 $    [        5       (       a  gg)Ndatasharer  r   r%   r&   rM   rM   )  s    zzr%   c                 $    [        5       (       a  gg)Nzdevelop/headersincluder  r   r%   r&   rN   rN   /  s    zz r%   c                 $    [        5       (       a  gg)Nzdocumentation/infoz
share/infor  r   r%   r&   rO   rO   5  s    zz#r%   c                 $    [        5       (       a  gg)Nzdata/localezshare/localer  r   r%   r&   rP   rP   ;  s    zzr%   c                 $    [        5       (       a  gg)Nzdocumentation/manz	share/manr  r   r%   r&   rQ   rQ   A  s    zz"r%   c                 $    [        5       (       a  gg)Nbinsbinr  r   r%   r&   rR   rR   G  s    zzr%   c                 $    [        5       (       a  gg)Nsettingsetcr  r   r%   r&   rS   rS   M  s    zzr%   c                x   SnU =(       d    / n U R                  S5        U  HB  nU[        R                  ;   d  M   [        [        R                  U   5      nUS:  a  [        eMD     US:X  a   [        R                  " 5       nU$ U$ ! [         a    [        SU S35        Sn M  f = f! [         a    Sn U$ f = f)Nr   MESON_NUM_PROCESSESzInvalid value in z, using 1 thread.r   )	r{  r   r   r  
ValueErrorprintmultiprocessing	cpu_countr  )varnamesnum_workersvarnames      r&   rV   rV   S  s    K~2H OO)*bjj  !"**W"56?$$ #	  a	 *335K ;   )'2CDE   	K	s#   (B.B) B&%B&)B98B9c                   [         R                  R                  U 5      [         R                  R                  U5      :X  d   e[        5       (       a$  U R	                  SS5      n UR	                  SS5      nU R                  S5      nUR                  S5      nU Vs/ s H  oD(       d  M  US:w  d  M  UPM     nnU Vs/ s H  oD(       d  M  US:w  d  M  UPM     nn[        U5      n[        U5      U:  =(       a    USU U:H  $ s  snf s  snf )a  Checks if @trial is a file under the directory @parent. Both @trial and @parent should be
adequately normalized, though empty and '.' segments in @parent and @trial are accepted
and discarded, matching the behavior of os.path.commonpath.  Either both or none should
be absolute.\/r7  N)r   r   r   rv   replacer>  r  )parenttrialsplit_parentsplit_trialc
componentss         r&   rs   rs   l  s    
 77== BGGMM%$8888||c*dC(<<$L++c"K+>|!qAQ#XA|L>)<kQ1181kK<\"J{z)Vk+:.F,.VV	 ?<s$   
D*D2D>
D	D	D	c                $    U H
  nX ;   d  M
    g   g)z@Checks if any of the specified @sep path separators are in @nameTFr   )r  sepeachs      r&   rd   rd     s    <  r%   z 	
[z"]c                    U (       a  [        U 5      (       d  U $ SnSnU  H*  nUS:X  a  US-  nM  US:X  a  US-  S-   nXS-  U-   -  nSnM,     XS-  S-  S-   -  nU$ )N"r   r  r   r   )_find_unsafe_char)argresultnum_backslashesr  s       r&   r   r     s    (--JADy1$8&5&9A&=OD0144"#  	Q&$.44r%   c                p   / nSnSnSnSnU  H  nUS:X  a  US-  nM  US:X  a!  US-  (       d  X#S-  S-  -  nUS-  nU(       + nOMU[         ;   a+  U(       d$  U(       d  U(       a  UR                  U5        SnSnOUS:X  a  US-
  S-  nX#S-  U-   -  nSnM     U(       d  U(       a  UR                  U5        U$ )Nr   r   Fr  r   r  r   )_whitespacer{  )r   r  r  r  
num_quotes	in_quotesr  s          r&   r   r     s     
	ADy1$8Oa$7q0D88C!OJ$-I+%ijc* %&
Cx+:Q+>1*DT1A55C"#- 0 *MM#r%   c                .    [         R                  " U 5      $ r   )shlexquote)r  s    r&   r   r         {{3r%   c                .    [         R                  " U 5      $ r   )r  r>  )r   s    r&   r   r     r  r%   c                b    SR                  U  Vs/ s H  n[        U5      PM     sn5      $ s  snf )N )r5  r   )argsr   s     r&   ry   ry     s'    88404aYq\40110s   ,c                f    US:X  a  [        XU5      $ US;   a  [        XS:H  U5      $ [        S5      eNmeson>   cmakecmake@r  zInvalid variable format)do_replacement_mesondo_replacement_cmaker   )regexlinevariable_formatconfdatas       r&   rY   rY     s@     '!#E::	/	/#DX*ExPP677r%   c                ^   ^^ [        5       mSUU4S jjn[        R                  " XU5      T4$ )Nc                0  > U R                  S5      R                  S5      (       a+  U R                  S5      U R                  S5      -
  nSUS-  -  $ U R	                  5       R                  S5      b  U R                  S5      SS S-   $ U R                  S5      nS	nUT;   ac  TR                  U5      u  pE[        U[        5      (       a  UnU$ [        U[        5      (       a  [        U5      nU$ S
U< SU< 3n[        U5      eTR                  U5        U$ )Nr   r  r   escapedr   @variabler   Tried to replace variable 2 value with something other than a string or int: )r   r   endstart	groupdictr  r   r*   r  r   add)	r
  num_escapesr  var_strvarr   r   r  missing_variabless	          r&   variable_replace.do_replacement_meson.<locals>.variable_replace  s   ;;q>""4(())A,Q7K;!+,,__""9-9;;y)!B/33 kk*-GG("!g.c3''!G N  S))!#hG N 7wk BCCF'KC(--!%%g.Nr%   )r
  T.Match[str]r   r*   )setr  sub)r  r  r  r  r  s     ` @r&   r  r    s.    $'E 2 66%402CCCr%   c                   ^^^^^^ [        5       m[        R                  " S[        R                  5      mSUU4S jjmSUUUU4S jjmT" U 5      T4$ )Nz 
        [^a-zA-Z0-9_/.+\-]
    c                V  > SnU T;   a  TR                  U 5      u  p#[        U[        5      (       a  UnU$ [        U[        5      (       a  [        [	        U5      5      nU$ [        U[        5      (       a  [        U5      nU$ SU < SU< 3n[        U5      eTR                  U 5        U$ )Nr   r  r  )r  r   r*   rm  r  r   r  )r  r  r  r   r   r  r  s        r&   variable_get*do_replacement_cmake.<locals>.variable_get  s    h\\'*FC#s##  C&&c#h-  C%%c(  37+ >??BgG$S))!!'*r%   c                b  > Sn[        U 5      U:  Gaz  X   S:X  aV  U R                  SUS-   5      nX!S-   :  a7  XS-   U nTR                  U5      nU(       d  T" U5      nU S U U-   XS-   S  -   n GOT(       d  XUS-    S:X  a  SnUS-   n US:  a|  XUS-    S:X  a  US-  nUS-  nO^X   S:X  a  US-  nUS-  nOKX   S;   a  US-  nO=TR                  X   5      (       a   X   nXS-   U n	SU< S	U	< 3n
[        U
5      eUS-  nUS:  a  M|  US:X  ac  T" XS-   US-
   5      nTR                  U5      nU(       a&  XS-
     nXS-   US-
   n	SU< S	U	< 3n
[        U
5      eT" U5      nU S U U-   XS  -   n US-  n[        U 5      U:  a  GMz  U $ ! [         a    S
XS < 3n
[        U
5      ef = f)Nr   r  r   r   z${}>   
r  zFound invalid character z in variable zFound incomplete variable r   r   )r  findr  r   
IndexError)r  indexnext_atr  r
  r  bracket_countend_bracketinvalid_characterr  r   at_onlycharacter_regex
parse_liner  s              r&   r  (do_replacement_cmake.<locals>.parse_line  sX   $i%{c!))Cq11W$"773G+227;E ! ,W 5#FU|e3d19:6FFE!G!4!< !#ai.'!+KM:dB'1,K)Q.M!.#5'1,K)Q.M!.+= (1,K,33D4EFF040A-'+!GK'@H$<=N<Q$1(#?C"0"55'1,K% (!+. !A%(Agk!m)DEG+227;E,0Q,?)#'aA#> 89J8M -h\;,S11(1E<%/$|2DDDQJEk $i%n ' " .6t"~6HIC(--.s   B F F.)r  r*   r   r*   )r  r*   r   r*   )r  r  r  r  )r  r  r  r  r  r  r  s    ``@@@@r&   r  r    sM    $'Ejj "	O $9 9v d...r%   c                   UR                  5       n[        U5      S:w  a  [        SUR                  5       -  5      eUS   n UR	                  U5      u  pg[        U[        5      (       a)  SU SU 3R                  5       S-   n[        XU5      u  pU$ [        U[        5      (       a  U(       a  SU-  $ S	U-  $ [        U[        5      (       a  S
XV4-  $ [        SU-  5      e! [
         a    SU-  s $ f = f)Nr   z4#mesondefine does not contain exactly two tokens: %sr   /* #undef %s */
#define r  r  z#define %s
z
#undef %s
z#define %s %d
z.#mesondefine argument "%s" is of unknown type.)r>  r  r   r   r  r
  r   r*   r  rm  r  )	r  r  r  
subprojectarrr  vr   r  s	            r&   do_define_mesonr  U  s    **,C
3x1}SVZV`V`Vbbcc!fG-||G$ !SG9AaS)//1D8(A		At		!G++ 7**	As		 G<//MPWWXX  -"W,,-s   C" "C43C4c                  ^ SU ;   mSU4S jjnU SS  R                  5       n[        U5      S:w  a  Ub  SSKJn  UR	                  SSU5        US   n UR                  U5      u  pT(       d  U(       d  S	U-  $ U" X5      n
S
U SU
 3R                  5       S-   n
[        XU5      u  pU
$ ! [         a    T(       a  SU-  s $ S	U-  s $ f = f)Ncmakedefine01c                N  > U SS  R                  5       nT(       a3  UR                  US   5      u  p4[        [        [	        U5      5      5      $ / nUSS   H&  n UR                  U5      u  p7U[        U5      /-  nM(     SR                  U5      $ ! [
         a	    XV/-  n MM  f = f)Nr   r   r  )r>  r  r*   r  rm  r
  r5  )	r  r  r  r  descdefine_valuetokenr   cmake_bool_defines	           r&   get_cmake_define)do_define_cmake.<locals>.get_cmake_definet  s    12hnn SV,IQs47|$$$&WE(||E*Q(  xx%%  ('(s   "BB$#B$r   r   )
FeatureNewz&cmakedefine without exactly two tokensz0.54.1z#define %s 0
r  r  r  r  )r  r*   r  'ConfigurationData'r   r*   )	r>  r  interpreterbase.decoratorsr  
single_user  r
  r   r  )r  r  r  r  r  r  r  r  r  r   r  r  s              @r&   do_define_cmaker  p  s    '4/&  qr(..
C
3x1}/;FR\]!fG1||G$ Q"W,,d-Fy&*002T9F$Vh?IFM  1#g--&00	1s   B* *C
C
	C
c                   U S:X  a'  [         R                  " S[         R                  5      nU$ U S:X  a'  [         R                  " S[         R                  5      nU$ U S:X  a%  [         R                  " S[         R                  5      nW$ )Nr  a  
            (?:\\\\)+(?=\\?@)  # Matches multiple backslashes followed by an @ symbol
            |                  # OR
            (?<!\\)@(?P<variable>[-a-zA-Z0-9_]+)@  # Match a variable enclosed in @ symbols and capture the variable name; no matches beginning with '\@'
            |                  # OR
            (?P<escaped>\\@[-a-zA-Z0-9_]+\\@)  # Match an escaped variable enclosed in @ symbols
        r  z
            (?<!\\)@(?P<variable>[-a-zA-Z0-9_]+)@  # Match a variable enclosed in @ symbols and capture the variable name; no matches beginning with '\@'
        r  z
            \${(?P<variable>[-a-zA-Z0-9_]*)}  # Match a variable enclosed in curly braces and capture the variable name
        )r  r  r  )r  r  s     r&   ra   ra     s    '!

  ZZ L 
H	$

 ZZ L	 
G	#

 ZZ Lr%   c                h    US:X  a  [        XX$5      $ US;   a  [        XX#S:H  U5      $ [        S5      er  )do_conf_str_mesondo_conf_str_cmaker   )rx  r  r  r  r  s        r&   rX   rX     sC     '! HAA	/	/ H6QS]^^677r%   c                   [        S5      nSn/ n[        5       nUR                  5       (       + nU H  n	U	R                  5       R	                  U5      (       a  Sn[        XIX#5      n	ONSU	;   a   [        SU  SU	R                  5        S35      e[        XIU5      u  pUR                  U
5        U
(       a  SnUR                  U	5        M     XgU4$ )Nr  #mesondefineFz#cmakedefineFormat error in : saw "z" when format set to "meson")ra   r  keyslstripr  r  r   r   r  updater{  )rx  r  r  r  r  search_tokenr  r  confdata_uselessr  missings              r&   r  r    s     w'E!LF$'E $==?*;;=##L11$"5ED%$'7uGDJJL>Qm%noo0hGMD$$W-#( d  &666r%   c           
        SnU(       a  SnSn/ n[        5       nUR                  5       (       + n	U H  n
U
R                  5       n[        U5      S:  a?  US   S:X  a6  USS  R                  5       R	                  U5      (       a  Sn	[        XX45      n
OQS	U
;   a#  [        S
U  SU
R                  5        SU S35      e[        XU5      u  pUR                  U5        U(       a  Sn	UR                  U
5        M     XxU	4$ )Nr  r  cmakedefiner   r   #r   Fr  r  r  z" when format set to "r  )r  r  r  r  r  r  r   r   r  r   r{  )rx  r  r  r  r  r  r!  r  r  r"  r  stripped_liner#  s                r&   r  r    s	    3:O" LF$'E $==?*}"}Q'73'>=QRQSCTC[C[C]ChChiuCvCv$"47GD%$'7uGDJJL>Qghwgxxy%z{{0IMD$$W-#( d  &666r%   c                    [        XSS9 nUR                  5       nS S S 5        [	        U WX#U5      u  pnUS-   n [        USUSS9 nUR                  U	5        S S S 5        [        R                  " X5        [        X5        X4$ ! , (       d  f       No= f! [         a  n[        SU  SU< 35      eS nAff = f! , (       d  f       Ng= f! [         a  n[        SU SU< 35      eS nAff = f)Nr   )encodingnewlinezCould not read input file r  ~r   zCould not write output file )	open	readlinesr  r   rX   
writelinesr  copymoder   )rx  dstr  r  r)  r  fr  r   r  r  r"  dst_tmps                r&   rW   rW     s    H#"5;;=D 6
 5@T8fp4q1V 0CiGJ'32>!LL  ? OOC!&.. 65 H9#bFGGH ?> J;C51%HIIJsh   
B BB C B;C 
BB B 
B8!B33B8;
C	C 	C 
C-C((C-zc/*
 * Autogenerated by the Meson build system.
 * Do not edit, your changes will be lost.
 */

{}

zV; Autogenerated by the Meson build system.
; Do not edit, your changes will be lost.

c           	        US:X  aG  U(       a%  [         R                  SR                  U5      5      nO[         R                  S5      nSnS nO[        nSnS nU R                  U5        [	        UR                  5       5       H  nUR                  U5      u  pU	(       a  U R                  U" U	5      5        [        U[        5      (       a9  U(       a  U R                  U SU S	35        Mi  U R                  U S
U S	35        M  [        U[        [        45      (       a  U R                  U SU SU S	35        M  [        SU-   5      e   US:X  a  U(       a  U R                  S5        g g g )Nr  z#ifndef {0}
#define {0}z#pragma oncer&  c                    SU  S3$ )Nz/* z */
r   r  s    r&   <lambda> _dump_c_header.<locals>.<lambda>!  s    Se#4r%   %c                L    SSR                  U R                  5       5      -   S-   $ )Nz; z
; r  )r5  
splitlinesr5  s    r&   r6  r7  %  s    4&++doo6G*H#H4#Or%   zdefine z

zundef r  z/Unknown data type in configuration file entry: z#endif
)CONF_C_PRELUDEr   CONF_NASM_PRELUDEwritesortedr  r  r   rm  r  r*   r   )
ofilecdataoutput_format
macro_namepreludeprefixformat_desckr  r  s
             r&   _dump_c_headerrG    s<   
 $++,F,M,Mj,YZG$++N;G4#O	KKEJJL!IIaL	KKD)*avhgaS56vhfQCt45C:&&KK6('!AaS56 !RUV!VWW " 
J !+r%   c                ,   U S-   n[        USSS9 nUS:X  aG  UR                  R                  5        VVs0 s H
  u  pgXgS   _M     nnn[        R                  " XSS9  O[        XQX#5        S S S 5        [        X5        g s  snnf ! , (       d  f       N = f)	Nr+  r   utf-8r)  jsonr   T)	sort_keys)r,  valuesitemsrK  dumprG  r   )		ofilenamer@  rA  rB  ofilename_tmpr?  rF  r  r  s	            r&   r<   r<   9  s     OM	mS7	3uF"(-(:(:(<=(<AtG(<D=IIdT25C 
4 2 > 
4	3s   $BA?%B?B
Bc                r   Sn [        U S5       n[        US5       nUR                  5       UR                  5       :X  a  SnS S S 5        S S S 5        U(       a  [        R                  " X5        g [        R
                  " U5        g ! , (       d  f       NK= f! , (       d  f       NT= f! [         a     Ncf = f)NTrbF)r,  readFileNotFoundErrorr   r  unlink)r0  r2  	differentf1f2s        r&   r   r   G  s     I#t_D$$72wwyBGGI%!	 %8_
 


7 
		' %8$7__  sE   B) B%BB
B) 
B	B
B&"B) &B) )
B65B6c                    [        U [        5      (       d  U /$ / nU  H?  nU(       a$  [        U[        5      (       a  U[        USS9-  nM.  UR                  U5        MA     U$ )z
Returns a list with all args embedded in a list if they are not a list.
This function preserves order.
@flatten: Convert lists of lists to a flat list
Tflatten)r   listr{   r{  )itemr\  r  is       r&   r{   r{   W  sZ     dD!!vFz!T**ga..FMM!	 
 Mr%   c                   [        U [        5      (       ay  U R                  S5      (       a   [        R                  " U 5      nOrU S:X  a  / nOiU(       a  [        U 5      nOVU R                  S5       Vs/ s H  o3R                  5       PM     nnO'[        U [        5      (       a  U nO[        SU  S35      e[        U[        5      (       d   eU$ ! [
         a    [        SU  35      ef = fs  snf )Nr  zmalformed value r   ,r  z)" should be a string array, but it is not)r   r*   r  astliteral_evalr  r   r   r>  r   r]  )r  shlex_split_argsnewvaluer  s       r&   r|   r|   g  s    %C  A++E2 b[H%e,/4{{3/?@/?!GGI/?@	E4	 	 q'PQRRh%%%%O  A$'7w%?@@A As   C 3C+C(c                r    U R                   nU(       a  U R                  n[        U" U5      =(       d    / SS9$ )z@
Extracts all values from given dict_object and listifies them.
Tr[  )r  popr{   )dict_objectkeyrg  fetchs       r&   r[   r[   |  s/     #.//E
5:#T22r%   c           	     L   [        X5      (       a  [        R                  " SU /5      n [        U [        5      (       d$  [	        SR                  U[        U 5      5      5      eU  H<  nUc  M  [        X!5      (       a  M  [	        SR                  U[        U5      5      5      e   U $ )z]
Ensure that type(@item) is one of @types or a
list of items all of which are of type @types

T.List[_T]z,Item must be a list or one of {!r}, not {!r}z'List item must be one of {!r}, not {!r})r   r  r  r]  r   r   type)r^  typesr_  s      r&   r   r     s     $vvlTF+dD!!KRRSXZ^_cZdeff=A!5!5 !J!Q!QRWY]^_Y`!abb  Kr%   c                "    [        U [        5      $ r   )r   r*   )r^  s    r&   r   r     s    c""r%   c                   / nU  Hh  nUR                  S5      (       d  UR                  U5        M,  USS  n [        USS9 nUR                  5       R	                  5       nS S S 5        UW-  nMj     U$ ! , (       d  f       N= f! [
         a9  n[        R                  " SUS5        [        R                  " U5         S nA  g S nAff = f)Nr  r   rI  rJ  z!Expanding command line arguments:z	not found)	r  r{  r,  rT  r>  r  r   error	exception)r  expended_argsr  	args_filer1  extended_argsr   s          r&   rZ   rZ     s    !#M~~c""  %G		i'2a ! 0 3]*M   32  	JJ:YTNN1	s/   
BA3 B3
B	=B
C.CCc                N   ^  [        U5      u  p#U 4S jU 5       U 4S jU 5       4$ )zUse a predicate to partition entries into false entries and true
entries.

>>> x, y = partition(is_odd, range(10))
>>> (list(x), list(y))
([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
c              3  F   >#    U  H  nT" U5      (       a  M  Uv   M     g 7fr   r   .0r  preds     r&   	<genexpr>partition.<locals>.<genexpr>  s     )r!aAAr   !	!c              3  F   >#    U  H  nT" U5      (       d  M  Uv   M     g 7fr   r   rx  s     r&   r{  r|    s     +Er!T!WAArr}  r   )rz  iterablet1t2s   `   r&   r}   r}     s&     ]FB)r)+Er+EEEr%   c           
        SS K nUR                  5       nUb  [        R                  n [        R
                  R                  (       a  UR                  5       S:w  a  [        U 4XX4S.UD6u  pn
O1[        R                  " U 4SUSX#US.UD6nUR                  U5      u  p [        R                   " 5         XU
4$ ! [         a7  nUR                  [        R                  :X  a  [        SU S   < S35      ee S nAff = f)	Nr   r   )r=  stdinr   r   TF)universal_newlinesr)  	close_fdsr  r   r   zFailed running ze, binary or interpreter not executable.
Possibly wrong architecture or the executable bit is not set.)r   r   r  r  r  r   r)  r   Popen_safe_legacyr  r  r  errnoENOEXECr   r   setup_console)r  r=  r  r   r   r   r   r)  r   r   r   oserrs               r&   r   r     s   
 **,H zz""hnn&6'&A'oEvohnoGA!   V$]b',FVNTVA=='DAq 	7N  ;;%--' ?47+ >a "a b b	s   AB9 /0B9 9
C:2C55C:c           	        [         R                  " U 4SSX#US.UD6nS nUb  UR                  S5      nUR                  U5      u  pUbs  [        R
                  R                  b9  UR                  [        R
                  R                  SS9R                  SS5      nOUR                  SS9R                  SS5      nU	b  [        R                  bX  [        R                  R                  (       a9  U	R                  [        R                  R                  SS9R                  SS5      n	OU	R                  SS9R                  SS5      n	XhU	4$ )	NF)r  r  r  r   r   rI  r  )r)  errorsz
r  )r  )
r  r  r   r  r  r   r)  r   r  r   )
r  r=  r  r   r   r   r   input_r   r   s
             r&   r  r    s!   
 	 	N%5$F	NFL	NA $Fg&== DA}::*#**"5"5iHPPQWY]^A	*2264@A}::!cjj&9&9#**"5"5iHPPQWY]^A	*2264@A7Nr%   c                B    [        U 40 UD6u  p4nUR
                  U(       a  UR                  5       OSU(       a  UR                  5       OSpn[        R                  " S5        [        R                  " U S[	        U 5       SU 35        U(       a  [        R                  " SU S35        U	(       a  [        R                  " SU	 S35        X4U4$ ! [         aC  n[        R                  " S5        [        R                  " U S[	        U 5       SU 35        e SnAff = f)z[
Wrapper around Popen_safe that assumes standard piped o/e and logs this to the meson log.
z-----------z: `z` -> Nzstdout:
z
-----------zstderr:
)r   r  r   r  ry   r   r   )
r  r   r   r   r   r   excprcouterrs
             r&   r   r     s    T,V,a <<aT1779tSBJJ}JJ#c)D/*%t45


Yse=12


Yse=127N  

=!

cU#io.eD6:;s   C 
D>DDc                    U  HT  nU HK  n[        U[        5      (       d  M  [        R                  " X#5      nU(       d  M9  UR	                  5       s  s  $    MV     g)z
Takes each regular expression in @regexiter and tries to search for it in
every item in @initer. If there is a match, returns that match.
Else returns False.
N)r   r*   r  r  r   )	regexiteriniterr  iir
  s        r&   rx   rx     sL     Bb#&&IIe(Eu{{}$   r%   c           
     `   / SQnSS/nSU;  a#  [        X 5      nU(       a  [        SU< S35      eO[        US   5      S:  a&  [        USS  U 5      nU(       a  [        SU< S35      eU  H  n[        U[        5      (       d  M  [
        R                  " US	   U5      nU(       d  M=  UR                  5       U;  d  MS  S
n[        UR                  UR                  5       [        US   5      5      5      e   SU;  a#  [        X05      nU(       a  [        SU< S35      eg U  H  n[        U[        5      (       d  M  [
        R                  " US	   U5      nU(       d  M=  UR                  5       U;  d  MS  Sn[        UR                  UR                  5       [        US   5      5      5      e   g )N)z@INPUT([0-9]+)?@@PLAINNAME@
@BASENAME@z@OUTPUT([0-9]+)?@@OUTDIR@@INPUT@zCommand cannot have z%, since no input files were specifiedr   z' when there is more than one input filer   z9Command cannot have {!r} since there are only {!r} inputs@OUTPUT@z since there are no outputsz:Command cannot have {!r} since there are only {!r} outputs)	rx   r   r  r   r*   r  r  r   r   )commandrM  inregexoutregexr
  r  match2r   s           r&   _substitute_values_check_errorsr    s   LG0*=H!'3 #7y@e!fgg  vi !A%%gabk7;E$';E9 E@ &@ A A DdC((YYwqz40Fv&,,.6O$QXXfllnc&BS>T%UVV  !(4 #7y@[!\]]  DdC((YYx{D1Fv&,,.6P$QXXfllnc&BT>U%VWW r%   c                h  ^ SU4S jjn[        U T5        / nT Vs/ s H   oDS;  d  M
  [        R                  " U5      PM"     nnU(       a%  [        R                  " SR	                  U5      5      OSnU  GH3  nSn[        U[        5      (       d  UR                  U5        OSU;   aO  TS   n	US:X  a  X9-  nO[        U	5      S:X  a%  UR                  UR                  SU	S   5      5        O[        S5      eS	U;   aO  TS	   n
US	:X  a  X:-  nO[        U
5      S:X  a%  UR                  UR                  S	U
S   5      5        OP[        S
5      eUT;   a$  TU   n[        U[        5      (       d   S5       eUnOU(       a  UR                  X'5      nOUnUc  GM"  UR                  U5        GM6     U$ s  snf )a  
Substitute the template strings in the @values dict into the list of
strings @command and return a new list. For a full list of the templates,
see get_filenames_templates_dict()

If multiple inputs/outputs are given in the @values dictionary, we
substitute @INPUT@ and @OUTPUT@ only if they are the entire string, not
just a part of it, and in that case we substitute *all* of them.

The typing of this function is difficult, as only @OUTPUT@ and @INPUT@ can
be lists, everything else is a string. However, TypeDict cannot represent
this, as you can have optional keys, but not extra keys. We end up just
having to us asserts to convince type checkers that this is okay.

https://github.com/python/mypy/issues/4617
c                h   > TU R                  S5         n[        U[        5      (       d   S5       eU$ )Nr   for mypy)r   r   r*   )r   r  rM  s     r&   r  "substitute_values.<locals>.replaceQ  s2    1771:!S!!-:-!r%   )r  r  |Nr  r   r   zFCommand has '@INPUT@' as part of a string and more than one input filer  zHCommand has '@OUTPUT@' as part of a string and more than one output filer  )r   r  r   r*   )r  r  escaper  r5  r   r*   r{  r  r  r   r  )r  rM  r  outcmdri  rx_keysvalue_rxvvmoreinputsoutputsr   s    `          r&   r   r   ?  s   $ $GV4 68F)/V#>U3U~ryy~GV07rzz#((7+,TH $"c""MM""_I&FY V!bjjF1I>?$ &K L L2Z(GZ!W"bjjWQZ@A$ &L M M
 6\r
Aa%%1z1%D<<,DDMM$I L MQ Ws
   	F/F/c                b   0 nU (       a  XS'   [        U 5       H]  u  p4XBSU S3'   [        R                  R                  U5      nXRSU S3'   [        R                  R	                  U5      S   USU S3'   M_     [        U 5      S:X  aL  [        R                  R                  U S   5      =US'   n[        R                  R	                  U5      S   US	'   U(       aS  XS
'   [        U5       H  u  p4XBSU S3'   M     [        R                  R                  US   5      US'   US   S:X  a  SUS'   U$ )aZ  
Create a dictionary with template strings as keys and values as values for
the following templates:

@INPUT@  - the full path to one or more input files, from @inputs
@OUTPUT@ - the full path to one or more output files, from @outputs
@OUTDIR@ - the full path to the directory containing the output files

If there is only one input file, the following keys are also created:

@PLAINNAME@ - the filename of the input file
@BASENAME@ - the filename of the input file with the extension removed

If there is more than one input file, the following keys are also created:

@INPUT0@, @INPUT1@, ... one for each input file
@PLAINNAME0@, @PLAINNAME1@, ... one for each input file
@BASENAME0@, @BASENAME1@, ... one for each input file

If there is more than one output file, the following keys are also created:

@OUTPUT0@, @OUTPUT1@, ... one for each output file
r  z@INPUTr  z
@PLAINNAMEr   z	@BASENAMEr   r  r  r  z@OUTPUTr  r   r7  )	enumerater   r   basenamerS  r  dirname)r  r  rM  r  r  plains         r&   r_   r_     s4   0 68F"y!&)HR%'VB4q>"GG$$R(E).Zt1%&(*(8(8(?(BFYrd!$% * v;!,.GG,<,<VAY,GGF=!E#%77#3#3E#:1#=F< $z!'*HR&(WRD?# +  WW__WQZ8z*#!$F:Mr%   c                   [         R                  " U 5       GH)  u  pn[         R                  " U[         R                  " U5      R                  [        R
                  -  [        R                  -  5        U H  n[         R                  R                  X5      n[         R                  R                  U5      (       a  MH  [         R                  R                  U5      (       d  Mn  [         R                  " U[         R                  " U5      R                  [        R
                  -  [        R                  -  5        M     GM,     g r   )r   walkchmodr  st_modeS_IWRITES_IREADr   r5  r  r4  )topdirdr   filesr'  fpaths         r&   _make_tree_writabler    s     wwve
BGGAJ&&6EFEGGLL*E77>>%((RWW^^E-B-B 6 6 F UV  'r%   c                Z   / SQnSnU H/  n U(       d  [        U 5        Sn [        R
                  " U 5          g    [        R
                  " U 5        g ! [         a    [        R                  " U5         Mm  f = f! [         a       g [         a    [        R                  " U5         M  f = f)N皙?r  皙?r  r        ?r  r   r   r   r   r   FT)r  PermissionErrortimesleepr  rmtreerU  r  )r1  delayswritabler  s       r&   r   r     s    
 @FH	#A&	MM! " MM!  	JJqM	 ! 	 	JJqM	s(   AA: A76A7:
B*B*)B*c                   [         R                  R                  U 5      (       aW  [         R                  " U [         R                  " U 5      R
                  [        R                  -  [        R                  -  5        / SQnU H  n [         R                  " U 5          g   [         R                  " U 5        g! [         a       g[         a    [        R                  " U5         Md  f = f)z1Like windows_proof_rmtree, but for a single file.r  N)r   r   r4  r  r  r  r  r  rV  rU  r  r  r  )r  r  r  s      r&   r   r     s    	ww~~e
..>MN?F	IIe  IIe	 ! 	 	JJqM	s   B77
C'C'&C'c                  @   ^  \ rS rSrSrSU 4S jjrSU 4S jjrSrU =r$ )rD   i  zL
Like TemporaryDirectory, but cleans things up using
windows_proof_rmtree()
c                r   >  [         TU ]  XU5        g ! [         a    [        U R                  5         g f = fr   )r   __exit__r  r   r  )r   excr  tbr   s       r&   r  #TemporaryDirectoryWinProof.__exit__  s2    	,GS, 	, +	,s    66c                n   >  [         TU ]  5         g ! [         a    [        U R                  5         g f = fr   )r   cleanupr  r   r  )r   r   s    r&   r  "TemporaryDirectoryWinProof.cleanup  s-    	,GO 	, +	,s    44r   )r  T.Anyr  r  r  r  r   r  r   r  )	r   r    r!   r"   r   r  r  r$   r   r   s   @r&   rD   rD     s    
,, ,r%   rD   c                   Uc  0 n[         R                  R                  X5      n[         R                  R                  U5      (       d  U$ [	        [         R                  R                  US5      5       H  n[         R                  R                  U5      nUS:X  a  M*  Sn[         R                  R                  U5      (       a  [        XU5        O_UR                  S5      (       aG  [         R                  R                  U5      (       a#  [         R                  R                  U5      S   nOSnU(       d  M  XR;   a  X%   R                  U5        M  U/X%'   M     U$ )N*packagecacheTz.wrapr   F)r   r   r5  existsr   r  r  rT   r   r4  rS  r{  )
spdir_namecurrent_dirr  spdirr  r  append_thiss          r&   rT   rT     s   ~GGLL1E77>>%  bggll5#./77##E*N"77==z&9^^G$$)>)>ww''1!4HK;! ''.$)7  0  Mr%   c                $    U H
  nX;   d  M
    g   g)NTFr   )substrstrlistr   s      r&   r   r     s    ;  r%   c                      \ rS rSrSrSSS jjrSS jrSS jrSS jrSS jr	SS	 jr
SS
 jrSS jrSSS jjrSSS jjrSS jrSS jrSS jrSrg)r=   i$  zMA set that preserves the order in which items are added, by first
insertion.
Nc                j    [         R                  " 5       U l        U(       a  U R                  U5        g g r   )r-  OrderedDict_OrderedSet__containerr   )r   r  s     r&   r   OrderedSet.__init__(  s'    4?4K4K4MKK! r%   c                    XR                   ;   $ r   r  r   r  s     r&   __contains__OrderedSet.__contains__-  s    ((((r%   c                H    [        U R                  R                  5       5      $ r   )iterr  r  r   s    r&   __iter__OrderedSet.__iter__0  s    D$$))+,,r%   c                ,    [        U R                  5      $ r   )r  r  r   s    r&   __len__OrderedSet.__len__3  s    4##$$r%   c                    U R                   (       a?  SR                  SR                  S U R                   R                  5        5       5      5      $ g)NzOrderedSet([{}])z, c              3  8   #    U  H  n[        U5      v   M     g 7fr   )repr)ry  r   s     r&   r{  &OrderedSet.__repr__.<locals>.<genexpr>:  s     C+Ba$q''+Bs   zOrderedSet())r  r   r5  r  r   s    r&   r   OrderedSet.__repr__6  sD    %,,		C4+;+;+@+@+BCCE Er%   c                H    [        U R                  R                  5       5      $ r   )reversedr  r  r   s    r&   __reversed__OrderedSet.__reversed__=  s    ((--/00r%   c                "    S U R                   U'   g r   r  r  s     r&   r  OrderedSet.add@  s    "&r%   c                >    XR                   ;   a  U R                   U	 g g r   r  r  s     r&   discardOrderedSet.discardC  s!    $$$  ' %r%   c                :    U R                   R                  X5        g r   )r  move_to_end)r   r  lasts      r&   r  OrderedSet.move_to_endG  s    $$U1r%   c                @    U R                   R                  U5      u  p#U$ r   )r  popitem)r   r  r^  r   s       r&   rg  OrderedSet.popJ  s    ""**40r%   c                4    U H  nS U R                   U'   M     g r   r  r   r  r^  s      r&   r   OrderedSet.updateN  s    D%)DT" r%   c                :   ^ [        U 5      " U4S jU  5       5      $ )Nc              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7fr   r   )ry  r   set_s     r&   r{  (OrderedSet.difference.<locals>.<genexpr>S  s     ;Td]!!Ts   		)rm  )r   r  s    `r&   
differenceOrderedSet.differenceR  s    Dz;T;;;r%   c                8    U H  nU R                  U5        M     g r   )r  r  s      r&   difference_updateOrderedSet.difference_updateU  s    DLL r%   )__containerr   )r  zT.Optional[T.Iterable[_T]])r  rq  r   rm  )r   zT.Iterator[_T]rr  r  )r  r/   r   r  T)r  r/   r  rm  r   r  )r  rm  r   r/   )r  T.Iterable[_T]r   r  )r  r  r   z'OrderedSet[_T]')r   r    r!   r"   r   r   r  r  r  r   r  r  r  r  rg  r   r  r  r$   r   r%   r&   r=   r=   $  sH    "
)-%1'(2*<r%   r=   c                     [         R                  R                  X5      $ ! [        [        4 a    [        U 5      s $ f = fr   )r   r   r   	TypeErrorr  r*   )r   r  s     r&   r   r   Y  s8    wwt++z" 4ys   ! ??c                     U(       a.  U R                  5       R                  UR                  5       5        gU R                  U5         g! [         a     gf = fr  resolverelative_tor  r   rootr  s      r&   r~   r~   b  sR    LLN&&t||~6
  T"   s   4A
 A
 

AAc                     U(       a-  U R                  5       R                  UR                  5       5      $ U R                  U5      $ ! [         a    U s $ f = fr   r  r  s      r&   r   r   m  sL    <<>--dlln==##D)) s   3A A AAc                  (    \ rS rSrSrSrSrSrSrSr	g)	r8   iv  zEnumeration for library types.r   r   r   r   r   N)
r   r    r!   r"   r   SHAREDSTATICPREFER_SHAREDPREFER_STATICr$   r   r%   r&   r8   r8   v  s    (FFMMr%   r8   c                  h    \ rS rSrSr   S     SS jjrSS jrSS jrSS jrSS jr	SS	 jr
S
rg)ProgressBarFallbacki  a  
    Fallback progress bar implementation when tqdm is not foundclass OptionType(enum.IntEnum):

    """Enum used to specify what kind of argument a thing is."""

    BUILTIN = 0
    BACKEND = 1
    BASE = 2
    COMPILER = 3
    PROJECT = 4

# This is copied from coredata. There is no way to share this, because this
# is used in the OptionKey constructor, and the coredata lists are
# OptionKeys...
_BUILTIN_NAMES = {
    'prefix',
    'bindir',
    'datadir',
    'includedir',
    'infodir',
    'libdir',
    'licensedir',
    'libexecdir',
    'localedir',
    'localstatedir',
    'mandir',
    'sbindir',
    'sharedstatedir',
    'sysconfdir',
    'auto_features',
    'backend',
    'buildtype',
    'debug',
    'default_library',
    'errorlogs',
    'genvslite',
    'install_umask',
    'layout',
    'optimization',
    'prefer_static',
    'stdsplit',
    'strip',
    'unity',
    'unity_size',
    'warning_level',
    'werror',
    'wrap_mode',
    'force_fallback_for',
    'pkg_config_path',
    'cmake_prefix_path',
    'vsenv',
}


    Since this class is not an actual iterator, but only provides a minimal
    fallback, it is safe to ignore the 'Iterator does not return self from
    __iter__ method' warning.
    Nc                D   Ub  [        U5      U l        g X l        SU l        SU l        Uc  [
        R                  " 5       (       + OUU l        U R                  (       dC  U R                  (       a  US:X  a  [        SU R                  5        U(       a  [        U S3SS9  g g g )Nr   downloadzDownload size:r  r   r  )	r  r  totaldoneprinted_dotsr   colorize_consoledisabler  )r   r  r)  bar_typer  r-  s         r&   r   ProgressBarFallback.__init__  s      NDM
	6=o400227||zzh*4&

3bkr*  r%   c                    U R                   $ r   )r  r   s    r&   r  ProgressBarFallback.__iter__  s    }}r%   c                ,    [        U R                  5      $ r   )nextr  r   s    r&   __next__ProgressBarFallback.__next__  s    DMM""r%   c                    U R                   (       d(  [        SSS9  [        R                  R	                  5         U =R
                  S-  sl        g )Nr7  r   r(  r   )r-  r  r  r   flushr+  r   s    r&   	print_dotProgressBarFallback.print_dot  s4    ||#2JJQr%   c                "   U =R                   U-  sl         U R                  (       d  U R                  5         g [        U R                   U R                  -  S-  5      nU R                  U:  a#  U R                  5         U R                  U:  a  M"  g g )Nr:  )r*  r)  r8  r  r+  )r   progressratios      r&   r   ProgressBarFallback.update  sh    		X	zzNNDII

*R/0%'NN %'r%   c                <    U R                   (       d  [        5         g g r   )r-  r  r   s    r&   closeProgressBarFallback.close  s    ||G r%   )r-  r*  r  r+  r)  )NNNNN)
r  zT.Optional[T.Iterable[str]]r)  zT.Optional[int]r.  r   r  r   r-  zT.Optional[bool])r   zT.Iterator[str]r  r  )r;  r  r   r  )r   r    r!   r"   r   r   r  r4  r8  r   r?  r$   r   r%   r&   r%  r%    sK    9t _cKO-1+*+9H+*+$#r%   r%  )tqdmc                  4   ^  \ rS rSrSS.SU 4S jjjrSrU =r$ )ProgressBarTqdmi  N)r.  c                  > US:X  a  UR                  SSSSSS.5        OUR                  SSS	.5        [        TU ]  " U0 UD6  g )
Nr'  BT   z<{l_bar}{bar}| {n_fmt}/{total_fmt} {rate_fmt} eta {remaining})unit
unit_scaleunit_divisorleave
bar_formatFz1{l_bar}{bar}| {n_fmt}/{total_fmt} eta {remaining})rJ  rK  )r   r   r   )r   r.  r  r   r   s       r&   r   ProgressBarTqdm.__init__  sV    :%s-1/3(,-k	! " -`! " Gd-f-r%   r   )r  r  r.  r   r   r  r   r  r   r   s   @r&   rC  rC    s    EI 	. 	. 	.r%   rC  z=T.Union[T.Type[ProgressBarFallback], T.Type[ProgressBarTqdm]]rB   c                  J   ^  \ rS rSrSSU 4S jjjr S     SS jjrSrU =r$ )	rC   i 	  c                   > [         R                  R                  [         R                  R                  U5      5      n[        TU ]  " X4S US.UD6  g )N)nargsr  )r   r   abspathrealpathr   r   )r   option_stringsdestr  r   r   s        r&   r   RealPathAction.__init__	  s=    ''//"''"2"27";<UT7UfUr%   c           	         [        U[        5      (       d   e[        X R                  [        R
                  R                  [        R
                  R                  U5      5      5        g r   )r   r*   r  rS  r   r   rP  rQ  )r   parser	namespacerM  option_strings        r&   __call__RealPathAction.__call__	  s?    &#&&&&	99bggoobgg6F6Fv6N&OPr%   r   )r7  )rR  ro  rS  r*   r  r*   r   r  r   )
rV  zargparse.ArgumentParserrW  zargparse.NamespacerM  z%T.Union[str, T.Sequence[T.Any], None]rX  r   r   r  )r   r    r!   r"   r   rY  r$   r   r   s   @r&   rC   rC    	  s=    V V
 bfQ>QO^QjnQ Qr%   rC   c                   [        [        U5      5      nSR                  U5      n[        U5      S::  a  U$ SSKJn  U" SU SS9n[        UR                  5       S5      (       a  U$ / nU(       aB  / nU H8  n [        U5      R                  U5      n	UR                  [        U	5      5        M:     UnU(       a  [        S	S
SSS9 n
U
R                  S5        SSS5         [        R                   " U SSW
R"                  /-   U-   S[        R$                  S9nUR'                  S5      nU(       a  UR)                  S5      nO[*        R,                  " S5         [0        R2                  " W
R"                  5        SR                  Xa-   5      n[        U5      S:  a  [*        R,                  " S5        U$ ! [         a    UR                  U5         GM]  f = f! , (       d  f       GN= f! [        R.                   a,  n[*        R,                  " S[        U5       35         SnANSnAff = f! [0        R2                  " W
R"                  5        f = f)a  
WINEPATH size is limited to 1024 bytes which can easily be exceeded when
adding the path to every dll inside build directory. See
https://bugs.winehq.org/show_bug.cgi?id=45810.

To shorten it as much as possible we use path relative to `workdir`
where possible and convert absolute paths to Windows shortpath (e.g.
"/usr/x86_64-w64-mingw32/lib" to "Z:\usr\X86_~FWL\lib").

This limitation reportedly has been fixed with wine >= 6.4
;rF  r   )ExternalProgramwineT)silentz>=6.4r   z.batrI  F)rU  r)  deletezt
            @ECHO OFF
            for %%x in (%*) do (
                echo|set /p=;%~sx
            )
            Nr   z/C)r)  r   z(Could not shorten WINEPATH: empty stdoutzCould not shorten WINEPATH: z9WINEPATH exceeds 1024 characters which could cause issues)r]  r=   r5  r  r   r]  r   get_versionr   r  r{  r*   r  r
   r=  r  check_outputr  r  r   r>  r   r   CalledProcessErrorr   rV  )winecmd
wine_pathsworkdir	wine_pathr]  r^  	rel_paths	abs_pathsr   relbat_filer   r   s                r&   rb   rb   	  s    j,-J $I
9~ +6748Dt'')733  I!#	A$1g))'2  S*  
FWUSW_NN   T	%,,WtX]]7S-SV`-`6=jFXFXZF\\#&F#\\#.
GH IIhmm$/0I
9~PQ9  $  ##$ TS ,, 	BLL7Ax@AA	B IIhmm$s[   74F1GA G& ?H)  G& H) 1GG
G#&H&:"H!H) !H&&H) )"Ic                <   ^ ^ / m[        T 5      SU U4S jj5       nU$ )Nc                 R   > T(       a  TS   $ T" U 0 UD6nTR                  U5        U$ )Nr   )r{  )r  r   r  funcr   s      r&   wrapperrun_once.<locals>.wrapperQ	  s.    q6MD#F#

3
r%   )r  r  r   r  r   r/   r   )rn  ro  r   s   ` @r&   r   r   N	  s%    C
4[  Nr%   c                4   ^  [        T 5      SU 4S jj5       nU$ )Nc                 &   > [        T" U 0 UD65      $ r   )r]  )r  r   rn  s     r&   ro  generate_list.<locals>.wrapper^	  s    D$)&)**r%   )r  r  r   r  r   rl  rq  )rn  ro  s   ` r&   r]   r]   ]	  s     
4[+ + Nr%   c                   U SU < S3nU(       a  SOSn [        U S5       n[        R                  " U5      nS S S 5        [        WU5      (       d  [        XE-   5      e[        US5      (       a"  [        R                  " SU5      R                  nO5[        R                  " S	U5      R                  R                  R                  nS
SKJn	  S
SKJn
Jn  U
" X5      (       a	  U" XU5      eU$ ! , (       d  f       N= f! [        R                  [        4 a    [        XE-   5      e[        [        [        4 a    [        U SU < S3U-   5      ef = f)Nz file z is corrupted.zG Consider reconfiguring the directory with "meson setup --reconfigure".r   rS  zz references functions or classes that don't exist. This probably means that it was generated with an old version of meson.r+   r(   r   r   )r+   )major_versions_differMesonVersionMismatchException)r,  pickleloadUnpicklingErrorEOFErrorr   r  ModuleNotFoundErrorr	  r   hasattrr  r  r+   r   coredatarv  rw  )filenameobject_nameobject_typesuggest_reconfigureload_fail_msg	extra_msgr1  objr+   coredata_versionrv  rw  s               r&   r   r   e	  s5   "m6(^DM]pYvxI	-(D!Q++a.C " c;'']677 sI&&-s3;;&&-s3??HHPP6OW77+GyQQJ5 "!""H- 8]677*N; -m6( .   "+,- 	--s(   C> C-C> -
C;7C> ;C> >AEc                8    U  H  nU" U5      (       d  M  Us  $    g)a$  Find the first entry in an iterable where the given predicate is true

:param iter: The iterable to search
:param predicate: A finding function that takes an element from the iterable
    and returns True if found, otherwise False
:return: The first found element, or None if it is not found
Nr   )r  	predicater_  s      r&   r\   r\   	  s!     Q<<H  r%   c                     [        5       (       a  Sn OSn U S-  n [        [        R                  R	                  SU 5      5      $ )zReturn a conservative estimate of the commandline size in bytes
above which a response file should be used.  May be overridden for
debugging by setting environment variable MESON_RSP_THRESHOLD.i    i   r   MESON_RSP_THRESHOLD)rv   r  r   r   r  )limits    r&   r`   r`   	  s?    
 ||   QJErzz~~3U;<<r%   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)rz   i	  a  Descriptor that replaces the function it wraps with the value generated.

This property will only be calculated the first time it's queried, and will
be cached and the cached value used for subsequent calls.

This works by shadowing itself with the calculated value, in the instance.
Due to Python's MRO that means that the calculated value will be found
before this property, speeding up subsequent lookups.
c                    S U l         Xl        g r   )_lazy_property__name_lazy_property__func)r   rn  s     r&   r   lazy_property.__init__	  s    '+r%   c                N    U R                   c  X l         g X R                   :X  d   eg r   )r  )r   r   r  s      r&   __set_name__lazy_property.__set_name__	  s!    ;;K;;&&&r%   c                T    U R                  U5      n[        XR                  U5        U$ r   )r  r  r  )r   instancer  r  s       r&   __get__lazy_property.__get__	  s#    H%++u-r%   )__func__nameN)rn  zT.Callable[[T.Any], _T]r   r  )r   r  r  r*   r   r  )r  rq  r  zT.Typer   r/   )	r   r    r!   r"   r   r   r  r  r$   r   r%   r&   rz   rz   	  s    'r%   rz   )F)
r   ro  r   r   r   rm  r   r  r   z(T.Tuple[subprocess.Popen[str], str, str])r   ro  r   r   r   rm  r   zT.Tuple[bool, str])r   ro  r   r   r   rm  r   rm  )r   r*   r   r  )r   r   )r   zT.Union[str, bytes]r   rm  )r   z4T.Union[T.Iterable[T.Union[str, bytes]], str, bytes]r   r  )rw  T.Iterable['Compiler']rx  z'FileOrString'r   z
'Compiler')rw  r  r|  zT.Sequence['FileOrString']r   z*T.Dict['Compiler', T.List['FileOrString']])r   rm  )r  r*   r   z'ImmutableListProtocol[str]'r  )r1  T.Union[str, Path]r   zT.Optional[VcsData])rt  r*   r   z.T.Tuple[T.Callable[[T.Any, T.Any], bool], str])rx  r*   rt  r*   r   rm  )rx  r*   rz  zT.Union[str, T.Iterable[str]]r   z'T.Tuple[bool, T.List[str], T.List[str]])r  r*   r  r*   r   rm  )r  r*   r   r*   r   )r  T.Optional[T.List[str]]r   r  )r  r*   r  r*   r   rm  )z/\)r  r*   r  r*   r   rm  )r  r*   r   r*   )r   r*   r   ro  )r  T.Iterable[str]r   r*   )
r  T.Pattern[str]r  r*   r  #Literal['meson', 'cmake', 'cmake@']r  HT.Union[T.Dict[str, T.Tuple[str, T.Optional[str]]], 'ConfigurationData']r   T.Tuple[str, T.Set[str]])r  r  r  r*   r  r  r   r  )r  r*   r  rm  r  r  r   r  )
r  r  r  r*   r  r  r  T.Optional[SubProject]r   r*   )
r  r*   r  r  r  rm  r  r  r   r*   )r  )r  r  r   r  )rx  r*   r  ro  r  r  r  r  r  r  r   &T.Tuple[T.List[str], T.Set[str], bool])
rx  r*   r  ro  r  r  r  r  r   r  )rx  r*   r  ro  r  r  r  rm  r  r  r   r  )rI  N)rx  r*   r0  r*   r  r  r  r  r)  r*   r  r  r   zT.Tuple[T.Set[str], bool])
r?  zT.TextIOr@  r   rA  zLiteral['c', 'nasm']rB  r   r   r  )
rP  r*   r@  r   rA  zLiteral['c', 'nasm', 'json']rB  r   r   r  )r0  r*   r2  r*   r   r  r  )r^  r  r\  rm  r   zT.List[T.Any])r  rq  rd  rm  r   ro  )rh  zT.Dict[_T, _U]ri  r/   rg  rm  r   z
T.List[_U])r^  z'T.Union[_T, T.Sequence[_T]]'rn  z*'T.Union[T.Type[_T], T.Tuple[T.Type[_T]]]'r   rl  )r^  z!T.Union[T.Any, T.Sequence[T.Any]]r   ro  )r  r  r   r  )rz  zT.Callable[[_T], object]r  r  r   z'T.Tuple[T.Iterator[_T], T.Iterator[_T]])r  ro  r=  r   r  (T.Union[None, T.TextIO, T.BinaryIO, int]r   r  r   r  r   r  r   *T.Tuple['subprocess.Popen[str]', str, str])Called)r  ro  r   r*   r   r  r   r  )r  r  r  z*T.Iterable[str | programs.ExternalProgram]r   r   )r  &T.List[str | programs.ExternalProgram]rM  &T.Dict[str, T.Union[str, T.List[str]]]r   r  )r  r  rM  r  r   r  )r  ro  r  ro  r   r  )r  r  r   r  )r1  r  r   r  )r  r  r   r  )r   N)r  r*   r  r*   r  z$T.Optional[T.Dict[str, T.List[str]]]r   zT.Dict[str, T.List[str]])r  r*   r  ro  r   rm  )r   r  r  r  r   r*   )r   r   r  r   r  rm  r   rm  )r   r   r  r   r  rm  r   r   )rd  ro  re  ro  rf  r   r   r*   )rn  T.Callable[..., _T]r   r  )rn  z,T.Callable[..., T.Generator[_T, None, None]]r   zT.Callable[..., T.List[_T]])
r  r*   r  r*   r  zT.Type[_PL]r  rm  r   r,   )r  r  r  zT.Callable[[_T], bool]r   r  rr  )r   
__future__r   pathlibr   argparserb  enumr  r  r  r   r  r  r  rK  r   r  r  r  r-  	functoolsr   r   	itertoolsr   tempfiler	   r
   typingr  r   rx  r  rK  dataclasses
mesonbuildr   corer   r   TYPE_CHECKINGtyping_extensionsr   r   _typingr   r~  r   r~  r   r   r   compilers.compilersr   interpreterbase.baseobjectsr   r   r   r   r(   TypeVarUnionr,   r*   r;   r/   r0   __all__r3   r4   r#   r   getattr
executabler2   r   r:   r7   r  r1   rc   r   r   r   r   rg   rF   ABCMetar5   r6   r$  r.   r^   rG   r  r  IntEnumr9   	dataclassGenericr>   r@   Optionalr?   rA   ru   rr   ro   rf   rl   rq   rv   rw   rh   ri   rj   rp   rk   rn   rm   rt   re   rI   r   r  rU   rH   r  rA  rE   rv  r   r   r   r   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rV   rs   rd   r  r  r  r   r   ry   rY   r  r  r  r  ra   rX   r  r  rW   r;  r<  rG  r<   r   r{   r|   r[   r   r   rZ   r}   r  r  r   r  r   rx   r  r   r_   r  r   r   rD   rT   r   
MutableSetr=   r   r~   r   r8   r%  rA  rC  rB   ImportErrorActionrC   rb   r   r]   r   r\   r`   rz   r   r%   r&   <module>r     s  
 0 "   
  
   
  < < < <  &  ;        0??3/))).8!X !X  ))E);=O)O!P
QCwwvs{#YYt_YYt_iX	 	 GI C H 
3%  
 nnk2Nnn%N;?8 ?P> P7> 7
 ll5	9"&8#++ 8X XtS P5> P5fK &!b> ,DLL ,& %u-2  .: %u-+jn + .+> %u-#Jqzz"~6 # .#> %u-9!6qzz"~!FXYXbXbceXfHg 9 .9&010202!D$14120... 4 :#J   .0d; **12<7 <7~81

+$GL)X&2W( << K

a}B#78??,!F  28$G8e8 kC8D#kD qID>U/#kU/ qIU/p :>Y 6YBEY8 :>) 6)BE)V. 6:8!D828>d8 <@7"87Dj78 <@7"87Dj7B PT/"E//6L/Xq/( 
  +  "6    /   48  F3$@3!03593  *3BGQ #&	F <@AKASASBL//BL//>? @ 	 $N	@ CGHRHZHZISISEF G !&	 +U	0* %XPDN1hW6 ,!3 ,& <>FJCOg43b! 3j	dll e eN"
.$ .  "KQX__ Q 37@ /@;>@FB=*AIIbM A  eQdKNdes   -Y Y*)Y*