Re: Python Tkinter 8.6

2022-06-08 Thread Kurt Mosiejczuk
On Wed, Jun 08, 2022 at 05:01:55PM +0100, Stuart Henderson wrote:
> On 2022/06/08 11:36, Stuart Cassoff wrote:
> > Just checked: ok on amd64, PLIST problem on i386.

> ah ok, so in that case nothing changed with respect to those.
> phew, I didn't fancy debugging that. I propose to either just
> ignore that, or maybe add an rm -f, i386 coped without them
> so far and it doesn't make much sense to poke too much at a
> dead python version.

> i've regen'd the diff against -current after I fixed the 3.10
> tests problem, i tweaked to remove the BUILD_PKGPATH bit, and
> just bumped the relevant subpackages rather than everything.
> this one is ok sthen@

This looks good.

ok kmos

--Kurt

> Index: Makefile.inc
> ===
> RCS file: /cvs/ports/lang/python/Makefile.inc,v
> retrieving revision 1.147
> diff -u -p -r1.147 Makefile.inc
> --- Makefile.inc  26 May 2022 15:13:55 -  1.147
> +++ Makefile.inc  8 Jun 2022 15:52:24 -
> @@ -8,7 +8,7 @@ COMMENT-bsddb =   Berkeley db module for P
>  COMMENT-gdbm =   GNU dbm module for Python
>  COMMENT-idle =   IDE for Python
>  COMMENT-tests =  Python test suite
> -COMMENT-tkinter = tk GUI module for Python
> +COMMENT-tkinter = Python interface to the Tk graphical toolkit
>  COMMENT-tools =  extra tools for Python
>  
>  VERSION =${FULL_VERSION:R}
> @@ -95,11 +95,16 @@ RUN_DEPENDS-idle =lang/python/${VERSION
>  WANTLIB-idle =
>  
>  MODULES +=   x11/tk
> -# Tcl/Tk version needs to be in sync with patch-setup_py's one
> +
> +.if ${VERSION} == "2.7"
>  MODTK_VERSION =  8.5
> +.else
> +MODTK_VERSION =  8.6
> +.endif
> +
>  LIB_DEPENDS-tkinter =lang/python/${VERSION},-main \
>   ${MODTK_LIB_DEPENDS}
> -WANTLIB-tkinter =X11 pthread python${VERSION} \
> +WANTLIB-tkinter =pthread python${VERSION} \
>   ${MODTK_WANTLIB}
>  
>  AUTOCONF_VERSION =   2.69
> @@ -110,7 +115,10 @@ CONFIGURE_ARGS +=--with-fpectl \
>   --with-threads \
>   --enable-ipv6 \
>   --with-system-expat \
> - --with-system-ffi
> + --with-system-ffi \
> + --with-tcltk-includes='-I${MODTCL_INCDIR} 
> -I${MODTK_INCDIR} -I${X11BASE}/include' \
> + --with-tcltk-libs='-L${X11BASE}/lib -l${MODTCL_LIB} 
> -l${MODTK_LIB}'
> +
>  .if ${VERSION} != "2.7"
>  CONFIGURE_ARGS +=--enable-loadable-sqlite-extensions
>  .  if ${PROPERTIES:Mlld}
> Index: 2.7/Makefile
> ===
> RCS file: /cvs/ports/lang/python/2.7/Makefile,v
> retrieving revision 1.76
> diff -u -p -r1.76 Makefile
> --- 2.7/Makefile  28 Mar 2022 15:48:24 -  1.76
> +++ 2.7/Makefile  8 Jun 2022 15:52:24 -
> @@ -8,12 +8,12 @@ SHARED_LIBS =   python2.7 0.0
>  VERSION_SPEC =   >=2.7,<2.8
>  PORTROACH =  limit:^2\.7
>  
> -REVISION-main =  7
> +REVISION-main =  8
>  REVISION-idle =  1
>  REVISION-tests = 1
>  REVISION-bsddb = 0
>  REVISION-gdbm =  0
> -REVISION-tkinter =   0
> +REVISION-tkinter =   1
>  REVISION-tools = 0
>  
>  CONFIGURE_ARGS +=--with-ensurepip=no
> Index: 2.7/patches/patch-setup_py
> ===
> RCS file: /cvs/ports/lang/python/2.7/patches/patch-setup_py,v
> retrieving revision 1.16
> diff -u -p -r1.16 patch-setup_py
> --- 2.7/patches/patch-setup_py11 Mar 2022 19:29:11 -  1.16
> +++ 2.7/patches/patch-setup_py8 Jun 2022 15:52:24 -
> @@ -84,17 +84,7 @@ Index: setup.py
>   frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
>   
>   # All existing framework builds of Tcl/Tk don't support 64-bit
> -@@ -1936,8 +1946,7 @@ class PyBuildExt(build_ext):
> - # The versions with dots are used on Unix, and the versions without
> - # dots on Windows, for detection by cygwin.
> - tcllib = tklib = tcl_includes = tk_includes = None
> --for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
> --'8.2', '82', '8.1', '81', '8.0', '80']:
> -+for version in ['85']:
> - tklib = self.compiler.find_library_file(lib_dirs,
> - 'tk' + version)
> - tcllib = self.compiler.find_library_file(lib_dirs,
> -@@ -1980,17 +1989,9 @@ class PyBuildExt(build_ext):
> +@@ -1980,17 +1990,9 @@ class PyBuildExt(build_ext):
>   if host_platform == 'sunos5':
>   include_dirs.append('/usr/openwin/include')
>   added_lib_dirs.append('/usr/openwin/lib')
> Index: 2.7/pkg/DESCR-tkinter
> ===
> RCS file: 

Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Henderson
On 2022/06/08 11:36, Stuart Cassoff wrote:
> Just checked: ok on amd64, PLIST problem on i386.

ah ok, so in that case nothing changed with respect to those.
phew, I didn't fancy debugging that. I propose to either just
ignore that, or maybe add an rm -f, i386 coped without them
so far and it doesn't make much sense to poke too much at a
dead python version.

i've regen'd the diff against -current after I fixed the 3.10
tests problem, i tweaked to remove the BUILD_PKGPATH bit, and
just bumped the relevant subpackages rather than everything.
this one is ok sthen@



Index: Makefile.inc
===
RCS file: /cvs/ports/lang/python/Makefile.inc,v
retrieving revision 1.147
diff -u -p -r1.147 Makefile.inc
--- Makefile.inc26 May 2022 15:13:55 -  1.147
+++ Makefile.inc8 Jun 2022 15:52:24 -
@@ -8,7 +8,7 @@ COMMENT-bsddb = Berkeley db module for P
 COMMENT-gdbm = GNU dbm module for Python
 COMMENT-idle = IDE for Python
 COMMENT-tests =Python test suite
-COMMENT-tkinter = tk GUI module for Python
+COMMENT-tkinter = Python interface to the Tk graphical toolkit
 COMMENT-tools =extra tools for Python
 
 VERSION =  ${FULL_VERSION:R}
@@ -95,11 +95,16 @@ RUN_DEPENDS-idle =  lang/python/${VERSION
 WANTLIB-idle =
 
 MODULES += x11/tk
-# Tcl/Tk version needs to be in sync with patch-setup_py's one
+
+.if ${VERSION} == "2.7"
 MODTK_VERSION =8.5
+.else
+MODTK_VERSION =8.6
+.endif
+
 LIB_DEPENDS-tkinter =  lang/python/${VERSION},-main \
${MODTK_LIB_DEPENDS}
-WANTLIB-tkinter =  X11 pthread python${VERSION} \
+WANTLIB-tkinter =  pthread python${VERSION} \
${MODTK_WANTLIB}
 
 AUTOCONF_VERSION = 2.69
@@ -110,7 +115,10 @@ CONFIGURE_ARGS +=  --with-fpectl \
--with-threads \
--enable-ipv6 \
--with-system-expat \
-   --with-system-ffi
+   --with-system-ffi \
+   --with-tcltk-includes='-I${MODTCL_INCDIR} 
-I${MODTK_INCDIR} -I${X11BASE}/include' \
+   --with-tcltk-libs='-L${X11BASE}/lib -l${MODTCL_LIB} 
-l${MODTK_LIB}'
+
 .if ${VERSION} != "2.7"
 CONFIGURE_ARGS +=  --enable-loadable-sqlite-extensions
 .  if ${PROPERTIES:Mlld}
Index: 2.7/Makefile
===
RCS file: /cvs/ports/lang/python/2.7/Makefile,v
retrieving revision 1.76
diff -u -p -r1.76 Makefile
--- 2.7/Makefile28 Mar 2022 15:48:24 -  1.76
+++ 2.7/Makefile8 Jun 2022 15:52:24 -
@@ -8,12 +8,12 @@ SHARED_LIBS = python2.7 0.0
 VERSION_SPEC = >=2.7,<2.8
 PORTROACH =limit:^2\.7
 
-REVISION-main =7
+REVISION-main =8
 REVISION-idle =1
 REVISION-tests =   1
 REVISION-bsddb =   0
 REVISION-gdbm =0
-REVISION-tkinter = 0
+REVISION-tkinter = 1
 REVISION-tools =   0
 
 CONFIGURE_ARGS +=  --with-ensurepip=no
Index: 2.7/patches/patch-setup_py
===
RCS file: /cvs/ports/lang/python/2.7/patches/patch-setup_py,v
retrieving revision 1.16
diff -u -p -r1.16 patch-setup_py
--- 2.7/patches/patch-setup_py  11 Mar 2022 19:29:11 -  1.16
+++ 2.7/patches/patch-setup_py  8 Jun 2022 15:52:24 -
@@ -84,17 +84,7 @@ Index: setup.py
  frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
  
  # All existing framework builds of Tcl/Tk don't support 64-bit
-@@ -1936,8 +1946,7 @@ class PyBuildExt(build_ext):
- # The versions with dots are used on Unix, and the versions without
- # dots on Windows, for detection by cygwin.
- tcllib = tklib = tcl_includes = tk_includes = None
--for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
--'8.2', '82', '8.1', '81', '8.0', '80']:
-+for version in ['85']:
- tklib = self.compiler.find_library_file(lib_dirs,
- 'tk' + version)
- tcllib = self.compiler.find_library_file(lib_dirs,
-@@ -1980,17 +1989,9 @@ class PyBuildExt(build_ext):
+@@ -1980,17 +1990,9 @@ class PyBuildExt(build_ext):
  if host_platform == 'sunos5':
  include_dirs.append('/usr/openwin/include')
  added_lib_dirs.append('/usr/openwin/lib')
Index: 2.7/pkg/DESCR-tkinter
===
RCS file: /cvs/ports/lang/python/2.7/pkg/DESCR-tkinter,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 DESCR-tkinter
--- 2.7/pkg/DESCR-tkinter   24 Apr 2011 09:31:46 -  1.1.1.1
+++ 2.7/pkg/DESCR-tkinter   8 Jun 2022 15:52:24 -
@@ -11,5 +11,5 @@ in C or C++.  On most systems such modul
 Python is also adaptable as an extension language 

Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Cassoff

   -- Original Message --
   From: s...@spacehopper.org
   To: 3...@bell.net
Cc: ports@openbsd.org; k...@openbsd.org
   Sent: Wednesday, June 8, 2022 11:05 AM
   Subject: Re: Python Tkinter 8.6

 On 2022/06/08 10:55, Stuart Cassoff wrote:
 >  >
 >  > Not me, the port did - I swear!
 >  > $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
 >  > Should yield the same result for porters who are not me.
 >  > Those .so's aren't part of TkInter.
 >
 >  Yet the change to tkinter caused them to build. So if there _was_ a
 >  no_tkinter PSEUDO_FLAVOR then packaging -main would fail if the
 >  CONFIGURE_ARGS was not used. But then the question is why they're
 >  now built.
 >
 >  So the change for tkinter is causing something deeply strange with
 >  platform detection, we really need to figure out what's going on 
with

 >  that
 >
 >
 > That is the result obtained with -current Python 2.7 without my 
changes.

 >
 >
 > $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
 >
 > Not
 >
 > $ cd /usr/ports/mystuff/lang/python/2.7; make fake; make 
update-plist

 >
 >
 > Stu

 Oh! Are you not on a 64-bit arch then?


Just checked: ok on amd64, PLIST problem on i386.


Stu




Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Cassoff

 >
 > Not me, the port did - I swear!
 > $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
 > Should yield the same result for porters who are not me.
 > Those .so's aren't part of TkInter.

 Yet the change to tkinter caused them to build. So if there _was_ a
 no_tkinter PSEUDO_FLAVOR then packaging -main would fail if the
 CONFIGURE_ARGS was not used. But then the question is why they're
 now built.

 So the change for tkinter is causing something deeply strange with
 platform detection, we really need to figure out what's going on with
 that


That is the result obtained with -current Python 2.7 without my changes.


$ cd /usr/ports/lang/python/2.7; make fake; make update-plist

Not

$ cd /usr/ports/mystuff/lang/python/2.7; make fake; make update-plist


Stu



Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Henderson
On 2022/06/08 10:55, Stuart Cassoff wrote:
>  >
>  > Not me, the port did - I swear!
>  > $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
>  > Should yield the same result for porters who are not me.
>  > Those .so's aren't part of TkInter.
> 
>  Yet the change to tkinter caused them to build. So if there _was_ a
>  no_tkinter PSEUDO_FLAVOR then packaging -main would fail if the
>  CONFIGURE_ARGS was not used. But then the question is why they're
>  now built.
> 
>  So the change for tkinter is causing something deeply strange with
>  platform detection, we really need to figure out what's going on with
>  that
> 
> 
> That is the result obtained with -current Python 2.7 without my changes.
> 
> 
> $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
> 
> Not
> 
> $ cd /usr/ports/mystuff/lang/python/2.7; make fake; make update-plist
> 
> 
> Stu

Oh! Are you not on a 64-bit arch then?



Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Henderson
>  > ${BUILD_PACKAGES:M-tkinter} ?
> 
>  do you mean LIB_DEPENDS-tkinter, WANTLIB-tkinter, etc? if so, no, these
>  should be set unconditionally
> 
> I simplified this bit, no worries. Nicer, even.

oh, actually BUILD_PACKAGES:M-tkinter makes no sense here as there
is no no_tkinter PSEUDO_FLAVOR..

>  any more info on that?
> 
> # pkg_add python-3.10.4.p1 ; pkg_delete python-3.10.4.p1
> ...
> Error deleting directory /usr/local/lib/python3.10: Directory not empty

This is because there are files in PLIST-main in 3.10 with no parent
directory. However they are duplicate files as they are also in PLIST-tests
so should be removed from main. I'll fix that separately

>  >  @so lib/python2.7/lib-dynload/datetime.so
>  >  @so lib/python2.7/lib-dynload/dbm.so
>  > +@so lib/python2.7/lib-dynload/dl.so
>  >  @so lib/python2.7/lib-dynload/fcntl.so
>  >  @so lib/python2.7/lib-dynload/future_builtins.so
>  >  @so lib/python2.7/lib-dynload/grp.so
>  > +@so lib/python2.7/lib-dynload/imageop.so
>  >  @so lib/python2.7/lib-dynload/itertools.so
>  >  @so lib/python2.7/lib-dynload/math.so
>  >  @so lib/python2.7/lib-dynload/mmap.so
> 
>  you added those to PLIST-main, shouldn't they be in PLIST-tkinter?
> 
> Not me, the port did - I swear!
> $ cd /usr/ports/lang/python/2.7; make fake; make update-plist
> Should yield the same result for porters who are not me.
> Those .so's aren't part of TkInter.

Yet the change to tkinter caused them to build. So if there _was_ a
no_tkinter PSEUDO_FLAVOR then packaging -main would fail if the
CONFIGURE_ARGS was not used. But then the question is why they're
now built.

However imageop is meant to be disabled on 64-bit anyway!

# Disabled on 64-bit platforms
if sys.maxsize != 9223372036854775807L:
# Operations on images
exts.append( Extension('imageop', ['imageop.c']) )
else:
missing.extend(['imageop'])

And dl is meant to be disabled unless sizeof(int) == sizeof(long) ==
sizeof(char*)

So the change for tkinter is causing something deeply strange with
platform detection, we really need to figure out what's going on with
that



Re: Python Tkinter 8.6

2022-06-08 Thread Stuart Cassoff

   -- Original Message --
   From: s...@spacehopper.org
   To: 3...@bell.net
Cc: ports@openbsd.org; k...@openbsd.org
   Sent: Tuesday, June 7, 2022 10:50 AM
   Subject: Re: Python Tkinter 8.6


Thanks for taking a look, I have a new patch!


 On 2022/06/07 09:05, Stuart Cassoff wrote:
 > Does it make sense to put all the TkInter bits inside .if
 > ${BUILD_PACKAGES:M-tkinter} ?

 do you mean LIB_DEPENDS-tkinter, WANTLIB-tkinter, etc? if so, no, 
these

 should be set unconditionally

I simplified this bit, no worries. Nicer, even.


 > Are the changes to CHANGES.OpenBSD ok/necessary?

 changes patching the build files should be added, if it's just 
CONFIGURE_ARGS
 etc then I think not. I don't see a patch to match what you added to 
this?


I wasn't sure and erred on the side of caution.


 > I also noticed that Python 3.10 doesn't uninstall cleanly.

 any more info on that?

# pkg_add python-3.10.4.p1 ; pkg_delete python-3.10.4.p1
...
Error deleting directory /usr/local/lib/python3.10: Directory not empty


 >  @so lib/python2.7/lib-dynload/datetime.so
 >  @so lib/python2.7/lib-dynload/dbm.so
 > +@so lib/python2.7/lib-dynload/dl.so
 >  @so lib/python2.7/lib-dynload/fcntl.so
 >  @so lib/python2.7/lib-dynload/future_builtins.so
 >  @so lib/python2.7/lib-dynload/grp.so
 > +@so lib/python2.7/lib-dynload/imageop.so
 >  @so lib/python2.7/lib-dynload/itertools.so
 >  @so lib/python2.7/lib-dynload/math.so
 >  @so lib/python2.7/lib-dynload/mmap.so

 you added those to PLIST-main, shouldn't they be in PLIST-tkinter?

Not me, the port did - I swear!
$ cd /usr/ports/lang/python/2.7; make fake; make update-plist
Should yield the same result for porters who are not me.
Those .so's aren't part of TkInter.


Stu
(patch also attached)

diff -u -rNp /usr/ports/lang/python/2.7/Makefile ./2.7/Makefile
--- /usr/ports/lang/python/2.7/Makefile Mon Mar 28 11:48:24 2022
+++ ./2.7/Makefile  Sat Jun  4 16:21:38 2022
@@ -8,12 +8,12 @@ SHARED_LIBS = python2.7 0.0
 VERSION_SPEC = >=2.7,<2.8
 PORTROACH =limit:^2\.7

-REVISION-main =7
+REVISION-main =8
 REVISION-idle =1
 REVISION-tests =   1
 REVISION-bsddb =   0
 REVISION-gdbm =0
-REVISION-tkinter = 0
+REVISION-tkinter = 1
 REVISION-tools =   0

 CONFIGURE_ARGS +=  --with-ensurepip=no
diff -u -rNp /usr/ports/lang/python/2.7/patches/patch-setup_py 
./2.7/patches/patch-setup_py
--- /usr/ports/lang/python/2.7/patches/patch-setup_py	Fri Mar 11 
14:29:11 2022

+++ ./2.7/patches/patch-setup_pySat Jun  4 13:54:33 2022
@@ -84,17 +84,7 @@ Index: setup.py
  frameworks = ['-framework', 'Tcl', '-framework', 'Tk']

  # All existing framework builds of Tcl/Tk don't support 
64-bit

-@@ -1936,8 +1946,7 @@ class PyBuildExt(build_ext):
- # The versions with dots are used on Unix, and the versions 
without

- # dots on Windows, for detection by cygwin.
- tcllib = tklib = tcl_includes = tk_includes = None
--for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', 
'83',

--'8.2', '82', '8.1', '81', '8.0', '80']:
-+for version in ['85']:
- tklib = self.compiler.find_library_file(lib_dirs,
- 'tk' + 
version)

- tcllib = self.compiler.find_library_file(lib_dirs,
-@@ -1980,17 +1989,9 @@ class PyBuildExt(build_ext):
+@@ -1980,17 +1990,9 @@ class PyBuildExt(build_ext):
  if host_platform == 'sunos5':
  include_dirs.append('/usr/openwin/include')
  added_lib_dirs.append('/usr/openwin/lib')
diff -u -rNp /usr/ports/lang/python/2.7/pkg/DESCR-tkinter 
./2.7/pkg/DESCR-tkinter
--- /usr/ports/lang/python/2.7/pkg/DESCR-tkinter	Sun Apr 24 05:31:46 
2011

+++ ./2.7/pkg/DESCR-tkinter Wed Jun  8 09:22:52 2022
@@ -11,5 +11,5 @@ in C or C++.  On most systems such modules may be dyna
 Python is also adaptable as an extension language for existing
 applications. See the internal documentation for hints.

-This package contains the Tkinter module, for using the tk toolkit
-in Python.
+This package contains the Tkinter module, a Python interface to the
+Tk graphical toolkit.
diff -u -rNp /usr/ports/lang/python/2.7/pkg/PLIST-main 
./2.7/pkg/PLIST-main

--- /usr/ports/lang/python/2.7/pkg/PLIST-main   Fri Mar 11 14:29:11 2022
+++ ./2.7/pkg/PLIST-mainSat Jun  4 14:05:24 2022
@@ -1593,9 +1593,11 @@ 
lib/python2.7/lib-dynload/Python-${FULL_VERSION}-py2.7

 @so lib/python2.7/lib-dynload/crypt.so
 @so lib/python2.7/lib-dynload/datetime.so
 @so lib/python2.7/lib-dynload/dbm.so
+@so lib/python2.7/lib-dynload/dl.so
 @so lib/python2.7/lib-dynload/fcntl.so
 @so lib/python2.7/lib-dynload/future_builtins.so
 @so lib/python2.7/lib-dynload/grp.so
+@so lib/python2.7/lib-dynload/imageop.so
 @so lib/python2.7/lib-dynload/itertools.so
 @so lib/pyth

Re: Python Tkinter 8.6

2022-06-07 Thread Stuart Henderson
On 2022/06/07 09:05, Stuart Cassoff wrote:
> Does it make sense to put all the TkInter bits inside .if
> ${BUILD_PACKAGES:M-tkinter} ?

do you mean LIB_DEPENDS-tkinter, WANTLIB-tkinter, etc? if so, no, these
should be set unconditionally

> Are the changes to CHANGES.OpenBSD ok/necessary?

changes patching the build files should be added, if it's just CONFIGURE_ARGS
etc then I think not. I don't see a patch to match what you added to this?

> I also noticed that Python 3.10 doesn't uninstall cleanly.

any more info on that?

>  @so lib/python2.7/lib-dynload/datetime.so
>  @so lib/python2.7/lib-dynload/dbm.so
> +@so lib/python2.7/lib-dynload/dl.so
>  @so lib/python2.7/lib-dynload/fcntl.so
>  @so lib/python2.7/lib-dynload/future_builtins.so
>  @so lib/python2.7/lib-dynload/grp.so
> +@so lib/python2.7/lib-dynload/imageop.so
>  @so lib/python2.7/lib-dynload/itertools.so
>  @so lib/python2.7/lib-dynload/math.so
>  @so lib/python2.7/lib-dynload/mmap.so

you added those to PLIST-main, shouldn't they be in PLIST-tkinter?



Python Tkinter 8.6

2022-06-07 Thread Stuart Cassoff
After discussion with maintainer, here's my patch to have TkInter work 
with Tk 8.6.TkInter's setup.py program searches for libs using patterns 
like libtkXX.a

and libtkXX.so, not taking into account OpenBSD's .so versioning.
Since static libs are only built for 8.5, setup.py will find libtk85.a
and configure for 8.5 but will not find libtk8.6.so and fail.
This should be fixed upstream, I guess.
Instead of patching setup.py for the desired Tk version,
simply pass the correct parameters in CONFIGURE_ARGS.
This way, it's easy to select 8.5 or 8.6, and there's
no need to "sync" the setup.py patch and the port Makefile.
I experienced weirdness trying to build TkInter 2.7 against Tk 8.6:
it seems the install script would relink against 8.5?
Anyway, it's probably best to keep TkInter 2.7 with Tk 8.5.
I'm not sure if my patch is completely ok (2.7 PLIST, style of Makefile 
changes).
Does it make sense to put all the TkInter bits inside .if 
${BUILD_PACKAGES:M-tkinter} ?
Are the changes to CHANGES.OpenBSD ok/necessary?When built successfully, 
this or similar incantation should work:
$ echo 'from tkinter import *; print(Tk().tk.eval("info patchlevel")); 
exit' | python3.10

8.6.12
I also noticed that Python 3.10 doesn't uninstall cleanly.
Stu
(patch also attached)

Index: Makefile.inc
===
RCS file: /cvs/ports/lang/python/Makefile.inc,v
retrieving revision 1.147
diff -u -p -u -p -r1.147 Makefile.inc
--- Makefile.inc26 May 2022 15:13:55 -  1.147
+++ Makefile.inc5 Jun 2022 13:11:38 -
@@ -8,7 +8,7 @@ COMMENT-bsddb = Berkeley db module for P
 COMMENT-gdbm = GNU dbm module for Python
 COMMENT-idle = IDE for Python
 COMMENT-tests =Python test suite
-COMMENT-tkinter = tk GUI module for Python
+COMMENT-tkinter = Tk GUI module for Python
 COMMENT-tools =extra tools for Python

 VERSION =  ${FULL_VERSION:R}
@@ -94,12 +94,9 @@ RUN_DEPENDS-idle =   lang/python/${VERSION
${RUN_DEPENDS}
 WANTLIB-idle =

-MODULES += x11/tk
-# Tcl/Tk version needs to be in sync with patch-setup_py's one
-MODTK_VERSION =8.5
 LIB_DEPENDS-tkinter =  lang/python/${VERSION},-main \
${MODTK_LIB_DEPENDS}
-WANTLIB-tkinter =  X11 pthread python${VERSION} \
+WANTLIB-tkinter =  pthread python${VERSION} \
${MODTK_WANTLIB}

 AUTOCONF_VERSION = 2.69
@@ -117,6 +114,19 @@ CONFIGURE_ARGS +=  --enable-loadable-sqli
 CONFIGURE_ARGS +=  --with-lto
 .  endif
 TEST_IS_INTERACTIVE =  Yes
+.endif
+
+.include 
+
+.if ${BUILD_PACKAGES:M-tkinter}
+MODULES += x11/tk
+CONFIGURE_ARGS +=	--with-tcltk-includes='-I${MODTCL_INCDIR} 
-I${MODTK_INCDIR} -I${X11BASE}/include' \

+   --with-tcltk-libs='-L${X11BASE}/lib -l${MODTCL_LIB} 
-l${MODTK_LIB}'
+.  if ${VERSION} == "2.7"
+MODTK_VERSION =8.5
+.  else
+MODTK_VERSION =8.6
+.  endif
 .endif

 CONFIGURE_ENV += OPT='${CFLAGS} -fPIC' 
CPPFLAGS='-I${LOCALBASE}/include' \

Index: 2.7/Makefile
===
RCS file: /cvs/ports/lang/python/2.7/Makefile,v
retrieving revision 1.76
diff -u -p -u -p -r1.76 Makefile
--- 2.7/Makefile28 Mar 2022 15:48:24 -  1.76
+++ 2.7/Makefile5 Jun 2022 13:11:38 -
@@ -8,12 +8,12 @@ SHARED_LIBS = python2.7 0.0
 VERSION_SPEC = >=2.7,<2.8
 PORTROACH =limit:^2\.7

-REVISION-main =7
+REVISION-main =8
 REVISION-idle =1
 REVISION-tests =   1
 REVISION-bsddb =   0
 REVISION-gdbm =0
-REVISION-tkinter = 0
+REVISION-tkinter = 1
 REVISION-tools =   0

 CONFIGURE_ARGS +=  --with-ensurepip=no
Index: 2.7/files/CHANGES.OpenBSD
===
RCS file: /cvs/ports/lang/python/2.7/files/CHANGES.OpenBSD,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 CHANGES.OpenBSD
--- 2.7/files/CHANGES.OpenBSD   11 Mar 2022 19:29:11 -  1.7
+++ 2.7/files/CHANGES.OpenBSD   5 Jun 2022 13:11:38 -
@@ -7,5 +7,8 @@ of changes made to this version of Pytho

 3.  RAND_egd support has been disabled, as it is not available in 
LibreSSL.


+4.  Enable proper building of TkInter against Tcl/Tk 8.5;
+the TkInter configure script doesn't look for OpenBSD-style sonames.
+
 These changes are available in the OpenBSD CVS repository
  in ports/lang/python/2.7.
Index: 2.7/patches/patch-setup_py
===
RCS file: /cvs/ports/lang/python/2.7/patches/patch-setup_py,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 patch-setup_py
--- 2.7/patches/patch-setup_py  11 Mar 2022 19:29:11 -  1.16
+++ 2.7/patches/patch-setup_py  5 Jun 2022 13:11:38 -
@@ -84,17 +84,7 @@ Index: setup.py
  frameworks = ['-framework',