From ecdcb187877401cb4d3f8a76b209a7a594f6f5d26346d8e2873340d26df54ab8 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 12 Apr 2023 05:56:29 +0000 Subject: [PATCH] Accepting request 1078388 from home:pgajdos:python - do not require python-six - added patches + python-pycha-no-six.patch - test the package OBS-URL: https://build.opensuse.org/request/show/1078388 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pycha?expand=0&rev=9 --- python-pycha-no-six.patch | 132 ++++++++++++++++++++++++++++++++++++++ python-pycha.changes | 8 +++ python-pycha.spec | 19 ++++-- 3 files changed, 152 insertions(+), 7 deletions(-) create mode 100644 python-pycha-no-six.patch diff --git a/python-pycha-no-six.patch b/python-pycha-no-six.patch new file mode 100644 index 0000000..a4827d5 --- /dev/null +++ b/python-pycha-no-six.patch @@ -0,0 +1,132 @@ +Index: pycha-0.8.1/pycha.egg-info/requires.txt +=================================================================== +--- pycha-0.8.1.orig/pycha.egg-info/requires.txt ++++ pycha-0.8.1/pycha.egg-info/requires.txt +@@ -1,4 +1,3 @@ +-six + cairocffi + + [testing] +Index: pycha-0.8.1/pycha/chart.py +=================================================================== +--- pycha-0.8.1.orig/pycha/chart.py ++++ pycha-0.8.1/pycha/chart.py +@@ -19,7 +19,7 @@ import copy + import math + + import cairocffi as cairo +-from six.moves import reduce ++from functools import reduce + + from pycha.color import ColorScheme, hex2rgb, DEFAULT_COLOR + from pycha.compat import getfullargspec +Index: pycha-0.8.1/pycha/color.py +=================================================================== +--- pycha-0.8.1.orig/pycha/color.py ++++ pycha-0.8.1/pycha/color.py +@@ -18,8 +18,6 @@ + + import math + +-import six +- + from pycha.utils import clamp + + +@@ -125,14 +123,14 @@ class ColorSchemeMetaclass(type): + return klass + + +-class ColorScheme(six.with_metaclass(ColorSchemeMetaclass, dict)): ++class ColorScheme(dict, metaclass=ColorSchemeMetaclass): + """A color scheme is a dictionary where the keys match the keys + constructor argument and the values are colors""" + + __registry__ = {} + + def __init__(self, keys): +- super(ColorScheme, self).__init__() ++ super().__init__() + + @classmethod + def registerColorScheme(cls): +@@ -154,7 +152,7 @@ class GradientColorScheme(ColorScheme): + """ + + def __init__(self, keys, initialColor=DEFAULT_COLOR): +- super(GradientColorScheme, self).__init__(keys) ++ super().__init__(keys) + if initialColor in basicColors: + initialColor = basicColors[initialColor] + +@@ -172,7 +170,7 @@ class FixedColorScheme(ColorScheme): + """ + + def __init__(self, keys, colors=[]): +- super(FixedColorScheme, self).__init__(keys) ++ super().__init__(keys) + + if len(keys) != len(colors): + raise ValueError("You must provide as many colors as datasets " +@@ -190,7 +188,7 @@ class RainbowColorScheme(ColorScheme): + """ + + def __init__(self, keys, initialColor=DEFAULT_COLOR): +- super(RainbowColorScheme, self).__init__(keys) ++ super().__init__(keys) + if initialColor in basicColors: + initialColor = basicColors[initialColor] + +Index: pycha-0.8.1/pycha/stackedbar.py +=================================================================== +--- pycha-0.8.1.orig/pycha/stackedbar.py ++++ pycha-0.8.1/pycha/stackedbar.py +@@ -16,7 +16,7 @@ + # You should have received a copy of the GNU Lesser General Public License + # along with PyCha. If not, see . + +-from six.moves import reduce, xrange ++from functools import reduce + + from pycha.bar import BarChart, VerticalBarChart, HorizontalBarChart, Rect + from pycha.chart import uniqueIndices +@@ -40,9 +40,9 @@ class StackedBarChart(BarChart): + n_stores = len(stores) + flat_y = [pair[1] for pair in reduce(lambda a, b: a + b, stores)] + store_size = len(flat_y) // n_stores +- accum = [sum(flat_y[j]for j in xrange(i, +- i + store_size * n_stores, +- store_size)) ++ accum = [sum(flat_y[j]for j in range(i, ++ i + store_size * n_stores, ++ store_size)) + for i in range(len(flat_y) // n_stores)] + self.yrange = float(max(accum)) + if self.yrange == 0: +Index: pycha-0.8.1/setup.py +=================================================================== +--- pycha-0.8.1.orig/setup.py ++++ pycha-0.8.1/setup.py +@@ -26,7 +26,6 @@ def read(*rnames): + + + base_requirements = [ +- 'six', + 'cairocffi', + ] + +Index: pycha-0.8.1/pycha/utils.py +=================================================================== +--- pycha-0.8.1.orig/pycha/utils.py ++++ pycha-0.8.1/pycha/utils.py +@@ -16,9 +16,7 @@ + # You should have received a copy of the GNU Lesser General Public License + # along with PyCha. If not, see . + +-import six +- +-unicode = six.text_type ++unicode = str + + + def clamp(minValue, maxValue, value): diff --git a/python-pycha.changes b/python-pycha.changes index fb8a16a..f9d87c1 100644 --- a/python-pycha.changes +++ b/python-pycha.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Apr 11 09:03:26 UTC 2023 - pgajdos@suse.com + +- do not require python-six +- added patches + + python-pycha-no-six.patch +- test the package + ------------------------------------------------------------------- Wed May 20 07:26:19 UTC 2020 - Petr Gajdos diff --git a/python-pycha.spec b/python-pycha.spec index 7014267..9b7bf1d 100644 --- a/python-pycha.spec +++ b/python-pycha.spec @@ -1,7 +1,7 @@ # # spec file for package python-pycha # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pycha Version: 0.8.1 Release: 0 @@ -25,17 +24,19 @@ License: LGPL-3.0-or-later Group: Development/Languages/Python URL: https://bitbucket.org/lgs/pycha/ Source: https://files.pythonhosted.org/packages/source/p/pycha/pycha-%{version}.tar.gz +# upstream repo (bitbucket) as defined on pypi gone +# is safe_unicode() needed at all? +Patch0: python-pycha-no-six.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-cairocffi -Requires: python-six Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module cairocffi} -BuildRequires: %{python_module six} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -47,7 +48,7 @@ PlotKit, both of which are written in JavaScript and are for client web programming. Pycha was developed for the server side. %prep -%setup -q -n pycha-%{version} +%autosetup -p1 -n pycha-%{version} %build %python_build @@ -63,10 +64,14 @@ web programming. Pycha was developed for the server side. %postun %python_uninstall_alternative chavier +%check +%pytest tests/*.py + %files %{python_files} %doc README.txt CHANGES.txt AUTHORS %license COPYING -%{python_sitelib}/* +%{python_sitelib}/pycha* +%{python_sitelib}/chavier %python_alternative %{_bindir}/chavier %changelog