Mercurial > cpython-lru_cache-weakref
annotate PCbuild/build_tkinter.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | 0590c0b76e64 |
| children |
| rev | line source |
|---|---|
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
1 """Script to compile the dependencies of _tkinter |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
2 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
3 Copyright (c) 2007 by Christian Heimes <christian@cheimes.de> |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
4 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
5 Licensed to PSF under a Contributor Agreement. |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
6 """ |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
7 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
8 import os |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
9 import sys |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
10 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
11 here = os.path.abspath(os.path.dirname(__file__)) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
12 par = os.path.pardir |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
13 |
|
47647
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
14 TCL = "tcl8.5.2" |
|
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
15 TK = "tk8.5.2" |
|
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
16 TIX = "tix-8.4.0.x" |
|
44331
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
17 |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
18 ROOT = os.path.abspath(os.path.join(here, par, par)) |
|
44331
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
19 # Windows 2000 compatibility: WINVER 0x0500 |
|
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
20 # http://msdn2.microsoft.com/en-us/library/aa383745.aspx |
|
44509
4e74c27678ba
Final adjustments for #1601
Christian Heimes <christian@cheimes.de>
parents:
44395
diff
changeset
|
21 NMAKE = ('nmake /nologo /f %s ' |
|
44635
be04ee4c4fd7
Add an important missing blank.
Thomas Heller <theller@ctypes.org>
parents:
44509
diff
changeset
|
22 'COMPILERFLAGS=\"-DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=NTDDI_WIN2KSP4\" ' |
|
44509
4e74c27678ba
Final adjustments for #1601
Christian Heimes <christian@cheimes.de>
parents:
44395
diff
changeset
|
23 '%s %s') |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
24 |
|
44331
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
25 def nmake(makefile, command="", **kw): |
|
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
26 defines = ' '.join(k+'='+v for k, v in kw.items()) |
|
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
27 cmd = NMAKE % (makefile, defines, command) |
|
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
28 print("\n\n"+cmd+"\n") |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
29 if os.system(cmd) != 0: |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
30 raise RuntimeError(cmd) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
31 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
32 def build(platform, clean): |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
33 if platform == "Win32": |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
34 dest = os.path.join(ROOT, "tcltk") |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
35 machine = "X86" |
|
47647
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
36 elif platform == "AMD64": |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
37 dest = os.path.join(ROOT, "tcltk64") |
|
47647
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
38 machine = "AMD64" |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
39 else: |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
40 raise ValueError(platform) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
41 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
42 # TCL |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
43 tcldir = os.path.join(ROOT, TCL) |
|
47650
3017e794bbb9
Revert bogus disabling of Tcl and Tk.
Martin v. Löwis <martin@v.loewis.de>
parents:
47647
diff
changeset
|
44 if 1: |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
45 os.chdir(os.path.join(tcldir, "win")) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
46 if clean: |
|
44331
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
47 nmake("makefile.vc", "clean") |
|
47647
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
48 nmake("makefile.vc", MACHINE=machine) |
|
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
49 nmake("makefile.vc", "install", INSTALLDIR=dest, MACHINE=machine) |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
50 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
51 # TK |
|
47650
3017e794bbb9
Revert bogus disabling of Tcl and Tk.
Martin v. Löwis <martin@v.loewis.de>
parents:
47647
diff
changeset
|
52 if 1: |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
53 os.chdir(os.path.join(ROOT, TK, "win")) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
54 if clean: |
|
51609
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
55 nmake("makefile.vc", "clean", DEBUG=0, TCLDIR=tcldir) |
|
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
56 nmake("makefile.vc", DEBUG=0, MACHINE=machine) |
|
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
57 nmake("makefile.vc", "install", DEBUG=0, INSTALLDIR=dest, MACHINE=machine) |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
58 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
59 # TIX |
|
44331
c0f2cf4389c5
Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
Christian Heimes <christian@cheimes.de>
parents:
44208
diff
changeset
|
60 if 1: |
|
44208
2fce989da021
Several Windows related cleanups:
Christian Heimes <christian@cheimes.de>
parents:
44183
diff
changeset
|
61 # python9.mak is available at http://svn.python.org |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
62 os.chdir(os.path.join(ROOT, TIX, "win")) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
63 if clean: |
|
51609
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
64 nmake("python.mak", "clean") |
|
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
65 nmake("python.mak", MACHINE=machine, INSTALL_DIR=dest) |
|
0590c0b76e64
Update Tix build procedure.
Martin v. Löwis <martin@v.loewis.de>
parents:
47650
diff
changeset
|
66 nmake("python.mak", "install", INSTALL_DIR=dest) |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
67 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
68 def main(): |
|
47647
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
69 if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "AMD64"): |
|
3d6869e2c92a
Switch to Tcl/Tk 8.5.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
45468
diff
changeset
|
70 print("%s Win32|AMD64" % sys.argv[0]) |
|
44033
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
71 sys.exit(1) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
72 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
73 if "-c" in sys.argv: |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
74 clean = True |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
75 else: |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
76 clean = False |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
77 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
78 build(sys.argv[1], clean) |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
79 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
80 |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
81 if __name__ == '__main__': |
|
ba3056119b28
Backport of changes to PCbuild9 from the py3k branch
Christian Heimes <christian@cheimes.de>
parents:
diff
changeset
|
82 main() |
