blob: 993c37c82c24fdd3d060202729af9cd59e6941c7 [file] [log] [blame]
Christian Heimesb0789252007-11-24 12:40:29 +00001"""Script to compile the dependencies of _tkinter
2
3Copyright (c) 2007 by Christian Heimes <christian@cheimes.de>
4
5Licensed to PSF under a Contributor Agreement.
6"""
7
8import os
9import sys
10import shutil
11
12here = os.path.abspath(os.path.dirname(__file__))
13par = os.path.pardir
14
Christian Heimes68e36862007-12-05 09:34:12 +000015TCL = "tcl8.4.16"
16TIX = "Tix8.4.2"
17TK = "tk8.4.16"
18#TCL = "tcl8.4.12"
19#TIX = "Tix8.4.0"
20#TK = "tk8.4.12"
Christian Heimesb0789252007-11-24 12:40:29 +000021ROOT = os.path.abspath(os.path.join(here, par, par))
22NMAKE = "nmake /nologo "
23
24def system(cmd):
25 if os.system(cmd) != 0:
26 raise RuntimeError(cmd)
27
28def build(platform, clean):
29 if platform == "Win32":
30 dest = os.path.join(ROOT, "tcltk")
31 machine = "X86"
32 elif platform == "x64":
33 dest = os.path.join(ROOT, "tcltk64")
34 machine = "X64"
35 else:
36 raise ValueError(platform)
37
38 # TCL
39 tcldir = os.path.join(ROOT, TCL)
40 if True:
41 os.chdir(os.path.join(tcldir, "win"))
42 if clean:
43 system(NMAKE + "/f makefile.vc clean")
44 system(NMAKE + "/f makefile.vc")
45 system(NMAKE + "/f makefile.vc INSTALLDIR=%s install" % dest)
46
47 # TK
48 if True:
49 os.chdir(os.path.join(ROOT, TK, "win"))
50 if clean:
51 system(NMAKE + "/f makefile.vc clean")
52 system(NMAKE + "/f makefile.vc TCLDIR=%s" % tcldir)
53 system(NMAKE + "/f makefile.vc TCLDIR=%s INSTALLDIR=%s install" %
54 (tcldir, dest))
55
56 # TIX
57 if True:
58 os.chdir(os.path.join(ROOT, TIX, "win"))
59 if clean:
60 system(NMAKE + "/f makefile.vc clean")
61 system(NMAKE + "/f makefile.vc MACHINE=%s" % machine)
62 system(NMAKE + "/f makefile.vc INSTALL_DIR=%s install" % dest)
63
64
65def main():
66 if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"):
67 print("%s Win32|x64" % sys.argv[0])
68 sys.exit(1)
69
70 if "-c" in sys.argv:
71 clean = True
72 else:
73 clean = False
74
75 build(sys.argv[1], clean)
76
77
78if __name__ == '__main__':
79 main()