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
This commit is contained in:
parent
0ab02aefa0
commit
ecdcb18787
132
python-pycha-no-six.patch
Normal file
132
python-pycha-no-six.patch
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
-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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
-import six
|
||||
-
|
||||
-unicode = six.text_type
|
||||
+unicode = str
|
||||
|
||||
|
||||
def clamp(minValue, maxValue, value):
|
@ -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 <pgajdos@suse.com>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user