
    dafD                        d dl  d dlZd dlZd dlZd dlZd dlZd dlZ ej                  ed       dej                  v Z
e
ZdZdZdZd	Zd Zd
Zd	ZdZdZdZeez  ez  ez  ez  ez  Z G d d      Z G d d      ZeefdZd Zd Zd Zd Zd Zd Z G d d      Z  e!       Z" G d d      Z# G d d      Z$ G d d       Z% G d! d"      Z& G d# d$e&      Z' G d% d&      Z(y)'    )*N)      )removeAMD64         i   i   i   i   i    c                   $    e Zd Zd Zd Zd Zd Zy)Tablec                      || _         g | _        y N)namefieldsselfr   s     */root/Python-3.12.4/Lib/msilib/__init__.py__init__zTable.__init__#   s    	    c                 @    | j                   j                  |||f       y r   )r   append)r   indexr   types       r   	add_fieldzTable.add_field'   s    E$t,-r   c                    g }g }| j                   j                          d gt        | j                         z  }| j                   D ]  \  }}}|dz  }|t         z  }|rt	        d| j
                  ||fz         |t        z  }|t        z  }|t        k(  r|rd|z  }	nYd}	nV|t        k(  r
|dk(  sJ d}	nC|t        k(  r
|dk(  sJ d}	n0|t        k(  r
|d	k(  sJ d
}	nd}	t	        d| j
                  ||fz         |t        z  rd}
nd}
|t        z  r|
dz  }
d|d|	|
||<   |t        z  s|j                  d|z          dj!                  |      }dj!                  |      }d| j
                  d|d|dS )N   z%s.%s unknown bits %xzCHAR(%d)CHAR   SHORT   LONGr   OBJECTunknownz%s.%sunknown integer type %d z	 NOT NULLz LOCALIZABLE`z` z`%s`z, zCREATE TABLE z (z PRIMARY KEY ))r   sortlen	knownbitsprintr   datasizemasktypemasktype_string
type_short	type_longtype_binarytype_nullabletype_localizabletype_keyr   join)r   r   keysr   r   r   unksizedtypetnameflagss              r   sqlz	Table.sql*   s   DKK((!%  	+E4QJE)#C-D#0FFG,&D8OE#$t+E E*$Qww)#Qww+%Qww4		47NNOm##&&'+/>F5MhFTM*A 	+B 6"yy8<		64PPr   c                     |j                  | j                               }|j                  d        |j                          y r   )OpenViewr;   ExecuteClose)r   dbvs      r   createzTable.createT   s*    KK
#			$		r   N)__name__
__module____qualname__r   r   r;   rB    r   r   r   r   "   s    .(QTr   r   c                       e Zd Zy)_UnspecifiedN)rC   rD   rE   rF   r   r   rH   rH   Y   s    r   rH   c                     t        t        |             D ]7  }| |   d   |k(  s|t        u r| |   d   }|t        u r| |   d   }|||f| |<    y t        d      )z:Change the sequence number of an action in a sequence listr   r   r   NzAction not found in sequence)ranger(   rH   
ValueError)seqactionseqnocondis        r   change_sequencerQ   Z   st    3s8_ q6!9|#1vay$Aq	dE*CF 3
44r   c                    | j                  d|z        }|j                  t              j                         }t	        |      }|D ]  }t        |      |k(  sJ |       t        |      D ]  }||   }t        |t              r|j                  |dz   |       .t        |t              r|j                  |dz   |       T|Wt        |t              r |j                  |dz   |j                         t        d|j                   j"                  z         	 |j%                  t&        |       |j/                           |j1                          y # t(        $ r t+        dt-        |      z   dz   |z         w xY w)NzSELECT * FROM `%s`r   zUnsupported type %szCould not insert z into )r=   GetColumnInfoMSICOLINFO_NAMESGetFieldCountCreateRecordr(   rJ   
isinstanceint
SetIntegerstr	SetStringBinary	SetStreamr   	TypeError	__class__rC   ModifyMSIMODIFY_INSERT	ExceptionMSIErrorrepr	ClearDatar?   )	r@   tablevaluesrA   countrvaluerP   fields	            r   add_datarl   f   sT   
(501AOO,-;;=EUA 5zU")E)"u 	RA!HE%%QqS'E3'AaC&E6*AaC, 58P8P PQQ	R	LHH%q) 	
'( GGI	  	L.tF|;HDUJKK	Ls   E'E3c                     | j                  d|z        }t        d      }|j                  d|       |j                  |       |j	                          y )Nz2INSERT INTO _Streams (Name, Data) VALUES ('%s', ?)r   )r=   rV   r]   r>   r?   )r@   r   pathrA   ri   s        r   
add_streamro      sA    
H4OPAQAKK4IIaLGGIr   c           	      D   	 t        j                  |        |j                         }t	        | t
              }|j                  D ]  }|j                  |        t        |d|j                         |j                  d      }|j                  t        d       |j                  t        |       |j                  t        |       t        r|j                  t         d       n|j                  t         d       |j                  t"        t%                      |j                  t&        d       |j                  t(        d       |j                  t*        d       |j-                          t        |d	d
|fd|fd|fd|fdg       |j/                          |S # t        $ r Y w xY w)N_Validation   zInstallation Databasezx64;1033z
Intel;1033r      zPython MSI LibraryPropertyProductNameProductCodeProductVersionManufacturer)ProductLanguage1033)osunlinkOSErrorupperOpenDatabaseMSIDBOPEN_CREATEtablesrB   rl   _Validation_recordsGetSummaryInformationSetProperty	PID_TITLEPID_SUBJECT
PID_AUTHORr   PID_TEMPLATEPID_REVNUMBERgen_uuidPID_WORDCOUNTPID_PAGECOUNTPID_APPNAMEPersistCommit)	r   schemaru   rv   rw   rx   r@   tsis	            r   init_databaser      sX   
		$ ##%K	d,	-B]] 	 R : :;		!	!"	%BNN956NN;,NN:|,
|Z0
|\2NN=(*-NN=!$NN=#&NN; 45JJLR	$	$	>*	&#% & IIKIA  s   F 	FFc           	      T    |j                   D ]  }t        | |t        ||              y r   )r   rl   getattr)r@   modulerf   s      r   
add_tablesr      s(     4UGFE234r   c                    t         j                  t         j                  z   dz   }dj                  | D cg c]
  }||v r|nd c}      } | d   t         j                  dz   v rd| z   } t	        j
                  d|       s
J d| z          | S c c}w )Nz._r$   _r   .z^[A-Za-z_][A-Za-z0-9_.]*$FILE)stringascii_lettersdigitsr4   rematch)rZ   identifier_charscs      r   make_idr      s    ++fmm;dB
''D1--136D
EC
1v&--#%&Ci88/5AvczA5J	 Es   B	c                  >    dt               j                         z   dz   S )N{})
UuidCreater~   rF   r   r   r   r      s    z|!!##C''r   c                   $    e Zd Zd Zd Zd Zd Zy)CABc                 L    || _         g | _        t               | _        d| _        y )Nr   )r   filesset	filenamesr   r   s     r   r   zCAB.__init__   s     	

r   c                     t        |      x}}d}|| j                  v rd||fz  }|dz  }|| j                  v r| j                  j                  |       |S )Nr   z%s.%d)r   r   add)r   filelogical_logicalposs        r   gen_idz
CAB.gen_id   s_    $T]*('3/G1HC ' 	7#r   c                     t         j                  j                  |      ry |s| j                  |      }| xj                  dz  c_        | j
                  j                  ||f       | j                  |fS Nr   )r{   rn   isdirr   r   r   r   )r   fullr   r   s       r   r   z
CAB.append   sX    77==kk$'G

a


4/*zz7""r   c           
         ddl m}  |       }t        || j                         t	        |dd| j
                  d d| j                  z   d d fg       t        || j                  |       t        j                  |       |j                          y )Nr   )mktempMediar   #)tempfiler   	FCICreater   rl   r   r   ro   r{   r|   r   )r   r@   r   filenames       r   commitz
CAB.commit   sk    #8(DJJ'WTZZs499}dDAB	D2tyy(+
		(
		r   N)rC   rD   rE   r   r   r   r   rF   r   r   r   r      s    #r   r   c                   8    e Zd ZddZd	dZd Zd
dZddZd Zy)	DirectoryNc                    d}t        |      }|}	|	t        v rd||fz  }	|dz  }|	t        v rt        j                  |	       || _        || _        || _        || _        |	| _        d| _        t               | _
        t               | _        i | _        || _        |r<t        j                  j!                  |j"                  |      | _        |j                  }
n	|| _        d}
t%        |d|	|
|fg       y)az  Create a new directory in the Directory table. There is a current component
        at each point in time for the directory, which is either explicitly created
        through start_component, or implicitly when files are added for the first
        time. Files are added into the current component, and into the cab file.
        To create a directory, a base directory object needs to be specified (can be
        None), the path to the physical directory, and a logical directory name.
        Default specifies the DefaultDir slot in the directory table. componentflags
        specifies the default flags that new components get.r   z%s%dNr   )r   _directoriesr   r@   cabbasedirphysicalr   	componentr   short_namesidskeyfilescomponentflagsr{   rn   r4   absoluterl   )r   r@   r   r   r   r   defaultr   r   r   blogicals              r   r   zDirectory.__init__   s     8$%%00GQJE % 	! 55,GGLL)9)98DDMH$DMH[GXw#?"@Ar   c           
         || j                   }|t               }n|j                         }|| j                  }|| _        t
        r|dz  }|r+| j                  j                  |      }|| j                  |<   nd}t        | j                  d||| j                  |d|fg       |t        }t        | j                  d|j                  |fg       y)at  Add an entry to the Component table, and make this component the current for this
        directory. If no component name is given, the directory name is used. If no feature
        is given, the current feature is used. If no flags are given, the directory's default
        flags are used. If no keyfile is given, the KeyPath is left null in the Component
        table.Nr	   	ComponentFeatureComponents)r   r   r~   r   r   r   r   r   r   rl   r@   current_featureid)r   r   featurer:   keyfileuuidkeyids          r   start_componentzDirectory.start_component  s     =''E<:D::<DI"SLEHHOOG,E%*DMM'"E+#T4<<eLM	O?%G-!**i01	3r   c                    |}|j                  dd      }dj                  d |D              }|j                  d      }t        |      dkD  r<dj                  |d d       j	                         }|d   j	                         }|s|}d }n|j	                         }d }t        |      dk  r1t        |      d	k  r#||k(  r|rt        |      dk  r|r	|dz   |z   }n|}nd }||| j
                  v rF|d d
 }|r|d d }d}	 |r	d|||fz  }nd||fz  }|| j
                  vrn|dz  }|dk  sJ |dv r|d d }7| j
                  j                  |       t        j                  d|      rJ |S )N+r   r$   c              3   *   K   | ]  }|d vs|  yw)z
 "/\[]:;=,NrF   ).0r   s     r   	<genexpr>z'Directory.make_short.<locals>.<genexpr>%  s     AQa=.@qAs   	r   r   r         z%s~%d.%sz%s~%di'  )
   d   i  z[\?|><:/*"+,;=\[\]])	replacer4   splitr(   r~   r   r   r   search)r   r   oldfilepartsprefixsuffixr   s          r   
make_shortzDirectory.make_short"  s   ||C%wwA$AA

3u:>WWU3BZ(..0F2Y__&FZZ\FFu:>c&kQ.47?4:c&kQ>Ncz&(D<44#3#33BQZFC%f(==D"fc]2Dt///qU{"{/)#CR[F  	T"993T:::r   c                    | j                   s!| j                  | j                  t        d       |s!|}t        j
                  j                  |      }t        j
                  j                  | j                  |      }t        j                  d|      rJ || j                  v r| j                  |   }nd}| j                  j                  |||      \  }}|| j                  vsJ | j                  j                  |       | j!                  |      }|d|}	t	        j"                  |      j$                  }
d}t'        | j(                  d|| j                   |	|
||||fg       |j+                  d      r]t'        | j(                  d|d	z   | j                   |d
|d	| j                  df|dz   | j                   |d|d| j                  dfg       |S )a  Add a file to the current component of the directory, starting a new one
        if there is no current component. By default, the file name in the source
        and the file table will be identical. If the src file is specified, it is
        interpreted relative to the current directory. Optionally, a version and a
        language can be specified for the entry in the File table.r   z[\?|><:/*]"N|r
   Filez.py
RemoveFiler   zC|r   ozO|)r   r   r   r   r{   rn   basenamer4   r   r   r   r   r   r   r   r   r   statst_sizerl   r@   endswith)r   r   srcversionlanguager   r   sequenceshortr   filesize
attributess               r   add_filezDirectory.add_fileK  s    ~~  BC77##D)D77<<s399^T2224== mmD)GG HHOOHdGD'dhh&&&W%&778$,, 
&!4>>47!:x9 :	; ==TWWlT^^%5Na)T^^%5Na)*+
 r   c                     	 t        j                  | j                        }|dd dk7  r	d |D        }t	        j
                  ||      }|D ]  }|r||v r
| j                  |        |S # t        $ r g cY S w xY w)zAdd a list of files to the current component as specified in the
        glob pattern. Individual files can be excluded in the exclude list.Nr   r   c              3   2   K   | ]  }|d    dk7  s|  yw)r   r   NrF   )r   fs     r   r   z!Directory.glob.<locals>.<genexpr>  s     511Q5s   )r{   listdirr   r}   fnmatchfilterr   )r   patternexcluder   r   s        r   globzDirectory.glob|  s    	JJt}}-E 2A;#55Eug. 	A1<MM!	   	I	s   A) )A76A7c           	          t        | j                  d| j                  dz   | j                  d| j                  dfg       y)zRemove .pyc files on uninstallr   r   z*.pycr   N)rl   r@   r   r   r   s    r   
remove_pyczDirectory.remove_pyc  s5    ,>>#%t~~waPQ	Sr   r   )NNNNN)NNN)	rC   rD   rE   r   r   r   r   r  r  rF   r   r   r   r      s%     BD3:'R/bSr   r   c                       e Zd Zd Zd Zy)r\   c                     || _         y r   r   )r   fnames     r   r   zBinary.__init__  s	    	r   c                      d| j                   z  S )Nz)msilib.Binary(os.path.join(dirname,"%s"))r  r  s    r   __repr__zBinary.__repr__  s    :TYYFFr   N)rC   rD   rE   r   r  rF   r   r   r\   r\     s    Gr   r\   c                       e Zd Z	 	 ddZd Zy)FeatureNc
                 Z    || _         |r|j                   }t        |d||||||||	fg       y )Nr  )r   rl   )
r   r@   r   titledescdisplaylevelparent	directoryr   s
             r   r   zFeature.__init__  s=    YYFYfeT7J8 9	:r   c                     | a y r   )r   r  s    r   set_currentzFeature.set_current  s    r   )r   NNr   )rC   rD   rE   r   r  rF   r   r   r  r    s    =>;<:r   r  c                   &    e Zd Zd ZddZd Zd Zy)Controlc                      || _         || _        y r   )dlgr   )r   r  r   s      r   r   zControl.__init__  s    	r   Nc           
          t        | j                  j                  d| j                  j                  | j                  ||||fg       y )NControlEventrl   r  r@   r   )r   eventargument	conditionorderings        r   r!  zControl.event  s:    n88==$))UHh( )	*r   c                     t        | j                  j                  d| j                  j                  | j                  ||fg       y )NEventMappingr   )r   r!  	attributes      r   mappingzControl.mapping  s2    n88==$))UI>?	Ar   c                     t        | j                  j                  d| j                  j                  | j                  ||fg       y )NControlConditionr   )r   rM   r#  s      r   r#  zControl.condition  s3    088==$))VY?@	Br   )1N)rC   rD   rE   r   r!  r(  r#  rF   r   r   r  r    s    *
ABr   r  c                       e Zd Zd ZddZy)RadioButtonGroupc                 <    || _         || _        || _        d| _        y r   )r  r   propertyr   )r   r  r   r/  s       r   r   zRadioButtonGroup.__init__  s    	 
r   Nc                     ||}t        | j                  j                  d| j                  | j                  ||||||d f	g       | xj                  dz  c_        y )NRadioButtonr   )rl   r  r@   r/  r   )r   r   xywhtextrj   s           r   r   zRadioButtonGroup.add  sU    =Em==$**eaAtT+ ,	- 	

a
r   r   )rC   rD   rE   r   r   rF   r   r   r-  r-    s    r   r-  c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
Dialogc                     || _         || _        ||||f\  | _        | _        | _        | _        t        |d||||||||	|
|f
g       y )Nr8  )r@   r   r2  r3  r4  r5  rl   )r   r@   r   r2  r3  r4  r5  attrr  firstr   cancels               r   r   zDialog.__init__  sR    	)*1Qq&Xq1QtE% OPQr   c                 v    t        | j                  d| j                  |||||||||	|
|fg       t        | |      S )Nr  )rl   r@   r   r  )r   r   r   r2  r3  r4  r5  r:  propr6  nexthelps               r   controlzDialog.control  sC    )99dD!Q1dD$dST	VtT""r   c                 8    | j                  |d|||||d |d d       S )NTextrA  )r   r   r2  r3  r4  r5  r:  r6  s           r   r6  zDialog.text  s*    ||D&!Q1dD4' 	'r   c                 8    | j                  |d||||dd |d d       S )NBitmapr   rD  )r   r   r2  r3  r4  r5  r6  s          r   bitmapzDialog.bitmap  s%    ||D(Aq!Q4tTRRr   c                 8    | j                  |d||||dd d d d       S )NLiner   rD  )r   r   r2  r3  r4  r5  s         r   linezDialog.line  s%    ||D&!Q1atT4PPr   c	                 8    | j                  |d|||||d ||d       S )N
PushButtonrD  )	r   r   r2  r3  r4  r5  r:  r6  r?  s	            r   
pushbuttonzDialog.pushbutton  s&    ||D,1aD$dTXYYr   c
                 x    t        | j                  d| j                  |d||||||||	d fg       t        | ||      S )Nr  r-  )rl   r@   r   r-  
r   r   r2  r3  r4  r5  r:  r>  r6  r?  s
             r   
radiogroupzDialog.radiogroup  sL    )99d$6aAtT4t= >	?  dD11r   c
                 8    | j                  |d||||||||	d       S )NCheckBoxrD  rO  s
             r   checkboxzDialog.checkbox  s&    ||D*aAq$dDRVWWr   N)rC   rD   rE   r   rA  r6  rG  rJ  rM  rP  rS  rF   r   r   r8  r8    s/    R#
'SQZ2Xr   r8  ))_msir  r{   r   r   syswarnings_deprecatedrC   r   r   Win64r+   
type_validr2   r,   r/   r.   r-   r0   r1   r3   r)   r   rH   rQ   rl   ro   r   r   r   r   r   r   r   r   r\   r  r  r-  r8  rF   r   r   <module>rZ     s7     	 	  
    Xg .3;; 
 	
:%(88$%'/0	5 5n  '3L 
56%N4(! !F ulS lS\G G B B$w  X  Xr   