git: 01d4d932425a - main - x11-toolkits/py-tkinter: fix build with Python 3.12+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Jun 2025 20:40:05 UTC
The branch main has been updated by vishwin:
URL: https://cgit.FreeBSD.org/ports/commit/?id=01d4d932425a82353ce3f6731407b3eb8c3e2069
commit 01d4d932425a82353ce3f6731407b3eb8c3e2069
Author: Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2025-06-16 20:36:55 +0000
Commit: Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2025-06-16 20:36:55 +0000
x11-toolkits/py-tkinter: fix build with Python 3.12+
Certain internal headers are included unconditionally starting with
Python 3.12, but this should have been built with the appropriate
preprocessor macros for internal headers set anyway. Also clean up
some duplicate directory definitions while here.
PR: 286298
Event: Kitchener-Waterloo Hackathon 202506
---
x11-toolkits/py-tkinter/Makefile | 3 ++-
x11-toolkits/py-tkinter/files/setup.py.in | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/x11-toolkits/py-tkinter/Makefile b/x11-toolkits/py-tkinter/Makefile
index 904493a8ddbb..4a859f2467f5 100644
--- a/x11-toolkits/py-tkinter/Makefile
+++ b/x11-toolkits/py-tkinter/Makefile
@@ -16,8 +16,9 @@ LICENSE_FILE= ${WRKDIR}/Python-${DISTVERSION}/LICENSE
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
-USES= compiler:c11 python tar:xz tk:86
+USES= compiler:c11 python tar:xz tk:86 xorg
USE_PYTHON= allflavors autoplist pep517
+USE_XORG= x11
DISTINFO_FILE= ${PORTSDIR}/lang/python${PYTHON_SUFFIX}/distinfo
WRKSRC_SUBDIR= Modules
diff --git a/x11-toolkits/py-tkinter/files/setup.py.in b/x11-toolkits/py-tkinter/files/setup.py.in
index 493bf949a682..fbf905a2e27a 100644
--- a/x11-toolkits/py-tkinter/files/setup.py.in
+++ b/x11-toolkits/py-tkinter/files/setup.py.in
@@ -7,17 +7,18 @@ from setuptools import setup, Extension
tkversion = "%%TK_VER%%"
prefix = sysconfig.get_config_var('prefix')
x11base = sys.prefix or '/usr/X11R6'
-inc_dirs = [prefix + "/include",
+inc_dirs = [sysconfig.get_path('include') + "/internal",
prefix + "/include/tcl" + tkversion,
prefix + "/include/tk" + tkversion,
x11base + "/include"]
-lib_dirs = [prefix + "/lib", x11base + "/lib"]
+lib_dirs = [x11base + "/lib"]
libs = ["tcl" + tkversion.replace(".", ""),
"tk" + tkversion.replace(".", ""),
"X11"]
+macros = [('Py_BUILD_CORE_MODULE', 1), ('WITH_APPINIT', 1)]
setup(ext_modules = [Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
- define_macros=[('WITH_APPINIT', 1)],
+ define_macros=macros,
include_dirs = inc_dirs,
libraries = libs,
library_dirs = lib_dirs)]