1 """Script to compile the dependencies of _tkinter
3 Copyright (c) 2007 by Christian Heimes <christian@cheimes.de>
5 Licensed to PSF under a Contributor Agreement.
11 here
= os
.path
.abspath(os
.path
.dirname(__file__
))
18 ROOT
= os
.path
.abspath(os
.path
.join(here
, par
, par
))
19 # Windows 2000 compatibility: WINVER 0x0500
20 # http://msdn2.microsoft.com/en-us/library/aa383745.aspx
21 NMAKE
= ('nmake /nologo /f %s '
22 'COMPILERFLAGS=\"-DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=NTDDI_WIN2KSP4\" '
25 def nmake(makefile
, command
="", **kw
):
26 defines
= ' '.join(k
+'='+v
for k
, v
in kw
.items())
27 cmd
= NMAKE
% (makefile
, defines
, command
)
28 print("\n\n"+cmd
+"\n")
29 if os
.system(cmd
) != 0:
30 raise RuntimeError(cmd
)
32 def build(platform
, clean
):
33 if platform
== "Win32":
34 dest
= os
.path
.join(ROOT
, "tcltk")
36 elif platform
== "AMD64":
37 dest
= os
.path
.join(ROOT
, "tcltk64")
40 raise ValueError(platform
)
43 tcldir
= os
.path
.join(ROOT
, TCL
)
45 os
.chdir(os
.path
.join(tcldir
, "win"))
47 nmake("makefile.vc", "clean")
48 nmake("makefile.vc", MACHINE
=machine
)
49 nmake("makefile.vc", "install", INSTALLDIR
=dest
, MACHINE
=machine
)
53 os
.chdir(os
.path
.join(ROOT
, TK
, "win"))
55 nmake("makefile.vc", "clean", DEBUG
=0, TCLDIR
=tcldir
)
56 nmake("makefile.vc", DEBUG
=0, MACHINE
=machine
)
57 nmake("makefile.vc", "install", DEBUG
=0, INSTALLDIR
=dest
, MACHINE
=machine
)
61 # python9.mak is available at http://svn.python.org
62 os
.chdir(os
.path
.join(ROOT
, TIX
, "win"))
64 nmake("python.mak", "clean")
65 nmake("python.mak", MACHINE
=machine
, INSTALL_DIR
=dest
)
66 nmake("python.mak", "install", INSTALL_DIR
=dest
)
69 if len(sys
.argv
) < 2 or sys
.argv
[1] not in ("Win32", "AMD64"):
70 print("%s Win32|AMD64" % sys
.argv
[0])
78 build(sys
.argv
[1], clean
)
81 if __name__
== '__main__':