Sunday, January 15, 2023

Re: audio/snack: drop python 2 bindings

On Sun, 15 Jan 2023, Klemens Nanni wrote:

> 12.12.2022 03:04, Daniel Dickman ?????:
> > On Sun, 11 Dec 2022, Klemens Nanni wrote:
> >
> >> On Sat, Dec 03, 2022 at 10:15:16PM +0000, Klemens Nanni wrote:
> >>> On Sat, Dec 03, 2022 at 08:12:59PM +0000, Klemens Nanni wrote:
> >>>> No upstream activity in years, I don't see py3 bits anywhere, so I
> >>>> suggest we retire bindings for the EOL python 2.
> >>>>
> >>>> Merge -main and -python into a single audio/snack package.
> >>>> Tested with
> >>>> # pkg_add py-snack
> >>>> $ make package
> >>>> $ cp /usr/ports/packages/amd64/ftp/snack-2.2.10p7.tgz .
> >>>> $ doas env TRUSTED_PKG_PATH=. pkg_add -u
> >>>> py-snack-2.2.10p2+snack-2.2.10p6->snack-2.2.10p7: ok
> >>>> Read shared items: ok
> >>>>
> >>>> This gets rid of the last lang/python/2.7,-tkinter consumer, which could
> >>>> be removed next.
> >>>>
> >>>> Feedback? Objection? OK?
> >>>
> >>> Now with cvs add'ed files.
> >>
> >> No feedback so far.
> >>
> >> Simpler diff leaving the MULTI_PACKAGES -main bits behind, then -python
> >> can be removed with a quirk.
> >>
> >> OK?
> >>
> >
> > First of all, I think we may want the fix for CVE-2012-6303:
> >
> > https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-tcltk/snack/files/snack-2.2.10-CVE-2012-6303-fix.patch
> >
> > As for python3, perhaps we can use gentoo's diff for this?
> >
> > https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-tcltk/snack/files/tcl-snack-2.2.10-python3.patch
>
> Noone spoke up... anyone interested enough in patching and testing this?
> Otherwise we might as well plug the CVE and just drop python 2 bindings.
>

Does this work for you?


Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/snack/Makefile,v
retrieving revision 1.17
diff -u -p -u -r1.17 Makefile
--- Makefile 11 Mar 2022 18:20:30 -0000 1.17
+++ Makefile 16 Jan 2023 05:49:38 -0000
@@ -7,8 +7,8 @@ PKGNAME-main = snack-${MODPY_EGG_VERSIO
PKGNAME-python = py-snack-${MODPY_EGG_VERSION}
CATEGORIES = audio

-REVISION-main = 6
-REVISION-python =2
+REVISION-main = 7
+REVISION-python = 3

HOMEPAGE = http://www.speech.kth.se/snack
MASTER_SITES = ${HOMEPAGE}/dist/
@@ -25,7 +25,6 @@ LIB_DEPENDS-main = audio/libvorbis
MULTI_PACKAGES = -main -python

MODULES = lang/python x11/tk
-MODPY_VERSION = ${MODPY_DEFAULT_VERSION_2}

BUILD_DEPENDS = ${MODTK_BUILD_DEPENDS}
RUN_DEPENDS-main = ${MODTK_RUN_DEPENDS}
Index: patches/patch-demos_python_MinSect_py
===================================================================
RCS file: patches/patch-demos_python_MinSect_py
diff -N patches/patch-demos_python_MinSect_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_MinSect_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/MinSect.py
+--- demos/python/MinSect.py.orig
++++ demos/python/MinSect.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-demos_python_MinSpeg_py
===================================================================
RCS file: patches/patch-demos_python_MinSpeg_py
diff -N patches/patch-demos_python_MinSpeg_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_MinSpeg_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/MinSpeg.py
+--- demos/python/MinSpeg.py.orig
++++ demos/python/MinSpeg.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-demos_python_MinWave_py
===================================================================
RCS file: patches/patch-demos_python_MinWave_py
diff -N patches/patch-demos_python_MinWave_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_MinWave_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/MinWave.py
+--- demos/python/MinWave.py.orig
++++ demos/python/MinWave.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-demos_python_dataCmd_py
===================================================================
RCS file: patches/patch-demos_python_dataCmd_py
diff -N patches/patch-demos_python_dataCmd_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_dataCmd_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,12 @@
+Index: demos/python/dataCmd.py
+--- demos/python/dataCmd.py.orig
++++ demos/python/dataCmd.py
+@@ -1,7 +1,7 @@
+ #! /usr/bin/env python
+ # -*- coding: iso-8859-1 -*-
+
+-import Tkinter
++import tkinter as Tkinter
+ import tkSnack
+
+ root = Tkinter.Tk()
Index: patches/patch-demos_python_echo_py
===================================================================
RCS file: patches/patch-demos_python_echo_py
diff -N patches/patch-demos_python_echo_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_echo_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/echo.py
+--- demos/python/echo.py.orig
++++ demos/python/echo.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-demos_python_generator_py
===================================================================
RCS file: patches/patch-demos_python_generator_py
diff -N patches/patch-demos_python_generator_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_generator_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/generator.py
+--- demos/python/generator.py.orig
++++ demos/python/generator.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+ """AudioControllerSingleton().playLatency(100)"""
Index: patches/patch-demos_python_mixplay_py
===================================================================
RCS file: patches/patch-demos_python_mixplay_py
diff -N patches/patch-demos_python_mixplay_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_mixplay_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/mixplay.py
+--- demos/python/mixplay.py.orig
++++ demos/python/mixplay.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-demos_python_notescale_py
===================================================================
RCS file: patches/patch-demos_python_notescale_py
diff -N patches/patch-demos_python_notescale_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_notescale_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/notescale.py
+--- demos/python/notescale.py.orig
++++ demos/python/notescale.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+ """AudioControllerSingleton().playLatency(100)"""
Index: patches/patch-demos_python_oggplay_py
===================================================================
RCS file: patches/patch-demos_python_oggplay_py
diff -N patches/patch-demos_python_oggplay_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_oggplay_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,18 @@
+Index: demos/python/oggplay.py
+--- demos/python/oggplay.py.orig
++++ demos/python/oggplay.py
+@@ -6,7 +6,7 @@
+ # by tkSnack
+
+ import sys
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+ initializeSnack(Tkinter.Tk())
+@@ -19,4 +19,4 @@ if sys.argv[1:]:
+ snd = Sound(file=sys.argv[1])
+ snd.play(blocking=1)
+ else:
+- print "Usage: oggplay.py file.ogg"
++ print("Usage: oggplay.py file.ogg")
Index: patches/patch-demos_python_polarspec_py
===================================================================
RCS file: patches/patch-demos_python_polarspec_py
diff -N patches/patch-demos_python_polarspec_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_polarspec_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,16 @@
+Index: demos/python/polarspec.py
+--- demos/python/polarspec.py.orig
++++ demos/python/polarspec.py
+@@ -1,10 +1,10 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+ from math import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+ snd = Sound()
Index: patches/patch-demos_python_spectrogram_py
===================================================================
RCS file: patches/patch-demos_python_spectrogram_py
diff -N patches/patch-demos_python_spectrogram_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_spectrogram_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/spectrogram.py
+--- demos/python/spectrogram.py.orig
++++ demos/python/spectrogram.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+ snd = Sound()
Index: patches/patch-demos_python_sphere_py
===================================================================
RCS file: patches/patch-demos_python_sphere_py
diff -N patches/patch-demos_python_sphere_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_sphere_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,30 @@
+Index: demos/python/sphere.py
+--- demos/python/sphere.py.orig
++++ demos/python/sphere.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
+@@ -15,11 +15,11 @@ snd = Sound()
+
+ file = 'test.sph'
+
+-print 'reading sphere file \'%s\'' % file
++print('reading sphere file \'%s\'' % file)
+ snd.read(file)
+
+-print 'playing file \'%s\'' % file
++print('playing file \'%s\'' % file)
+ snd.play(blocking=1)
+
+-print 'writing wav file \'%s\'' % file
++print('writing wav file \'%s\'' % file)
+ snd.write('new.wav')
Index: patches/patch-demos_python_tkSnack_py
===================================================================
RCS file: patches/patch-demos_python_tkSnack_py
diff -N patches/patch-demos_python_tkSnack_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_tkSnack_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,61 @@
+Index: demos/python/tkSnack.py
+--- demos/python/tkSnack.py.orig
++++ demos/python/tkSnack.py
+@@ -7,8 +7,9 @@ by Kevin Russell and Kare Sjolander
+ last modified: Mar 28, 2003
+ """
+
+-import Tkinter
+-import types
++from __future__ import print_function
++
++import tkinter as Tkinter
+ import string
+
+ Tkroot = None
+@@ -20,7 +21,6 @@ def initializeSnack(newroot):
+ Tkroot = newroot
+ Tkroot.tk.call('eval', 'package require snack')
+ Tkroot.tk.call('snack::createIcons')
+- Tkroot.tk.call('snack::setUseOldObjAPI')
+ audio = AudioControllerSingleton()
+ mixer = MixerControllerSingleton()
+
+@@ -92,7 +92,7 @@ class TkObject:
+ self.tk.call(self.name, 'configure')):
+ cnf[x[0][1:]] = (x[0][1:],) + x[1:]
+ return cnf
+- if type(cnf) is types.StringType:
++ if isinstance(cnf, str):
+ x = self.tk.split(self.tk.call(self.name, 'configure', '-'+cnf))
+ return (x[0][1:],) + x[1:]
+ self.tk.call((self.name, 'configure') + self._options(cnf))
+@@ -124,8 +124,7 @@ class Sound (TkObject):
+ if Tkroot:
+ master = Tkroot
+ else:
+- raise RuntimeError, \
+- 'Tk not intialized or not registered with Snack'
++ raise RuntimeError('Tk not intialized or not registered with Snack')
+ self.tk = master.tk
+ if not name:
+ self.name = self.tk.call(('sound',) + self._options(kw))
+@@ -409,8 +408,7 @@ class Filter(TkObject):
+ if Tkroot:
+ master = Tkroot
+ else:
+- raise RuntimeError, \
+- 'Tk not intialized or not registered with Snack'
++ raise RuntimeError('Tk not intialized or not registered with Snack')
+ self.tk = master.tk
+ self.name = self.tk.call(('snack::filter', name) + args +
+ self._options(kw))
+@@ -537,7 +535,7 @@ class SoundFrame(Tkinter.Frame):
+ self.sound.record()
+
+ def info(self):
+- print self.sound.info()
++ print(self.sound.info())
+
+ def createSpectrogram(canvas, *args, **kw):
+ """Draws a spectrogram of a sound on canvas."""
Index: patches/patch-demos_python_widget_py
===================================================================
RCS file: patches/patch-demos_python_widget_py
diff -N patches/patch-demos_python_widget_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-demos_python_widget_py 16 Jan 2023 05:49:38 -0000
@@ -0,0 +1,15 @@
+Index: demos/python/widget.py
+--- demos/python/widget.py.orig
++++ demos/python/widget.py
+@@ -1,9 +1,9 @@
+ #! /usr/bin/env python
+
+-from Tkinter import *
++from tkinter import *
+ from tkSnack import *
+
+-root = Tkinter.Tk()
++root = Tk()
+
+ initializeSnack(root)
+
Index: patches/patch-generic_jkAudIO_h
===================================================================
RCS file: /cvs/ports/audio/snack/patches/patch-generic_jkAudIO_h,v
retrieving revision 1.2
diff -u -p -u -r1.2 patch-generic_jkAudIO_h
--- patches/patch-generic_jkAudIO_h 11 Mar 2022 18:20:31 -0000 1.2
+++ patches/patch-generic_jkAudIO_h 16 Jan 2023 05:49:38 -0000
@@ -1,7 +1,8 @@
sndio bits

---- generic/jkAudIO.h.orig Wed Dec 14 03:29:38 2005
-+++ generic/jkAudIO.h Fri Dec 24 23:19:22 2010
+Index: generic/jkAudIO.h
+--- generic/jkAudIO.h.orig
++++ generic/jkAudIO.h
@@ -105,6 +105,10 @@ extern "C" {
#include <alsa/asoundlib.h>

No comments:

Post a Comment