blob: 3e24d00a8eb7be314510374c8d0850bb2cdcdf11 [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 Heimesb9eccbf2007-12-05 20:18:38 +000015TCL = "tcl8.4.16"
16TK = "tk8.4.16"
Christian Heimes255f53b2007-12-08 15:33:56 +000017TIX = "tix-8.4.0"
Christian Heimesb9eccbf2007-12-05 20:18:38 +000018#TIX = "Tix8.4.2"
Christian Heimesb0789252007-11-24 12:40:29 +000019ROOT = os.path.abspath(os.path.join(here, par, par))
20NMAKE = "nmake /nologo "
21
22def system(cmd):
23 if os.system(cmd) != 0:
24 raise RuntimeError(cmd)
25
26def build(platform, clean):
27 if platform == "Win32":
28 dest = os.path.join(ROOT, "tcltk")
29 machine = "X86"
30 elif platform == "x64":
31 dest = os.path.join(ROOT, "tcltk64")
32 machine = "X64"
33 else:
34 raise ValueError(platform)
35
36 # TCL
37 tcldir = os.path.join(ROOT, TCL)
38 if True:
39 os.chdir(os.path.join(tcldir, "win"))
40 if clean:
41 system(NMAKE + "/f makefile.vc clean")
42 system(NMAKE + "/f makefile.vc")
43 system(NMAKE + "/f makefile.vc INSTALLDIR=%s install" % dest)
44
45 # TK
46 if True:
47 os.chdir(os.path.join(ROOT, TK, "win"))
48 if clean:
49 system(NMAKE + "/f makefile.vc clean")
50 system(NMAKE + "/f makefile.vc TCLDIR=%s" % tcldir)
51 system(NMAKE + "/f makefile.vc TCLDIR=%s INSTALLDIR=%s install" %
52 (tcldir, dest))
53
54 # TIX
55 if True:
Christian Heimes255f53b2007-12-08 15:33:56 +000056 # python9.mak is available at http://svn.python.org
Christian Heimesb0789252007-11-24 12:40:29 +000057 os.chdir(os.path.join(ROOT, TIX, "win"))
58 if clean:
Christian Heimesb9eccbf2007-12-05 20:18:38 +000059 system(NMAKE + "/f python9.mak clean")
60 system(NMAKE + "/f python9.mak MACHINE=%s" % machine)
61 system(NMAKE + "/f python9.mak install")
Christian Heimesb0789252007-11-24 12:40:29 +000062
63
64def main():
65 if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"):
66 print("%s Win32|x64" % sys.argv[0])
67 sys.exit(1)
68
69 if "-c" in sys.argv:
70 clean = True
71 else:
72 clean = False
73
74 build(sys.argv[1], clean)
75
76
77if __name__ == '__main__':
78 main()