From ce0d5a1f2bf45abd81996e692c55a10c1b7da0ad Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 24 Feb 2022 17:14:15 +0100 Subject: [PATCH 1/2] printrun: update to 2.0.0rc8. --- srcpkgs/printrun/patches/python3.10.patch | 146 ++++++++++++++++++++++ srcpkgs/printrun/template | 17 +-- 2 files changed, 156 insertions(+), 7 deletions(-) create mode 100644 srcpkgs/printrun/patches/python3.10.patch diff --git a/srcpkgs/printrun/patches/python3.10.patch b/srcpkgs/printrun/patches/python3.10.patch new file mode 100644 index 000000000000..34f1cca0400b --- /dev/null +++ b/srcpkgs/printrun/patches/python3.10.patch @@ -0,0 +1,146 @@ +From faade5b9f33779a9b08286498a15eefd0abd13e0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Sat, 13 Nov 2021 17:32:43 +0100 +Subject: [PATCH] Pen, DrawLines and others take integers, fix a TypeError on + Python 3.10+ + +Fedora user report: https://bugzilla.redhat.com/show_bug.cgi?id=2022732 + +Fixes https://github.com/kliment/Printrun/issues/1225 +--- + printrun/gui/graph.py | 8 ++++---- + printrun/gui/xybuttons.py | 2 +- + printrun/gviz.py | 24 ++++++++++++------------ + 3 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/printrun/gui/graph.py b/printrun/gui/graph.py +index 5fba74e9..5f81c3fc 100644 +--- a/printrun/gui/graph.py ++++ b/printrun/gui/graph.py +@@ -147,7 +147,7 @@ def drawgrid(self, dc, gc): + xscale = float(self.width - 1) / (self.xbars - 1) + for x in range(self.xbars + 1): + x = x * xscale +- dc.DrawLine(x, 0, x, self.height) ++ dc.DrawLine(int(x), 0, int(x), self.height) + + # draw horizontal bars + spacing = self._calculate_spacing() # spacing between bars, in degrees +@@ -159,7 +159,7 @@ def drawgrid(self, dc, gc): + # y_pos = y*(float(self.height)/self.ybars) + degrees = y * spacing + y_pos = self._y_pos(degrees) +- dc.DrawLine(0, y_pos, self.width, y_pos) ++ dc.DrawLine(0, int(y_pos), self.width, int(y_pos)) + label = str(y * spacing) + label_y = y_pos - font.GetPointSize() / 2 + self.layoutText(label, 1, label_y, gc) +@@ -219,7 +219,7 @@ def drawtemperature(self, dc, gc, temperature_list, + for temperature in temperature_list: + y_pos = self._y_pos(temperature) + if x_pos > 0: # One need 2 points to draw a line. +- dc.DrawLine(lastxvalue, lastyvalue, x_pos, y_pos) ++ dc.DrawLine(int(lastxvalue), int(lastyvalue), int(x_pos), int(y_pos)) + + lastxvalue = x_pos + x_pos += x_add +@@ -291,7 +291,7 @@ def layoutRectY(self, rc): + + def layoutText(self, text, x, y, gc): + ext = gc.GetTextExtent(text) +- rc = self.layoutRect(wx.Rect(x, y, *ext)) ++ rc = self.layoutRect(wx.Rect(int(x), int(y), int(ext[0]), int(ext[1]))) + # print('layoutText', text, rc.TopLeft) + return rc + +diff --git a/printrun/gui/xybuttons.py b/printrun/gui/xybuttons.py +index 05748860..f66a836c 100644 +--- a/printrun/gui/xybuttons.py ++++ b/printrun/gui/xybuttons.py +@@ -192,7 +192,7 @@ def mouseOverKeypad(self, mpos): + return None + + def drawPartialPie(self, gc, center, r1, r2, angle1, angle2): +- p1 = wx.Point(center.x + r1 * math.cos(angle1), center.y + r1 * math.sin(angle1)) ++ p1 = wx.Point(int(center.x + r1 * math.cos(angle1)), int(center.y + r1 * math.sin(angle1))) + + path = gc.CreatePath() + path.MoveToPoint(p1.x, p1.y) +diff --git a/printrun/gviz.py b/printrun/gviz.py +index ace5a00b..f6eed7e0 100644 +--- a/printrun/gviz.py ++++ b/printrun/gviz.py +@@ -192,7 +192,7 @@ def __init__(self, parent, size = (200, 200), build_dimensions = [200, 200, 100, + self.filament_width = extrusion_width # set it to 0 to disable scaling lines with zoom + self.update_basescale() + self.scale = self.basescale +- penwidth = max(1.0, self.filament_width * ((self.scale[0] + self.scale[1]) / 2.0)) ++ penwidth = max(1, int(self.filament_width * ((self.scale[0] + self.scale[1]) / 2.0))) + self.translate = [0.0, 0.0] + self.mainpen = wx.Pen(wx.Colour(0, 0, 0), penwidth) + self.arcpen = wx.Pen(wx.Colour(255, 0, 0), penwidth) +@@ -292,17 +292,17 @@ def zoom(self, x, y, factor): + + self.translate = [x - (x - self.translate[0]) * factor, + y - (y - self.translate[1]) * factor] +- penwidth = max(1.0, self.filament_width * ((self.scale[0] + self.scale[1]) / 2.0)) ++ penwidth = max(1, int(self.filament_width * ((self.scale[0] + self.scale[1]) / 2.0))) + for pen in self.penslist: + pen.SetWidth(penwidth) + self.dirty = True + wx.CallAfter(self.Refresh) + + def _line_scaler(self, x): +- return (self.scale[0] * x[0], +- self.scale[1] * x[1], +- self.scale[0] * x[2], +- self.scale[1] * x[3],) ++ return (int(self.scale[0] * x[0]), ++ int(self.scale[1] * x[1]), ++ int(self.scale[0] * x[2]), ++ int(self.scale[1] * x[3]),) + + def _arc_scaler(self, x): + return (self.scale[0] * x[0], +@@ -326,7 +326,7 @@ def _drawarcs(self, dc, arcs, pens): + def repaint_everything(self): + width = self.scale[0] * self.build_dimensions[0] + height = self.scale[1] * self.build_dimensions[1] +- self.blitmap = wx.Bitmap(width + 1, height + 1, -1) ++ self.blitmap = wx.Bitmap(int(width) + 1, int(height) + 1, -1) + dc = wx.MemoryDC() + dc.SelectObject(self.blitmap) + dc.SetBackground(wx.Brush((250, 250, 200))) +@@ -336,19 +336,19 @@ def repaint_everything(self): + if grid_unit > 0: + for x in range(int(self.build_dimensions[0] / grid_unit) + 1): + draw_x = self.scale[0] * x * grid_unit +- dc.DrawLine(draw_x, 0, draw_x, height) ++ dc.DrawLine(int(draw_x), 0, int(draw_x), int(height)) + for y in range(int(self.build_dimensions[1] / grid_unit) + 1): + draw_y = self.scale[1] * (self.build_dimensions[1] - y * grid_unit) +- dc.DrawLine(0, draw_y, width, draw_y) ++ dc.DrawLine(0, int(draw_y), int(width), int(draw_y)) + dc.SetPen(wx.Pen(wx.Colour(0, 0, 0))) + + if not self.showall: + # Draw layer gauge + dc.SetBrush(wx.Brush((43, 144, 255))) +- dc.DrawRectangle(width - 15, 0, 15, height) ++ dc.DrawRectangle(int(width) - 15, 0, 15, int(height)) + dc.SetBrush(wx.Brush((0, 255, 0))) + if self.layers: +- dc.DrawRectangle(width - 14, (1.0 - (1.0 * (self.layerindex + 1)) / len(self.layers)) * height, 13, height - 1) ++ dc.DrawRectangle(int(width) - 14, int((1.0 - (1.0 * (self.layerindex + 1)) / len(self.layers)) * height), 13, int(height) - 1) + + if self.showall: + for i in range(len(self.layersz)): +@@ -410,7 +410,7 @@ def paint(self, event): + dc = wx.PaintDC(self) + dc.SetBackground(wx.Brush(self.bgcolor)) + dc.Clear() +- dc.DrawBitmap(self.blitmap, self.translate[0], self.translate[1]) ++ dc.DrawBitmap(self.blitmap, int(self.translate[0]), int(self.translate[1])) + if self.paint_overlay: + self.paint_overlay(dc) + diff --git a/srcpkgs/printrun/template b/srcpkgs/printrun/template index d18d21df3e69..2085c9bd8bb1 100644 --- a/srcpkgs/printrun/template +++ b/srcpkgs/printrun/template @@ -1,20 +1,23 @@ # Template file for 'printrun' pkgname=printrun -version=1.6.0 -revision=4 +version=2.0.0rc8 +revision=1 wrksrc="Printrun-printrun-${version}" -build_style=python2-module -hostmakedepends="python-setuptools python-pyserial" -depends="python wxPython python-pyserial python-pyglet python-numpy" +build_style=python3-module +hostmakedepends="python3-setuptools" +makedepends="python3-devel python3-Cython" +depends="wxPython4 python3-pyserial python3-pyglet python3-numpy + python3-appdirs" short_desc="3D printing host suite" maintainer="Jasper Chan " license="GPL-3.0-or-later" -homepage="http://www.pronterface.com" +homepage="https://www.pronterface.com" distfiles="https://github.com/kliment/Printrun/archive/printrun-${version}.tar.gz" -checksum=fefcb4c5793fc77205a14263bc915616cde0523cd60704f356191b9ae34ba65d +checksum=0f62b88ca6745aeb0d72197a767785cee963a321ea92275620d679b03d040196 post_install() { for file in ${DESTDIR}/usr/bin/*.py; do mv -- "$file" "${file%%.py}" done + vsed -e 's/\.py//' -i ${DESTDIR}/usr/share/applications/*.desktop } From 0ea3bf4afa5a70baec5eaa1227e135c680527d7a Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 24 Feb 2022 17:17:43 +0100 Subject: [PATCH 2/2] python-pyglet: remove package --- srcpkgs/python3-pyglet | 1 - .../template | 21 ++++++------------- .../{python-pyglet => python3-pyglet}/update | 0 3 files changed, 6 insertions(+), 16 deletions(-) delete mode 120000 srcpkgs/python3-pyglet rename srcpkgs/{python-pyglet => python3-pyglet}/template (54%) rename srcpkgs/{python-pyglet => python3-pyglet}/update (100%) diff --git a/srcpkgs/python3-pyglet b/srcpkgs/python3-pyglet deleted file mode 120000 index 0da9a8d712fa..000000000000 --- a/srcpkgs/python3-pyglet +++ /dev/null @@ -1 +0,0 @@ -python-pyglet \ No newline at end of file diff --git a/srcpkgs/python-pyglet/template b/srcpkgs/python3-pyglet/template similarity index 54% rename from srcpkgs/python-pyglet/template rename to srcpkgs/python3-pyglet/template index e5444022ba3e..77713b8e9f66 100644 --- a/srcpkgs/python-pyglet/template +++ b/srcpkgs/python3-pyglet/template @@ -1,12 +1,12 @@ -# Template file for 'python-pyglet' -pkgname=python-pyglet +# Template file for 'python3-pyglet' +pkgname=python3-pyglet version=1.4.10 revision=4 wrksrc="pyglet-${version}" -build_style=python-module -hostmakedepends="python-setuptools python3-setuptools unzip" -depends="python" -short_desc="Cross-platform windowing and multimedia library for Python2" +build_style=python3-module +hostmakedepends="python3-setuptools unzip" +depends="python3" +short_desc="Cross-platform windowing and multimedia library for Python3" maintainer="Jasper Chan " license="BSD-3-Clause" homepage="https://www.pyglet.org" @@ -16,12 +16,3 @@ checksum=c57e3e18246f45e4d6bb3d29e39d128d6e72b05f4212b10353adc3ba260ceb65 post_install() { vlicense LICENSE } - -python3-pyglet_package() { - depends="python3" - short_desc="${short_desc/Python2/Python3}" - pkg_install() { - vmove usr/lib/python3* - vlicense LICENSE - } -} diff --git a/srcpkgs/python-pyglet/update b/srcpkgs/python3-pyglet/update similarity index 100% rename from srcpkgs/python-pyglet/update rename to srcpkgs/python3-pyglet/update