- Add patch remove-makesuite.patch:

* Do not use testsuite.makeSuite to construct the testsuite.
- Switch to pyproject macros.
- Update URL.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pycha?expand=0&rev=13
This commit is contained in:
Steve Kowalik 2024-11-27 02:05:44 +00:00 committed by Git OBS Bridge
commit 7ef456a528
7 changed files with 487 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
pycha-0.8.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19553a5f875a5741b060c3e4ae4cc27c24626af6799bc697f52b4d489fa2b447
size 43399

132
python-pycha-no-six.patch Normal file
View 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):

69
python-pycha.changes Normal file
View File

@ -0,0 +1,69 @@
-------------------------------------------------------------------
Wed Nov 27 02:03:50 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch remove-makesuite.patch:
* Do not use testsuite.makeSuite to construct the testsuite.
- Switch to pyproject macros.
- Update URL.
-------------------------------------------------------------------
Sun Jan 14 14:14:24 UTC 2024 - Axel Braun <axel.braun@gmx.de>
- enabled %{?sle15_python_module_pythons}
-------------------------------------------------------------------
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>
- %python3_only -> %python_alternative
-------------------------------------------------------------------
Thu Jan 30 15:16:25 UTC 2020 - Todd R <toddrme2178@gmail.com>
- Update to 0.8.1
* Forgot to update Changelog for 0.8.0
- Update to 0.8.0
* Add support for Python 3 by encukou
* Add support for Tox, Pyflakes, Coverage and Buildbucket pipelines
* Remove support for Buildout
-------------------------------------------------------------------
Wed Apr 3 03:55:04 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Fix fdupes to avoid python3 package egg-info being symlinks into
the python2 package which may not be installed.
- Use %license
-------------------------------------------------------------------
Mon May 29 07:55:03 UTC 2017 - axel.braun@gmx.de
- added python-rpm-macros
-------------------------------------------------------------------
Sun May 28 13:01:00 UTC 2017 - okurz@suse.com
- Convert to singlespec
-------------------------------------------------------------------
Fri Sep 23 09:38:32 UTC 2016 - jengelh@inai.de
- Update license field; trim description.
-------------------------------------------------------------------
Sun Aug 21 07:58:47 UTC 2016 - axel.braun@gmx.de
- link to pypi.io
-------------------------------------------------------------------
Thu Jun 30 09:35:21 UTC 2016 - axel.braun@gmx.de
- release 0.7.0
Initial build on OBS

81
python-pycha.spec Normal file
View File

@ -0,0 +1,81 @@
#
# spec file for package python-pycha
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-pycha
Version: 0.8.1
Release: 0
Summary: A library for making charts with Python
License: LGPL-3.0-or-later
URL: https://github.com/timesong/pycha
Source: https://files.pythonhosted.org/packages/source/p/pycha/pycha-%{version}.tar.gz
# is safe_unicode() needed at all?
Patch0: python-pycha-no-six.patch
# PATCH-FIX-OPENSUSE remove makeSuite calls
Patch1: remove-makesuite.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-cairocffi
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module cairocffi}
BuildRequires: %{python_module pytest}
# /SECTION
%python_subpackages
%description
Pycha is a Python package for drawing charts using the Cairo library.
It will not try to draw any possible chart on Earth, but draw the
most common ones nicely. Pycha is based on the Plotr which is based on
PlotKit, both of which are written in JavaScript and are for client
web programming. Pycha was developed for the server side.
%prep
%autosetup -p1 -n pycha-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/chavier
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%post
%python_install_alternative chavier
%postun
%python_uninstall_alternative chavier
%check
%pytest tests/*.py
%files %{python_files}
%doc README.txt CHANGES.txt AUTHORS
%license COPYING
%{python_sitelib}/pycha
%{python_sitelib}/pycha-%{version}.dist-info
%{python_sitelib}/chavier
%python_alternative %{_bindir}/chavier
%changelog

178
remove-makesuite.patch Normal file
View File

@ -0,0 +1,178 @@
Index: pycha-0.8.1/tests/bar.py
===================================================================
--- pycha-0.8.1.orig/tests/bar.py
+++ pycha-0.8.1/tests/bar.py
@@ -363,15 +363,3 @@ class HorizontalBarTests(unittest.TestCa
ch = pycha.bar.HorizontalBarChart(None)
shadow = ch._getShadowRectangle(10, 20, 400, 300)
self.assertEqual(shadow, (10, 18, 402, 304))
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(RectTests),
- unittest.makeSuite(BarTests),
- unittest.makeSuite(VerticalBarTests),
- unittest.makeSuite(HorizontalBarTests),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Index: pycha-0.8.1/tests/chart.py
===================================================================
--- pycha-0.8.1.orig/tests/chart.py
+++ pycha-0.8.1/tests/chart.py
@@ -284,16 +284,3 @@ class ChartTests(unittest.TestCase):
tick = ch.yticks[i]
self.assertAlmostEqual(tick[0], pos, 2)
self.assertAlmostEqual(tick[1], label, 2)
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(FunctionsTests),
- unittest.makeSuite(AreaTests),
- unittest.makeSuite(OptionTests),
- unittest.makeSuite(ChartTests),
- ))
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Index: pycha-0.8.1/tests/color.py
===================================================================
--- pycha-0.8.1.orig/tests/color.py
+++ pycha-0.8.1/tests/color.py
@@ -134,13 +134,3 @@ class ColorTests(unittest.TestCase):
self._assertColors(scheme[2], (1.0, 0.2, 0.2), 3)
self._assertColors(scheme[3], (1.0, 0.3, 0.3), 3)
self._assertColors(scheme[4], (1.0, 0.4, 0.4), 3)
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(ColorTests),
- ))
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Index: pycha-0.8.1/tests/line.py
===================================================================
--- pycha-0.8.1.orig/tests/line.py
+++ pycha-0.8.1/tests/line.py
@@ -107,13 +107,3 @@ class LineTests(unittest.TestCase):
self.assertAlmostEqual(p1.xval, p2.xval, 4)
self.assertAlmostEqual(p1.yval, p2.yval, 4)
self.assertEqual(p1.name, p2.name)
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(PointTests),
- unittest.makeSuite(LineTests),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
Index: pycha-0.8.1/tests/pie.py
===================================================================
--- pycha-0.8.1.orig/tests/pie.py
+++ pycha-0.8.1/tests/pie.py
@@ -160,14 +160,3 @@ class PieTests(unittest.TestCase):
self.assertAlmostEqual(s1.endAngle, s2.endAngle, 4)
self.assertEqual(s1.xval, s2.xval)
self.assertEqual(s1.yval, s2.yval)
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(SliceTests),
- unittest.makeSuite(PieTests),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
Index: pycha-0.8.1/tests/runner.py
===================================================================
--- pycha-0.8.1.orig/tests/runner.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2007-2019 by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
-#
-# This file is part of PyCha.
-#
-# PyCha is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# PyCha is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# 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 unittest
-
-from . import bar
-from . import chart
-from . import color
-from . import line
-from . import pie
-from . import utils
-
-
-def test_suite():
- return unittest.TestSuite((
- bar.test_suite(),
- chart.test_suite(),
- color.test_suite(),
- line.test_suite(),
- pie.test_suite(),
- utils.test_suite(),
- ))
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Index: pycha-0.8.1/tests/stackedbar.py
===================================================================
--- pycha-0.8.1.orig/tests/stackedbar.py
+++ pycha-0.8.1/tests/stackedbar.py
@@ -197,14 +197,3 @@ class StackedHorizontalBarTests(unittest
for i in range(len(yticks)):
self.assertAlmostEqual(ch.yticks[i][0], yticks[i][0], 4)
self.assertAlmostEqual(ch.yticks[i][1], yticks[i][1], 4)
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(StackedBarTests),
- unittest.makeSuite(StackedVerticalBarTests),
- unittest.makeSuite(StackedHorizontalBarTests),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Index: pycha-0.8.1/tests/utils.py
===================================================================
--- pycha-0.8.1.orig/tests/utils.py
+++ pycha-0.8.1/tests/utils.py
@@ -36,13 +36,3 @@ class UtilsTests(unittest.TestCase):
self.assertEqual(pycha.utils.safe_unicode('ascii'), u'ascii')
self.assertEqual(pycha.utils.safe_unicode('non ascii ñ', 'utf-8'),
u'non ascii ñ')
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(UtilsTests),
- ))
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')