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.
12 here
= os
.path
.abspath(os
.path
.dirname(__file__
))
24 ROOT
= os
.path
.abspath(os
.path
.join(here
, par
, par
))
25 # Windows 2000 compatibility: WINVER 0x0500
26 # http://msdn2.microsoft.com/en-us/library/aa383745.aspx
27 NMAKE
= ('nmake /nologo /f %s '
28 'COMPILERFLAGS=\"-DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=NTDDI_WIN2KSP4\" '
31 def nmake(makefile
, command
="", **kw
):
32 defines
= ' '.join(k
+'='+v
for k
, v
in kw
.items())
33 cmd
= NMAKE
% (makefile
, defines
, command
)
34 print("\n\n"+cmd
+"\n")
35 if os
.system(cmd
) != 0:
36 raise RuntimeError(cmd
)
38 def build(platform
, clean
):
39 if platform
== "Win32":
40 dest
= os
.path
.join(ROOT
, "tcltk")
42 elif platform
== "x64":
43 dest
= os
.path
.join(ROOT
, "tcltk64")
46 raise ValueError(platform
)
49 tcldir
= os
.path
.join(ROOT
, TCL
)
51 os
.chdir(os
.path
.join(tcldir
, "win"))
53 nmake("makefile.vc", "clean")
55 nmake("makefile.vc", "install", INSTALLDIR
=dest
)
59 os
.chdir(os
.path
.join(ROOT
, TK
, "win"))
61 nmake("makefile.vc", "clean", TCLDIR
=tcldir
)
62 nmake("makefile.vc", TCLDIR
=tcldir
)
63 nmake("makefile.vc", "install", TCLDIR
=tcldir
, INSTALLDIR
=dest
)
67 # python9.mak is available at http://svn.python.org
68 os
.chdir(os
.path
.join(ROOT
, TIX
, "win"))
70 nmake("python9.mak", "clean")
71 nmake("python9.mak", MACHINE
=machine
)
72 nmake("python9.mak", "install")
75 if len(sys
.argv
) < 2 or sys
.argv
[1] not in ("Win32", "x64"):
76 print("%s Win32|x64" % sys
.argv
[0])
84 build(sys
.argv
[1], clean
)
87 if __name__
== '__main__':