From d27aa667e4f3cd03181a4b749c1614e5c2c92c34 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Mon, 28 Feb 2022 23:25:49 +0100 Subject: [PATCH 1/5] New package: python3-tinycss2-1.1.1 --- srcpkgs/python3-tinycss2/template | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 srcpkgs/python3-tinycss2/template diff --git a/srcpkgs/python3-tinycss2/template b/srcpkgs/python3-tinycss2/template new file mode 100644 index 000000000000..05f29b814c7b --- /dev/null +++ b/srcpkgs/python3-tinycss2/template @@ -0,0 +1,21 @@ +# Template file for 'python3-tinycss2' +pkgname=python3-tinycss2 +version=1.1.1 +revision=1 +wrksrc=tinycss2-${version} +build_style=python3-pep517 +hostmakedepends="python3-flit_core" +makedepends="" +depends="python3" +short_desc="Tiny CSS parser" +maintainer="Michal Vasilek " +license="BSD-3-Clause" +homepage="https://www.courtbouillon.org/tinycss2" +changelog="https://doc.courtbouillon.org/tinycss2/stable/_sources/changelog.rst.txt" +distfiles="https://github.com/Kozea/tinycss2/archive/refs/tags/v$version.tar.gz" +checksum=2ab003bd267efd7e919b561f7e54a776962799ba5872d7de8512a057a7c836e1 +make_check=no # No such file or directory: tests/css-parsing-tests/component_value_list.json' + +pre_check() { + vsed -e '/addopts.*/d' -i pyproject.toml +} From d588b03ab34704a4fe854d488e826286d7752dd6 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Mon, 28 Feb 2022 23:25:55 +0100 Subject: [PATCH 2/5] New package: python3-cssselect2-0.5.0 --- srcpkgs/python3-cssselect2/template | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 srcpkgs/python3-cssselect2/template diff --git a/srcpkgs/python3-cssselect2/template b/srcpkgs/python3-cssselect2/template new file mode 100644 index 000000000000..1e2a945d00f6 --- /dev/null +++ b/srcpkgs/python3-cssselect2/template @@ -0,0 +1,21 @@ +# Template file for 'python3-cssselect2' +pkgname=python3-cssselect2 +version=0.5.0 +revision=1 +wrksrc="cssselect2-$version" +build_style=python3-pep517 +hostmakedepends="python3-flit_core" +makedepends="python3-webencodings python3-tinycss2" +depends="$makedepends" +checkdepends="python3-pytest $makedepends" +short_desc="CSS4 selectors for Python ElementTree" +maintainer="Michal Vasilek " +license="BSD-3-Clause" +homepage="https://doc.courtbouillon.org/cssselect2/stable/" +changelog="https://doc.courtbouillon.org/cssselect2/stable/_sources/changelog.rst.txt" +distfiles="https://github.com/Kozea/cssselect2/archive/refs/tags/0.5.0.tar.gz" +checksum=09db9b1c40349443b577933ffbf32fee2f5802bfab466a4949493178d5afe04d + +pre_check() { + vsed -e '/addopts.*/d' -i pyproject.toml +} From 9916ea51fb7db7c472a69790a925ede8228ae649 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Mon, 28 Feb 2022 23:26:07 +0100 Subject: [PATCH 3/5] New package: python3-cairosvg-2.5.2 --- srcpkgs/python3-cairosvg/template | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 srcpkgs/python3-cairosvg/template diff --git a/srcpkgs/python3-cairosvg/template b/srcpkgs/python3-cairosvg/template new file mode 100644 index 000000000000..3b0e93b83a1e --- /dev/null +++ b/srcpkgs/python3-cairosvg/template @@ -0,0 +1,26 @@ +# Template file for 'python3-cairosvg' +pkgname=python3-cairosvg +version=2.5.2 +revision=1 +wrksrc="CairoSVG-$version" +build_style=python3-module +hostmakedepends="python3-setuptools" +#makedepends="" +depends="python3-cairocffi python3-cssselect2 python3-tinycss2 + python3-defusedxml python3-Pillow" +checkdepends="python3-pytest $depends" +short_desc="Convert your vector images" +maintainer="Michal Vasilek " +license="LGPL-3.0-or-later" +homepage="https://www.courtbouillon.org/cairosvg" +changelog="https://raw.githubusercontent.com/Kozea/CairoSVG/master/NEWS.rst" +distfiles="https://github.com/Kozea/CairoSVG/archive/refs/tags/$version.tar.gz" +checksum=90a8bee8e7984317a21db4e1c6672e1d17266ced060f3bfd88b1dd70b6c422ff +make_check=no # No such file or directory: test_non_regression/cairosvg_reference/cairosvg/__init__.py + +pre_patch() { + vsed -e '/pytest-runner/d' \ + -e '/flake8/d' \ + -e '/--isort/d' \ + -i setup.cfg +} From 22b38e463b19c0134bddd44218fb96479222ec83 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 24 Feb 2022 17:14:15 +0100 Subject: [PATCH 4/5] printrun: update to 2.0.0rc8. --- srcpkgs/printrun/patches/python3.10.patch | 146 ++++++++++++++++++ .../printrun/patches/relax-requirements.patch | 9 ++ srcpkgs/printrun/template | 18 ++- 3 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 srcpkgs/printrun/patches/python3.10.patch create mode 100644 srcpkgs/printrun/patches/relax-requirements.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/patches/relax-requirements.patch b/srcpkgs/printrun/patches/relax-requirements.patch new file mode 100644 index 000000000000..5920c9a8f379 --- /dev/null +++ b/srcpkgs/printrun/patches/relax-requirements.patch @@ -0,0 +1,9 @@ +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,5 +1,5 @@ + pyserial (>= 3.0) +-wxPython (== 4.1.0) ++wxPython (>= 4.0.0) + numpy (>= 1.8.2) + pyglet (>= 1.1) + cffi diff --git a/srcpkgs/printrun/template b/srcpkgs/printrun/template index d18d21df3e69..7c5b75bb1ccc 100644 --- a/srcpkgs/printrun/template +++ b/srcpkgs/printrun/template @@ -1,20 +1,24 @@ # 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 python3-Cython" +makedepends="python3-devel" +depends="wxPython4 python3-pyserial python3-pyglet python3-numpy + python3-appdirs python3-lxml python3-psutil python3-cairosvg python3-tinycss2" +checkdepends="$depends" 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 a97a1dc30eb23f35c79a59c4ff7ddb06fb5c81c8 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 24 Feb 2022 17:17:43 +0100 Subject: [PATCH 5/5] 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