mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Patch #660485: Cygwin _tkinter Tcl/Tk 8.3 patch
The attached patch enables Cygwin Python to build cleanly against the latest Cygwin Tcl/Tk which is based on Tcl/Tk 8.3. It also prevents building against the real X headers, if installed.
This commit is contained in:
parent
8f1f8f13e4
commit
bbe8961698
2 changed files with 19 additions and 13 deletions
|
@ -57,9 +57,10 @@ Copyright (C) 1994 Steen Lumholt.
|
||||||
#include <tk.h>
|
#include <tk.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For Tcl 8.2 and 8.3, CONST* is not defined. */
|
/* For Tcl 8.2 and 8.3, CONST* is not defined (except on Cygwin). */
|
||||||
#ifndef CONST84_RETURN
|
#ifndef CONST84_RETURN
|
||||||
#define CONST84_RETURN
|
#define CONST84_RETURN
|
||||||
|
#undef CONST
|
||||||
#define CONST
|
#define CONST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -752,7 +753,7 @@ statichere PyTypeObject PyTclObject_Type = {
|
||||||
0, /*tp_hash*/
|
0, /*tp_hash*/
|
||||||
0, /*tp_call*/
|
0, /*tp_call*/
|
||||||
(reprfunc)PyTclObject_str, /*tp_str*/
|
(reprfunc)PyTclObject_str, /*tp_str*/
|
||||||
PyObject_GenericGetAttr,/*tp_getattro*/
|
0, /*tp_getattro*/
|
||||||
0, /*tp_setattro*/
|
0, /*tp_setattro*/
|
||||||
0, /*tp_as_buffer*/
|
0, /*tp_as_buffer*/
|
||||||
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
||||||
|
@ -2838,6 +2839,7 @@ init_tkinter(void)
|
||||||
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
|
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
|
||||||
|
|
||||||
PyTclObject_Type.ob_type = &PyType_Type;
|
PyTclObject_Type.ob_type = &PyType_Type;
|
||||||
|
PyTclObject_Type.tp_getattro = &PyObject_GenericGetAttr;
|
||||||
PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
|
PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
|
||||||
|
|
||||||
#ifdef TK_AQUA
|
#ifdef TK_AQUA
|
||||||
|
|
26
setup.py
26
setup.py
|
@ -887,6 +887,12 @@ class PyBuildExt(build_ext):
|
||||||
self.detect_tkinter_darwin(inc_dirs, lib_dirs):
|
self.detect_tkinter_darwin(inc_dirs, lib_dirs):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Set platform specific library prefix, if any
|
||||||
|
if platform == 'cygwin':
|
||||||
|
lib_prefix = 'cyg'
|
||||||
|
else:
|
||||||
|
lib_prefix = ''
|
||||||
|
|
||||||
# Assume we haven't found any of the libraries or include files
|
# Assume we haven't found any of the libraries or include files
|
||||||
# The versions with dots are used on Unix, and the versions without
|
# The versions with dots are used on Unix, and the versions without
|
||||||
# dots on Windows, for detection by cygwin.
|
# dots on Windows, for detection by cygwin.
|
||||||
|
@ -894,9 +900,9 @@ class PyBuildExt(build_ext):
|
||||||
for version in ['8.4', '84', '8.3', '83', '8.2',
|
for version in ['8.4', '84', '8.3', '83', '8.2',
|
||||||
'82', '8.1', '81', '8.0', '80']:
|
'82', '8.1', '81', '8.0', '80']:
|
||||||
tklib = self.compiler.find_library_file(lib_dirs,
|
tklib = self.compiler.find_library_file(lib_dirs,
|
||||||
'tk' + version )
|
lib_prefix + 'tk' + version)
|
||||||
tcllib = self.compiler.find_library_file(lib_dirs,
|
tcllib = self.compiler.find_library_file(lib_dirs,
|
||||||
'tcl' + version )
|
lib_prefix + 'tcl' + version)
|
||||||
if tklib and tcllib:
|
if tklib and tcllib:
|
||||||
# Exit the loop when we've found the Tcl/Tk libraries
|
# Exit the loop when we've found the Tcl/Tk libraries
|
||||||
break
|
break
|
||||||
|
@ -927,6 +933,11 @@ class PyBuildExt(build_ext):
|
||||||
if platform == 'sunos5':
|
if platform == 'sunos5':
|
||||||
include_dirs.append('/usr/openwin/include')
|
include_dirs.append('/usr/openwin/include')
|
||||||
added_lib_dirs.append('/usr/openwin/lib')
|
added_lib_dirs.append('/usr/openwin/lib')
|
||||||
|
elif platform == 'cygwin':
|
||||||
|
# Verify that the pseudo-X headers are installed before proceeding
|
||||||
|
x11_inc = find_file('X11/Xlib.h', [], inc_dirs)
|
||||||
|
if x11_inc is None:
|
||||||
|
return
|
||||||
elif os.path.exists('/usr/X11R6/include'):
|
elif os.path.exists('/usr/X11R6/include'):
|
||||||
include_dirs.append('/usr/X11R6/include')
|
include_dirs.append('/usr/X11R6/include')
|
||||||
added_lib_dirs.append('/usr/X11R6/lib')
|
added_lib_dirs.append('/usr/X11R6/lib')
|
||||||
|
@ -938,13 +949,6 @@ class PyBuildExt(build_ext):
|
||||||
include_dirs.append('/usr/X11/include')
|
include_dirs.append('/usr/X11/include')
|
||||||
added_lib_dirs.append('/usr/X11/lib')
|
added_lib_dirs.append('/usr/X11/lib')
|
||||||
|
|
||||||
# If Cygwin, then verify that X is installed before proceeding
|
|
||||||
if platform == 'cygwin':
|
|
||||||
x11_inc = find_file('X11/Xlib.h', [], inc_dirs)
|
|
||||||
if x11_inc is None:
|
|
||||||
# X header files missing, so give up
|
|
||||||
return
|
|
||||||
|
|
||||||
# Check for BLT extension
|
# Check for BLT extension
|
||||||
if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
|
if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
|
||||||
'BLT8.0'):
|
'BLT8.0'):
|
||||||
|
@ -956,8 +960,8 @@ class PyBuildExt(build_ext):
|
||||||
libs.append('BLT')
|
libs.append('BLT')
|
||||||
|
|
||||||
# Add the Tcl/Tk libraries
|
# Add the Tcl/Tk libraries
|
||||||
libs.append('tk'+version)
|
libs.append(lib_prefix + 'tk'+ version)
|
||||||
libs.append('tcl'+version)
|
libs.append(lib_prefix + 'tcl'+ version)
|
||||||
|
|
||||||
if platform in ['aix3', 'aix4']:
|
if platform in ['aix3', 'aix4']:
|
||||||
libs.append('ld')
|
libs.append('ld')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue