commit:     61ce36d41de01d56f42f4daedf677050ce302a21
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Mon Jun 28 08:45:12 2021 +0000
Commit:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Mon Jun 28 08:47:52 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=61ce36d4

sys-cluster/dlb: statically link tests

Closes: https://bugs.gentoo.org/784698
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>

 .../dlb/{dlb-2.1-r1.ebuild => dlb-2.1-r2.ebuild}   |  28 ++----
 sys-cluster/dlb/files/dlb-2.1-tkinter.patch        | 102 +++++++++++++++++++++
 2 files changed, 111 insertions(+), 19 deletions(-)

diff --git a/sys-cluster/dlb/dlb-2.1-r1.ebuild 
b/sys-cluster/dlb/dlb-2.1-r2.ebuild
similarity index 60%
rename from sys-cluster/dlb/dlb-2.1-r1.ebuild
rename to sys-cluster/dlb/dlb-2.1-r2.ebuild
index b78440590..e9674f7bc 100644
--- a/sys-cluster/dlb/dlb-2.1-r1.ebuild
+++ b/sys-cluster/dlb/dlb-2.1-r2.ebuild
@@ -15,9 +15,10 @@ SRC_URI="https://github.com/bsc-pm/dlb/archive/v${PV}.tar.gz 
-> ${P}.tar.gz"
 LICENSE="LGPL-3"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="hwloc instrumentation mpi openmp test"
 
-IUSE="hwloc instrumentation mpi openmp"
 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
 
 DEPEND="
        hwloc? ( sys-apps/hwloc )
@@ -29,40 +30,28 @@ RDEPEND="
        dev-lang/tk
        $(python_gen_cond_dep 'dev-python/matplotlib[tk,${PYTHON_USEDEP}]')
 "
+BDEPEND="test? ( sys-devel/bc )"
 
-PATCHES=( "${FILESDIR}/${P}-pygen-python3.patch" )
+PATCHES=(
+       "${FILESDIR}/${P}-pygen-python3.patch"
+       "${FILESDIR}/${P}-tkinter.patch"
+)
 
 src_prepare() {
        default
        sed -e "s|chmod +x \$(|chmod +x ${ED}/\$(|g" -i Makefile.am || die
-
-       # Python3 fixes
-       sed -e "s/Tkinter/tkinter/" \
-               -e "s/import ttk/from tkinter import ttk/" \
-               -e "s/import tkMessageBox/from tkinter import messagebox/" \
-               -e "s/tkMessageBox/messagebox/g" \
-               -i scripts/viewer/dlb_cpu_usage.in || die
-
-       sed -e "s/Tkinter/tkinter/" \
-               -e "s/import ttk/from tkinter import ttk/" \
-               -e "s/, NavigationToolbar2TkAgg//" \
-               -e "/FigureCanvasTkAgg$/a from 
matplotlib.backends.backend_qt5agg import NavigationToolbar2QT" \
-               -e "s/NavigationToolbar2TkAgg/NavigationToolbar2QT/g" \
-               -i scripts/viewer/dlb_viewer.py.in || die
-
        sed -e "s|lib/|$(get_libdir)/|" -i scripts/viewer/dlb_wrapper.py || die
-       sed -e "s|Tkinter|tkinter|" -i scripts/viewer/progressmeter.py || die
 
        eautoreconf
 }
 
 src_configure() {
        local myconf=(
-               --disable-static
                --enable-shared
                --with-pic
                $(use_enable instrumentation)
                $(use_enable openmp)
+               $(use_enable test static)
                $(use_with hwloc)
                $(use_with mpi)
        )
@@ -72,4 +61,5 @@ src_configure() {
 src_install() {
        default
        find "${D}" -name '*.la' -delete || die
+       find "${D}" -name '*.a' -delete || die
 }

diff --git a/sys-cluster/dlb/files/dlb-2.1-tkinter.patch 
b/sys-cluster/dlb/files/dlb-2.1-tkinter.patch
new file mode 100644
index 000000000..37f5783d7
--- /dev/null
+++ b/sys-cluster/dlb/files/dlb-2.1-tkinter.patch
@@ -0,0 +1,102 @@
+--- a/scripts/viewer/dlb_cpu_usage.in
++++ b/scripts/viewer/dlb_cpu_usage.in
+@@ -1,8 +1,8 @@
+ #!/usr/bin/env python2
+ 
+-import Tkinter as tk
+-import ttk
+-import tkMessageBox
++import tkinter as tk
++from tkinter import ttk
++from tkinter import messagebox
+ import random
+ 
+ import sys
+@@ -46,7 +46,7 @@
+ 
+     def start(self):
+         if self.viewer.empty():
+-            tkMessageBox.showinfo("Warning", "Add some process before 
starting")
++            messagebox.showinfo("Warning", "Add some process before starting")
+         if self.viewer:
+             self.viewer.start()
+ 
+--- a/scripts/viewer/dlb_viewer.py.in
++++ b/scripts/viewer/dlb_viewer.py.in
+@@ -3,11 +3,12 @@
+ import time
+ from collections import deque
+ # GUI
+-import Tkinter as tk
+-import ttk
++import tkinter as tk
++from tkinter import ttk
+ import progressmeter
+ from matplotlib.figure import Figure, figaspect
+-from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, 
NavigationToolbar2TkAgg
++from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
++from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT
+ #DLB
+ import dlb_wrapper
+ 
+@@ -39,7 +40,7 @@
+         self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
+ 
+         if self.debug:
+-            self.toolbar = NavigationToolbar2TkAgg(self.canvas, self )
++            self.toolbar = NavigationToolbar2QT(self.canvas, self )
+             self.toolbar.pack()
+             self.toolbar.update()
+ 
+--- a/scripts/viewer/progressmeter.py
++++ b/scripts/viewer/progressmeter.py
+@@ -1,10 +1,10 @@
+ #!/usr/bin/env python2
+ 
+ '''Michael Lange <klappnase (at) freakmail (dot) de>
+-The Meter class provides a simple progress bar widget for Tkinter.
++The Meter class provides a simple progress bar widget for tkinter.
+ 
+ INITIALIZATION OPTIONS:
+-The widget accepts all options of a Tkinter.Frame plus the following:
++The widget accepts all options of a tkinter.Frame plus the following:
+ 
+     fillcolor -- the color that is used to indicate the progress of the
+                  corresponding process; default is "orchid1".
+@@ -18,22 +18,22 @@
+     textcolor -- the color to use for the widget's text; default is "black".
+ 
+ WIDGET METHODS:
+-All methods of a Tkinter.Frame can be used; additionally there are two widget 
specific methods:
++All methods of a tkinter.Frame can be used; additionally there are two widget 
specific methods:
+ 
+     get() -- returns a tuple of the form (value, text)
+     set(value, text) -- updates the widget's value and the displayed text;
+                         if value is omitted it defaults to 0.0 , text 
defaults to None .
+ '''
+ 
+-import Tkinter
++import tkinter
+ 
+-class Meter(Tkinter.Frame):
++class Meter(tkinter.Frame):
+     def __init__(self, master, width=300, height=20, bg='white', 
fillcolor='orchid1',\
+                  value=0.0, text=None, font=None, textcolor='black', *args, 
**kw):
+-        Tkinter.Frame.__init__(self, master, bg=bg, width=width, 
height=height, *args, **kw)
++        tkinter.Frame.__init__(self, master, bg=bg, width=width, 
height=height, *args, **kw)
+         self._value = value
+ 
+-        self._canv = Tkinter.Canvas(self, bg=self['bg'], width=self['width'], 
height=self['height'],\
++        self._canv = tkinter.Canvas(self, bg=self['bg'], width=self['width'], 
height=self['height'],\
+                                     highlightthickness=0, relief='flat', bd=0)
+         self._canv.pack(fill='both', expand=1)
+         self._rect = self._canv.create_rectangle(0, 0, 0, 
self._canv.winfo_reqheight(), fill=fillcolor,\
+@@ -84,7 +84,7 @@
+         meter.set(value, 'Demo successfully finished')
+ 
+ if __name__ == '__main__':
+-    root = Tkinter.Tk(className='meter demo')
++    root = tkinter.Tk(className='meter demo')
+     m = Meter(root, relief='ridge', bd=3)
+     m.pack(fill='x')
+     m.set(0.0, 'Starting demo...')

Reply via email to