1
+ import ctypes
1
2
import urllib .request
2
3
import os
4
+ import shutil
5
+
6
+ # Variables
7
+ url = "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.zip"
8
+ filename = "wxWidgets-3.2.1.zip"
9
+ finalpath = "C:\\ wxWidgets-3.2.1"
10
+
3
11
4
12
def main ():
5
- url = "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.zip"
6
- filename = "wxWidgets-3.2.1.zip"
13
+ # Main
14
+ downloadWxWidgets ()
15
+ extractWxWidgets ()
16
+ buildWxWidgets ()
17
+ setEnvironmentVariables ()
18
+
19
+
20
+ def downloadWxWidgets ():
21
+ # Download wxWidgets
22
+
23
+ print ("[-] Downloading wxWidgets..." )
7
24
urllib .request .urlretrieve (url , filename )
25
+ print ("[-] Download complete!" )
26
+
27
+
28
+ def extractWxWidgets ():
29
+ # Extract wxWidgets
30
+ print ("[-] Extracting wxWidgets..." )
31
+ shutil .unpack_archive (filename , finalpath )
32
+ shutil .move (os .getcwd () + f"\\ { filename } " , f"{ finalpath } .zip" )
33
+ print ("[-] Extraction complete!" )
34
+
35
+
36
+ def buildWxWidgets ():
37
+ # Build wxWidgets
38
+ # This is a bit of a hack, but it works
39
+ print ("[-] Building wxWidgets..." )
40
+ os .chdir (f"{ finalpath } \\ build\\ msw" )
41
+ print ("[-] Building wxWidgets Debug (x64)..." )
42
+ os .system ("msbuild wx_vc17.sln /p:Configuration=Debug /p:Platform=x64" )
43
+ print ("[-] Building wxWidgets Release (x64)..." )
44
+ os .system ("msbuild wx_vc17.sln /p:Configuration=Release /p:Platform=x64" )
45
+ print ("[-] Building wxWidgets Debug (Win32)..." )
46
+ os .system ("msbuild wx_vc17.sln /p:Configuration=Debug /p:Platform=Win32" )
47
+ print ("[-] Building wxWidgets Release (Win32)..." )
48
+ os .system ("msbuild wx_vc17.sln /p:Configuration=Release /p:Platform=Win32" )
49
+ print ("[-] Build complete!" )
50
+
51
+
52
+ def setEnvironmentVariables ():
53
+ # Set environment variables
54
+ print ("[-] Setting environment variables..." )
55
+ os .system (f"setx WXWIN \" { finalpath } \" /M" )
56
+ print ("[-] Environment variables set!" )
57
+
58
+
59
+ def checkAdmin ():
60
+ # Check if running as admin
61
+ try :
62
+ return ctypes .windll .shell32 .IsUserAnAdmin ()
63
+ except Exception :
64
+ return False
65
+
8
66
9
67
if __name__ == "__main__" :
10
- main ()
68
+ print ("[-] Checking for admin privileges..." )
69
+ if checkAdmin ():
70
+ main ()
71
+ else :
72
+ print ("[!] Please run as admin" )
73
+ exit (0 )
0 commit comments