Christian Heimes | b078925 | 2007-11-24 12:40:29 +0000 | [diff] [blame] | 1 | """Script to compile the dependencies of _tkinter |
| 2 | |
| 3 | Copyright (c) 2007 by Christian Heimes <christian@cheimes.de> |
| 4 | |
| 5 | Licensed to PSF under a Contributor Agreement. |
| 6 | """ |
| 7 | |
| 8 | import os |
| 9 | import sys |
| 10 | import shutil |
| 11 | |
| 12 | here = os.path.abspath(os.path.dirname(__file__)) |
| 13 | par = os.path.pardir |
| 14 | |
Christian Heimes | b9eccbf | 2007-12-05 20:18:38 +0000 | [diff] [blame] | 15 | TCL = "tcl8.4.16" |
| 16 | TK = "tk8.4.16" |
Christian Heimes | 60d388d | 2007-12-05 09:36:42 +0000 | [diff] [blame] | 17 | TIX = "Tix8.4.0" |
Christian Heimes | b9eccbf | 2007-12-05 20:18:38 +0000 | [diff] [blame] | 18 | #TIX = "Tix8.4.2" |
Christian Heimes | b078925 | 2007-11-24 12:40:29 +0000 | [diff] [blame] | 19 | ROOT = os.path.abspath(os.path.join(here, par, par)) |
| 20 | NMAKE = "nmake /nologo " |
| 21 | |
| 22 | def system(cmd): |
| 23 | if os.system(cmd) != 0: |
| 24 | raise RuntimeError(cmd) |
| 25 | |
| 26 | def 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: |
| 56 | os.chdir(os.path.join(ROOT, TIX, "win")) |
| 57 | if clean: |
Christian Heimes | b9eccbf | 2007-12-05 20:18:38 +0000 | [diff] [blame] | 58 | system(NMAKE + "/f python9.mak clean") |
| 59 | system(NMAKE + "/f python9.mak MACHINE=%s" % machine) |
| 60 | system(NMAKE + "/f python9.mak install") |
Christian Heimes | b078925 | 2007-11-24 12:40:29 +0000 | [diff] [blame] | 61 | |
| 62 | |
| 63 | def main(): |
| 64 | if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"): |
| 65 | print("%s Win32|x64" % sys.argv[0]) |
| 66 | sys.exit(1) |
| 67 | |
| 68 | if "-c" in sys.argv: |
| 69 | clean = True |
| 70 | else: |
| 71 | clean = False |
| 72 | |
| 73 | build(sys.argv[1], clean) |
| 74 | |
| 75 | |
| 76 | if __name__ == '__main__': |
| 77 | main() |