
    
hd                        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\" \R                  R                  \R                  " 5       S5      S5      r " S S5      r\" \R                  5      \l        \" \R                  5      \l        / SQrS rSrS\R&                  -   rS	 r SS
 jrS rS rS rS rSS jrSS jrS S jrS S jrS rS r S r!S r"S r#S\$S\$4S jr%S r&\'S:X  a  \&" 5         gg)!    Nzpywin32_postinstall.logwc                   &    \ rS rSrS rS rS rSrg)Tee   c                     Xl         g Nf)selffiles     tC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\../../Scripts/pywin32_postinstall.py__init__Tee.__init__   s        c                     U R                   b,   U R                   R                  UR                  SS5      5        [        R                  U5        g ! [         a     N"f = f)N
z
)r
   writereplaceOSErrortee_f)r   whats     r   r   	Tee.write   sN    66T\\$78 	D  s   +A 
AAc                     U R                   b   U R                   R                  5         [        R                  5         g ! [         a     N!f = fr   )r
   flushr   r   )r   s    r   r   	Tee.flush#   s=    66 	  s   > 
A
Ar	   N)__name__
__module____qualname____firstlineno__r   r   r   __static_attributes__ r   r   r   r      s    r   r   ))zwin32com.servers.interpInterpreter)zwin32com.servers.dictionaryDictionaryPolicy)z!win32com.axscript.client.pyscriptPyScript   Software\Python\PythonCore\c                       [         R                  " [         R                  [        S[         R                  5        [         R                  $ ! [
         a    [         R                  s $ f = f)Nr   )winregOpenKeyHKEY_LOCAL_MACHINEroot_key_nameKEY_CREATE_SUB_KEYr   HKEY_CURRENT_USERr!   r   r   get_root_hkeyr.   @   sS    (%%}a9R9R	
 ((( ( '''(s   AA A('A(c                    SS K nSSKJn  UR                  UR                  S UR
                  UR                  5      n	U	R                  U 5        U	R                  U5        U(       a  U	R                  U5        U(       a  U	R                  U5        U(       d  U(       a  U	R                  XV5        U	R                  UR                  5      n
U
R                  US5        g )Nr   )shell)	pythoncomwin32com.shellr0   CoCreateInstanceCLSID_ShellLinkCLSCTX_INPROC_SERVERIID_IShellLinkSetPathSetDescriptionSetArgumentsSetWorkingDirectorySetIconLocationQueryInterfaceIID_IPersistFileSave)pathdescriptionfilename	argumentsworkdiriconpath	iconindexr1   r0   ilinkipfs              r   create_shortcutrH   N   s     $&&&&	E 
MM$	%9%!!'*9h2


y99
:CHHXqr   c                     SSK JnJn  SR                  5        H(  nX0:X  d  M
  [	        X#5      nUR                  SUS5      s  $    [        U  S35      e)Nr   r0   shellcona>  
        CSIDL_COMMON_STARTMENU CSIDL_STARTMENU CSIDL_COMMON_APPDATA
        CSIDL_LOCAL_APPDATA CSIDL_APPDATA CSIDL_COMMON_DESKTOPDIRECTORY
        CSIDL_DESKTOPDIRECTORY CSIDL_COMMON_STARTUP CSIDL_STARTUP
        CSIDL_COMMON_PROGRAMS CSIDL_PROGRAMS CSIDL_PROGRAM_FILES_COMMON
        CSIDL_PROGRAM_FILES CSIDL_FONTSFz is an unknown path ID)r2   r0   rK   splitgetattrSHGetSpecialFolderPath
ValueError)	path_namer0   rK   maybecsidls        r   get_special_folder_pathrS   h   s[    .+
 ,1573 H,E//5%@@3 	{"89
::r   c                 \   SS K nSS Kn  UR                  XS5        g ! UR                   a{  nUR                  S:X  a  e [
        (       a  e SU  SUR                   3nUR                  SUSUR                  5      nXtR                  :X  a  e XtR                  :X  a   S nAg  S nAOS nAff = fM  )Nr      zError zY

If you have any Python applications running, please close them now
and select 'Retry'

zInstallation Error)win32apiwin32conCopyFileerrorwinerrorsilentstrerror
MessageBoxMB_ABORTRETRYIGNOREIDABORTIDIGNORE)descsrcdestrV   rW   details	full_descrcs           r   CopyTorg   w   s    
	c+~~ 	1$v @@G@P@P?QS 
 $$92H4P4PB %%%((( )!		 s    B)A,B$$B)c                    SS K nSS KnSUR                  R                  ;   a  SOSnSU[        R
                  R                  [        R
                  R                  U4-  n[        R                  R                  U SU5      nUR                  R                  X5      nUR                  R                  XUS9nUR                  R                  U5      nUR                  U5        g )Nr   z_d.pyd_d z%s%d%d%s.dllpywin32_system32)nameloaderorigin)importlib.machineryimportlib.util	machineryEXTENSION_SUFFIXESsysversion_infomajorminorosr?   joinExtensionFileLoader
ModuleSpecutilmodule_from_specexec_module)lib_dirmodname	importlibsuffixrA   rm   specmods           r   LoadSystemModuler      s    !4!4!G!GGTRF	! H ww||G%7BH  44WGF))wh)WD
..
)
)$
/C
sr   c           
         [        5       n[        R                  " U[        5      n [        R                  " X@5      n [        R
                  " XQS[        R                  U5        [        (       a  [        S[         SU  SU SU< 35        UR                  5          UR                  5         g ! UR                  5         f = f! UR                  5         f = f)Nr   z-> \[z]=)
r.   r(   r)   r+   	CreateKey
SetValueExREG_SZverboseprintClose)key_name
value_namevalue	root_hkeyroot_keymy_keys         r   SetPyKeyValr      s    I~~i7H	!!(5	f!V]]EJwM?"XJa
|2eYOPLLN LLNs#   C AB. C .C  C Cc           	         [        5       n[        R                  " U[        5      n [        R                  " X@S[        R                  5      n [        R
                  " XQ5        [        (       a  [        S[         SU  SU S35        UR                  5         U(       a6  [        R                  " X@5        [        (       a  [        S[         SU  35        UR                  5         g ! UR                  5         f = f! [         a(  n[        USUR                  5      nUS:w  a  e  S nANSS nAff = f! UR                  5         f = f)Nr   z
-> DELETE r   r   ]rZ      )r.   r(   r)   r+   KEY_SET_VALUEDeleteValuer   r   r   	DeleteKeyr   rM   errno)r   r   
delete_keyr   r   r   whyrZ   s           r   UnsetPyKeyValr      s    I~~i7HAv7K7KL	v2w
=/H:Qzl!LMLLNX0w
=/H:>? 	 LLN
  3
CII6q= 
 	sB   &C; :C& AC; &C88C; ;
D-D(#D0 (D--D0 0Ec                    SS K nU (       a!  UR                  R                  R                  nO UR                  R                  R                  n0 n[
        (       d  SUS'   [         HW  u  pE[        U5        [        R                  U   n[        USS 5      US'   [        USS 5      US'   [        Xe5      nU" U40 UD6  MY     g )Nr   r%   quietDllRegisterServerfinalize_registerDllUnregisterServerfinalize_unregister)win32com.server.registerserverregisterRegisterClassesUnregisterClassesr   com_modules
__import__rs   modulesrM   )r   win32comfuncflagsmodule
klass_namer   klasss           r   RegisterCOMObjectsr      s    #''77''99E7g)6kk&!%,S2Et%L!"'.s4I4'P#$(Ue *r   c                 8   Uc  [         R                  " 5       S   nU (       am  [        R                  R	                  US5      n[        R                  R                  U5      (       a  [        SS S 5        [        SS U5        U$ [        S5         g [        SS SS9  g )NplatlibzPyWin32.chmHelpzHelp\Pythonwin Referencez@NOTE: PyWin32.chm can not be located, so has not been registeredT)r   )		sysconfig	get_pathsrw   r?   rx   isfiler   r   r   )r   r~   chm_files      r   RegisterHelpFiler      s    %%'	277<<777>>(##d+3T8DOTU  	14DIr   c                    SSK nUc  [        R                  " 5       S   n[        5       nUR                  R                  USS5      nUS-   nSSU4S	S
U4SS
U4/n U (       ax  U Hq  u  pxn	[        R                  " X75      n
U(       a  [        R                  " X5      n
[        R                  " U
SS[        R                  U	5        U
R                  5         Ms     OfU H`  u  pxn	 U(       a<  [        R                  " X75      n
[        R                  " X5        U
R                  5         [        R                  " X75        Mb     SSKJnJn  UR'                  UR(                  UR*                  SS5        g! [         a)  n[        USUR                  5      nUS:w  a  e  SnAM  SnAff = f! SSKJnJn  UR'                  UR(                  UR*                  SS5        f = f)zAdd (or remove) Pythonwin to context menu for python scripts.
??? Should probably also add Edit command for pys files also.
Also need to remove these keys on uninstall, but there's no function
to add registry entries to uninstall log ???
r   Nr   	PythonwinzPythonwin.exez -edit "%1"zASoftware\Microsoft\Windows\CurrentVersion\App Paths\Pythonwin.exerj   z6Software\Classes\Python.File\shell\Edit with Pythonwincommandz;Software\Classes\Python.NoConFile\shell\Edit with PythonwinrZ   r   rJ   )rw   r   r   r.   r?   rx   r(   r   r   r   r   r)   r   r   rM   r   r2   r0   rK   SHChangeNotifySHCNE_ASSOCCHANGEDSHCNF_IDLIST)r   r~   rw   classes_rootpythonwin_exepythonwin_edit_command	keys_valskeysub_keyvalhkeyr   rZ   r0   rK   s                  r   RegisterPythonwinr      s    %%'	2 ?LGGLL+GM*]: U	
 I"	
 N"	
I$
%.!c '':!++D:D!!$aD

 &/ &/!c	%~~l@((7

$$\7 &/ 	3'')>)>d	
  &sJ		BH1} % 	3'')>)>d	
s8   BF' #AE1<F' 1
F$;FF' F$$F' '2Gc                     [        5       [        R                  :X  a   [        S5      n O[        S5      n  [        R
                  " [        5       [        S-   5      n[        R                  R                  X5      $ ! [         a    [        S5      n  N]f = f! [         a:    S[        R                  R                  [        R                  R                  4-  n N}f = f)NCSIDL_COMMON_PROGRAMSCSIDL_PROGRAMSz\InstallPath\InstallGroupzPython %d.%d)r.   r(   r*   rS   r   
QueryValuer+   rs   rt   ru   rv   rw   r?   rx   )fldrinstall_groups     r   get_shortcuts_folderr   8  s    &333	=*+BCD ''78
))O]-JJ
 77<<,,!  	=*+;<D	=  
&""""*
 

s#   A; &B ;BBACCc                  l   SS K n  SS KnSS KnSSKJnJn   UR                  5       (       a  UR                  SUR                  5      $ UR                  SUR                  5      $ ! UR                  UR                  4 a    U R                  5       s $ f = f! [         a    U R                  5       s $ f = f)Nr   rJ   )rV   r1   win32processr2   r0   rK   IsWow64ProcessrN   CSIDL_SYSTEMX86CSIDL_SYSTEM	com_errorrY   GetSystemDirectoryImportError)rV   r1   r   r0   rK   s        r   get_system_dirr   Q  s    -2	1**,,33Ax7O7OPP//83H3HII##\%7%78 	1..00	1 -**,,-s4   B 0A$ A$ $,BB BB B32B3c                     SS K n SS Kn[        R                  R	                  [        R                  R                  U R                  5      S5      n[        R                  R	                  [        R                  R                  U R                  5      S5      n[        R                  R	                  [        R                  R                  UR                  5      S5      nX#4 H  nUS-   n[        R                  R                  U5      (       d  M.  [        R                  R                  U5      (       d  MT   [        R                  R                  U5      (       a*  [        SU SU S35        [        R                  " U5        M  [        R                  " XV5        [        S	U S
U S35        M     g ! [         a  n[        SU SU 35         S nAM  S nAff = f)Nr   zdbi.pydz	dbi_d.pydzdbi.pyz.oldz	Old dbi 'z' already exists - deleting ''z	renamed 'z'->'z.old'zFAILED to rename 'z': )rV   rW   rw   r?   rx   dirname__file__r   r   removerenamer   )rV   rW   pyd_name
pyd_d_namepy_namethis_pyd	this_destexcs           r   	fixup_dbir   c  sK    ww||BGGOOH,=,=>	JHbggooh.?.?@+NJggll277??8+<+<=xHG*v%	77>>(##w(?(?
?77>>),,#I;.KH:UVW IIh'IIh2IhZtH:UCD +  ?*8*Cu=>>?s   6AF1(F11
G;GGc                 (   SS K n[        R                  R                  [        R                  R	                  [
        R                  S5      5      (       aB  [        R                  " [        R                  R	                  [
        R                  S5      5        SR                  5        H?  n[
        R                  R                  [        R                  R	                  X5      5        MA     SR                  5        Ht  nS[
        R                  -   S-   U-   n[        R                  [        R                  4 H4  n [        R                  " XCS-   5         [        R                  " XC5        M6     Mv     [!        U S5        [!        U S	5        SS Kn[$        R$                  " [        R                  R	                  U S
5      5      nU(       d  ['        S5      e[)        5       [
        R                  4 GHy  nSn U GHb  n	[        R                  R+                  U	5      n
[        R                  R	                  Xz5      n[-        SU
-  X5        [.        (       a  [1        SU
 SU 35        Sn[        R                  R	                  [
        R                  S5      [        R                  R	                  [
        R                  S5      /nU[
        R                  :w  a  UR                  [
        R                  5        U H^  n[        R                  R	                  X5      n[        R                  R3                  U5      (       d  MH  [        R                  " U5        M`     GMe     U(       a    OGM|     ['        S5      e  [9        5         [        R>                  " [A        5       [B        5        S n [E        SU 5      n[.        (       a  [1        S5        [G        5          [I        SU 5        [.        (       a  [1        S5        [        R                  R	                  U SS5      n[        R                  RK                  U5      (       d/  [.        (       a  [1        SU 35        [        RL                  " U5         [O        5       n[        R                  RK                  U5      (       a  [        R                  R	                  US 5      n[Q        [        R                  R	                  U S!5      S"US#[
        R                  5        [.        (       a  [1        S$5        U(       aE  [        R                  R	                  US%5      nS&n[Q        UUU5        [.        (       a  [1        S'5        O[.        (       a  [1        S(U< S)35         SS K)n[1        S*5        g ! [         a     GN?f = f! [         a     GMn  f = f! UR4                   a\  nUR6                  S:X  aF  [        R                  R3                  W5      (       a  SU-  n[1        U5        ['        U5      e S nAGM   e S nAff = f! UR4                   a2  nUR6                  S:w  a  e [1        S5        [1        S5         S nAGNS nAff = f! [:         a    [1        S5        UR=                  5          GNf = f! [:         a    [1        S5        UR=                  5          GNf = f! [:         a    [1        S5        UR=                  5          GNf = f! [:         a  n[1        U5         S nAGNS nAff = f! [T         a     GNf = f)+Nr   zpywin32.pthzwin32 win32\lib Pythonwinzpythoncom pywintypesr&   z	\Modules\z\Debug
pywintypesr1   pywin32_system32\*.*zNo system files to copy!!zinstalling %szCopied z to r%   zLibrary\binzLib\site-packages\win32rU   zThe file '%s' exists, but can not be replaced due to insufficient permissions.  You must reinstall this software as an Administratorz=You don't have enough permissions to install the system filesz7You do not have the permissions to install COM objects.z+The sample COM objects were not registered.z)FAILED to register the Python COM objectsTzRegistered help filezFailed to register help filez-Pythonwin has been registered in context menuz&Failed to register pythonwin as editorr   gen_pyzCreating directory PythonWin.lnkzPythonwin\Pythonwin.exezThe Pythonwin IDErj   zShortcut for Pythonwin created$Python for Windows Documentation.lnkz(Documentation for the PyWin32 extensionsz!Shortcut to documentation createdzCan't install shortcuts - z is not a folderz3The pywin32 extensions were successfully installed.)+	tracebackrw   r?   r   rx   rs   prefixunlinkrL   appendwinverr(   r*   r-   r   r   r   rV   globRuntimeErrorr   basenamerg   r   r   existsrY   rZ   r   	Exception	print_excr   r.   r+   r   r   r   isdirmkdirr   rH   win32com.clientr   )r~   r   rl   keynamerootrV   filesdest_dirworkedfnamebasedstbad_dest_dirsbad_dest_dir	bad_fnamerd   msgr   make_dirr   docr   s                         r   installr
  }  si   
 
ww~~bggll3::}=>>
		"'',,szz=9: -224W34 5
 ',,.2SZZ?-ORVV--v/G/GGD  ':;  / H / Wl+Wk* IIbggll7,CDEE677 $%szz2%	ww''.ggll82-u:7GD6cU34 GGLL^<GGLL-HI! szz)!((4$1L "\ @Iww~~i00		),	 %2 (  1 3T K
 	


	A  ]_m4H*#D'2
 7() KC$(
 7AB ww||GZ:H77==""7'z23
 $% 77=='',,t_5CW&@A#

 w67ggll4)OP@#s37=>w24(:JKL 

?@g    L ~~ 	1$ 77>>#&&FHKL 
 #J&s++	0 ~~ 	A1$KL?@@		A
  9:  ,-  67T  g  s   :VV5EV(?&V(9
X )Z Z4 -C+[  [  5\ 
VV
V%$V%(X8AXXXY''YY YY %ZZ%Z10Z14%[[ 
\ *[;;\ 
\\c                    [        U S5        [        U S5         [        S5         [	        SU 5        [
        (       a  [        S5         [        SU 5        [
        (       a  [        S5         [        R                  R                  U S	S
5      n[        R                  R                  U5      (       a/  [        R                  " U5        [
        (       a  [        SU 35        [        R                  R                  U SS5      n[        R                  " [        R                  R                  US5      5       H  n[        R                  " U5        M      [        R                  " [        R                  R                  U SS5      5         [        R                  " [        R                  R                  U SS5      5         [!        5       nS Hy  n[        R                  R                  XV5      n[        R                  R#                  U5      (       d  MH  [        R                  " U5        [
        (       d  Mk  [        SU 35        M{     [        R                  " [        R                  R                  U S5      5      n [%        5       [&        R(                  4 H  n	Sn
U H  n[        R                  R+                  U5      n[        R                  R                  X5      n[        R                  R#                  U5      (       d  Mg   [        R                  " U5        Sn
[
        (       a  [        SU-  5        M  M     U
(       d  M    g    g ! [         a  n[        SU 35         S nAGNDS nAff = f! [         a  n[        SU 35         S nAGNGS nAff = f! [         a  n[        SU 35         S nAGNJS nAff = f! [         a     GNBf = f! [         a     GNf = f! [         a  n[        SU 35         S nAGN?S nAff = f! [         a  n[        SU 35         S nAGNS nAff = f! [         a    [        SU 35         GM  f = f! [         a  n[        SU 35         S nAg S nAff = f)Nr   r1   Fz"Failed to unregister COM objects: zUnregistered help filez Failed to unregister help file: zUnregistered Pythonwinz Failed to unregister Pythonwin: r   r   zRemoved directory r   pywinz*.cfcwin32zdbi.pyd.oldzdbi_d.pyd.oldzFailed to remove misc files: )r   r   zRemoved zFailed to remove shortcuts: r   r   r%   zRemoved file %szFAILED to remove zFAILED to remove system files: )r   r   r   r   r   r   r   rw   r?   rx   r   shutilrmtreer   r   r   r   r   r   rs   r   r   )r~   r   gen_dir	pywin_dirr  r   linkfqlinkr   r   r   r  r  s                r   	uninstallr  '  sw    Wl+Wk*:5!,( 7*+,%) 7*+5'',,w
H=77==!!MM'"w*7)45 GGLL+w?	YYrww||Iw?@EIIe A	IIbggll7G]CD	IIbggll7G_EF	4#%MDWW\\$-Fww~~f%%		&!7HTF+, N IIbggll7,CDEE7')3::6HFww''.ggll8277>>#&&9		#!""7!"3s";< #  v 7y  :23%899:
  806778  806778,  		  		  5-cU3445  4,SE2334& % 9 1#7889  7/u5667s	  M M1 	N ,C&O 5N= 	5O ?AP P 6P =BQ 1P+7Q Q Q 
M.M))M.1
N;NN
N:!N55N:=
OO 
OO 
OO OO 
P)O==P
P(P##P(+QQ QQ 
Q-Q((Q-locationreturnc                     [         R                  R                  U 5      n [         R                  R                  U 5      (       d  [        R
                  " SU  S35      eU $ )NzPath "z" is not an existing directory!)rw   r?   abspathr   argparseArgumentTypeError)r  s    r   verify_destinationr    sN    wwx(H77==""((XJ=>
 	
 Or   c                  j   [         R                  " [         R                  SS9n U R                  SSSSS9  U R                  SSSS	S9  U R                  S
[        SS9  U R                  SSSSS9  U R                  SSSSS9  U R                  S[
        R                  " 5       S   [        SS9  U R                  5       nUR                  (       d  [        SU 35        UR                  UR                  -  (       d  U R                  S5        UR                  b"   [        R                   " UR                  S5        UR$                  nUR                  (       + nUR                  (       a  [        UR&                  5        UR                  (       a  [)        UR&                  5        g g ! ["         a     Nwf = f)Na  A post-install script for the pywin32 extensions.

    * Typical usage:

    > python -m pywin32_postinstall -install

    * or (shorter but you don't have control over which python environment is used)

    > pywin32_postinstall -install

    You need to execute this script, with a '-install' parameter,
    to ensure the environment is setup correctly to install COM objects, services, etc.
    )formatter_classr@   z-installF
store_truez7Configure the Python environment correctly for pywin32.)defaultactionhelpz-removez7Try and remove everything that was installed or copied.z-waitz<Wait for the specified process to terminate before starting.)typer!  z-silentz?Don't display the "Abort/Retry/Ignore" dialog for files in use.z-quietz Don't display progress messages.z-destinationr   z$Location of the PyWin32 installation)r  r"  r!  zParsed arguments are: z1You need to either choose to -install or -remove!r   )r  ArgumentParserRawDescriptionHelpFormatteradd_argumentintr   r   r  
parse_argsr   r   r
  r   rY   waitrw   waitpidr   r[   destinationr  )parserargsr[   r   s       r   mainr-    s   $$ <<F  F	   F	   K  
 O	   /	   ##%i03	   D::&tf-.<<$++%HIyy	JJtyy!$
 [[F**nG||  !{{$""#   		s   !F% %
F21F2__main__)rj   rj   rj   r   )F)T)TN)(r  r   rw   r  rs   r   tempfiler(   openr?   rx   
gettempdirr   r   stderrstdoutr   r[   r   r   r+   r.   rH   rS   rg   r   r   r   r   r   r   r   r   r   r
  r  strr  r-  r   r!   r   r   <module>r5     s!  
   	  
   GGLL! 	 * _
_
 
 03::=	( ST4;F&.&$=
@-2-$?4gATU7|  K$\ zF r   