git: 7b1e395e9ab8 - main - textproc/py-reverend: Fix build with setuptools 58.0.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 13:51:05 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7b1e395e9ab83e27fcd559a399d8586fb879bdb3

commit 7b1e395e9ab83e27fcd559a399d8586fb879bdb3
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-25 13:34:45 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-25 13:38:23 +0000

    textproc/py-reverend: Fix build with setuptools 58.0.0+
    
    With hat:       python
---
 textproc/py-reverend/files/patch-2to3 | 93 +++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/textproc/py-reverend/files/patch-2to3 b/textproc/py-reverend/files/patch-2to3
new file mode 100644
index 000000000000..6015f1f691ca
--- /dev/null
+++ b/textproc/py-reverend/files/patch-2to3
@@ -0,0 +1,93 @@
+--- reverend/ui/trainer.py.orig	2004-12-01 17:49:04 UTC
++++ reverend/ui/trainer.py
+@@ -4,15 +4,15 @@
+ # License as published by the Free Software Foundation.
+ #
+ 
+-from Tkinter import *
+-import tkFileDialog
+-import tkSimpleDialog
+-import tkMessageBox
++from tkinter import *
++import tkinter.filedialog
++import tkinter.simpledialog
++import tkinter.messagebox
+ 
+ import os
+ 
+-from util import Command, StatusBar, Notebook
+-from tester import TestView
++from .util import Command, StatusBar, Notebook
++from .tester import TestView
+ 
+ class PoolView(Frame):
+     def __init__(self, master=None, guesser=None, app=None):
+@@ -79,20 +79,20 @@ class PoolView(Frame):
+         self.model[name]=(pool, uTok, tTok, train)
+ 
+     def refresh(self):
+-        for pool, ut, tt, train in self.model.values():
++        for pool, ut, tt, train in list(self.model.values()):
+             ut.set(len(pool))
+             tt.set(pool.tokenCount)
+             train.set(pool.trainCount)
+ 
+     def save(self):
+-        path = tkFileDialog.asksaveasfilename()
++        path = tkinter.filedialog.asksaveasfilename()
+         if not path:
+             return
+         self.guesser.save(path)
+         self.app.dirty = False
+ 
+     def load(self):
+-        path = tkFileDialog.askopenfilename()
++        path = tkinter.filedialog.askopenfilename()
+         if not path:
+             return
+         self.guesser.load(path)
+@@ -100,11 +100,11 @@ class PoolView(Frame):
+         self.app.dirty = False
+     
+     def newPool(self):
+-        p = tkSimpleDialog.askstring('Create Pool', 'Name for new pool?')
++        p = tkinter.simpledialog.askstring('Create Pool', 'Name for new pool?')
+         if not p:
+             return
+         if p in self.guesser.pools:
+-            tkMessageBox.showwarning('Bad pool name!', 'Pool %s already exists.' % p)
++            tkinter.messagebox.showwarning('Bad pool name!', 'Pool %s already exists.' % p)
+         self.guesser.newPool(p)
+         self.reload()
+         self.app.poolAdded()
+@@ -193,7 +193,7 @@ class Trainer(Frame):
+ 
+ 
+     def loadCorpus(self):
+-        path = tkFileDialog.askdirectory()
++        path = tkinter.filedialog.askdirectory()
+         if not path:
+             return
+         self.loadFileList(path)
+@@ -203,10 +203,10 @@ class Trainer(Frame):
+     def bulkTest(self):
+         dirs = []
+         for pool in self.guesser.poolNames():
+-            path = tkFileDialog.askdirectory()
++            path = tkinter.filedialog.askdirectory()
+             dirs.append((pool, path))
+         for pool, path in dirs:
+-            print pool, path
++            print(pool, path)
+             
+ 
+     def displayList(self):
+@@ -253,7 +253,7 @@ class Trainer(Frame):
+         
+     def quitNow(self):
+         if self.dirty:
+-            if tkMessageBox.askyesno("You have unsaved changes!", "Quit without saving?"):
++            if tkinter.messagebox.askyesno("You have unsaved changes!", "Quit without saving?"):
+                 self.quit()
+         self.quit()
+