| 1 | n/a | """Script to compile the dependencies of _tkinter |
|---|
| 2 | n/a | |
|---|
| 3 | n/a | Copyright (c) 2007 by Christian Heimes <christian@cheimes.de> |
|---|
| 4 | n/a | |
|---|
| 5 | n/a | Licensed to PSF under a Contributor Agreement. |
|---|
| 6 | n/a | """ |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | import os |
|---|
| 9 | n/a | import sys |
|---|
| 10 | n/a | |
|---|
| 11 | n/a | here = os.path.abspath(os.path.dirname(__file__)) |
|---|
| 12 | n/a | par = os.path.pardir |
|---|
| 13 | n/a | |
|---|
| 14 | n/a | TCL = "tcl8.5.11" |
|---|
| 15 | n/a | TK = "tk8.5.11" |
|---|
| 16 | n/a | TIX = "tix-8.4.3.x" |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | ROOT = os.path.abspath(os.path.join(here, par, par)) |
|---|
| 19 | n/a | NMAKE = ('nmake /nologo /f %s %s %s') |
|---|
| 20 | n/a | |
|---|
| 21 | n/a | def nmake(makefile, command="", **kw): |
|---|
| 22 | n/a | defines = ' '.join(k+'='+str(v) for k, v in kw.items()) |
|---|
| 23 | n/a | cmd = NMAKE % (makefile, defines, command) |
|---|
| 24 | n/a | print("\n\n"+cmd+"\n") |
|---|
| 25 | n/a | if os.system(cmd) != 0: |
|---|
| 26 | n/a | raise RuntimeError(cmd) |
|---|
| 27 | n/a | |
|---|
| 28 | n/a | def build(platform, clean): |
|---|
| 29 | n/a | if platform == "Win32": |
|---|
| 30 | n/a | dest = os.path.join(ROOT, "tcltk") |
|---|
| 31 | n/a | machine = "IX86" |
|---|
| 32 | n/a | elif platform == "AMD64": |
|---|
| 33 | n/a | dest = os.path.join(ROOT, "tcltk64") |
|---|
| 34 | n/a | machine = "AMD64" |
|---|
| 35 | n/a | else: |
|---|
| 36 | n/a | raise ValueError(platform) |
|---|
| 37 | n/a | |
|---|
| 38 | n/a | # TCL |
|---|
| 39 | n/a | tcldir = os.path.join(ROOT, TCL) |
|---|
| 40 | n/a | if 1: |
|---|
| 41 | n/a | os.chdir(os.path.join(tcldir, "win")) |
|---|
| 42 | n/a | if clean: |
|---|
| 43 | n/a | nmake("makefile.vc", "clean") |
|---|
| 44 | n/a | nmake("makefile.vc", MACHINE=machine) |
|---|
| 45 | n/a | nmake("makefile.vc", "install", INSTALLDIR=dest, MACHINE=machine) |
|---|
| 46 | n/a | |
|---|
| 47 | n/a | # TK |
|---|
| 48 | n/a | if 1: |
|---|
| 49 | n/a | os.chdir(os.path.join(ROOT, TK, "win")) |
|---|
| 50 | n/a | if clean: |
|---|
| 51 | n/a | nmake("makefile.vc", "clean", DEBUG=0, TCLDIR=tcldir) |
|---|
| 52 | n/a | nmake("makefile.vc", DEBUG=0, MACHINE=machine, TCLDIR=tcldir) |
|---|
| 53 | n/a | nmake("makefile.vc", "install", DEBUG=0, INSTALLDIR=dest, MACHINE=machine, TCLDIR=tcldir) |
|---|
| 54 | n/a | |
|---|
| 55 | n/a | # TIX |
|---|
| 56 | n/a | if 1: |
|---|
| 57 | n/a | # python9.mak is available at http://svn.python.org |
|---|
| 58 | n/a | os.chdir(os.path.join(ROOT, TIX, "win")) |
|---|
| 59 | n/a | if clean: |
|---|
| 60 | n/a | nmake("python.mak", "clean") |
|---|
| 61 | n/a | nmake("python.mak", MACHINE=machine, INSTALL_DIR=dest) |
|---|
| 62 | n/a | nmake("python.mak", "install", MACHINE=machine, INSTALL_DIR=dest) |
|---|
| 63 | n/a | |
|---|
| 64 | n/a | def main(): |
|---|
| 65 | n/a | if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "AMD64"): |
|---|
| 66 | n/a | print("%s Win32|AMD64" % sys.argv[0]) |
|---|
| 67 | n/a | sys.exit(1) |
|---|
| 68 | n/a | |
|---|
| 69 | n/a | if "-c" in sys.argv: |
|---|
| 70 | n/a | clean = True |
|---|
| 71 | n/a | else: |
|---|
| 72 | n/a | clean = False |
|---|
| 73 | n/a | |
|---|
| 74 | n/a | build(sys.argv[1], clean) |
|---|
| 75 | n/a | |
|---|
| 76 | n/a | |
|---|
| 77 | n/a | if __name__ == '__main__': |
|---|
| 78 | n/a | main() |
|---|