[packages/python-blockdiag] - updated to 1.5.4 - added python3- package, let default binary be py3 - added tests patch (fixes py
qboosh
qboosh at pld-linux.org
Sat Feb 6 14:48:03 CET 2021
commit 0a2b7beb2556c495a6cdd46fa041b6b2e9cfdf64
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Feb 6 14:48:26 2021 +0100
- updated to 1.5.4
- added python3- package, let default binary be py3
- added tests patch (fixes py2 tests with backports.configparser installed)
python-blockdiag-tests.patch | 17 +++++
python-blockdiag.spec | 156 ++++++++++++++++++++++++++++++++++++-------
2 files changed, 149 insertions(+), 24 deletions(-)
---
diff --git a/python-blockdiag.spec b/python-blockdiag.spec
index 2f3f40d..0134f0b 100644
--- a/python-blockdiag.spec
+++ b/python-blockdiag.spec
@@ -1,61 +1,169 @@
+#
+# Conditional build:
+%bcond_without tests # unit tests
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
%define module blockdiag
Summary: Blockdiag generate block-diagram image file from spec-text file
+Summary(pl.UTF-8): Generowanie obrazków diagramów blokowych z opisu tekstowego
Name: python-%{module}
-Version: 1.1.6
-Release: 2
+# keep 1.x here for python2 support
+Version: 1.5.4
+Release: 1
License: Apache v2.0
-Group: Development/Languages
+Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/blockdiag/
+Source0: https://files.pythonhosted.org/packages/source/b/blockdiag/%{module}-%{version}.tar.gz
+# Source0-md5: 2de59ac957224c4f92ea3072aa1221bf
+Patch0: %{name}-tests.patch
URL: http://blockdiag.com/en/blockdiag/index.html
-Source0: http://pypi.python.org/packages/source/b/%{module}/%{module}-%{version}.tar.gz
-# Source0-md5: 6057b077618df3b9f4c5a73910ddd736
-BuildRequires: rpmbuild(macros) >= 1.710
-BuildRequires: sed >= 4.0
-Requires: python-PIL
+%if %{with python2}
+BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-setuptools
+%if %{with tests}
+BuildRequires: python-ReportLab
+BuildRequires: python-docutils
+BuildRequires: python-funcparserlib
+BuildRequires: python-nose
+BuildRequires: python-pillow
+BuildRequires: python-webcolors
%if "%{py_ver}" < "2.7"
-Requires: python-ordereddict
+BuildRequires: python-ordereddict
+BuildRequires: python-unittest2
+%endif
+%endif
+%endif
+%if %{with python3}
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-ReportLab
+BuildRequires: python3-docutils
+BuildRequires: python3-funcparserlib
+BuildRequires: python3-nose
+BuildRequires: python3-nose_exclude
+BuildRequires: python3-pillow
+BuildRequires: python3-webcolors
%endif
-Requires: python-funcparserlib >= 0.3.4
-Requires: python-modules >= 2.4
-Requires: python-webcolors >= 1.3.1
+%endif
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: sed >= 4.0
+Requires: python-modules >= 1:2.6
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-blockdiag generate block-diagram image file from spec-text file.
+blockdiag generates block-diagram image file from spec-text file.
+
+Features:
+- Generate block-diagram from dot like text (basic feature).
+- Multilingualization for node-label (UTF-8 only).
+
+%description -l pl.UTF-8
+blockdiag generuje pliki obrazów diagramów blokowych z tekstowych
+plików opisu.
+
+Funkcje:
+- generowanie diagramów z tekstu w stylu dot (podstawowa funkcja).
+- obsługa wielu języków dla etykiet węzłów (tylko UTF-8).
+
+%package -n python3-%{module}
+Summary: Blockdiag generate block-diagram image file from spec-text file
+Summary(pl.UTF-8): Generowanie obrazków diagramów blokowych z opisu tekstowego
+Group: Libraries/Python
+Requires: python3-modules >= 1:3.2
+
+%description -n python3-%{module}
+blockdiag generates block-diagram image file from spec-text file.
Features:
- Generate block-diagram from dot like text (basic feature).
- Multilingualization for node-label (utf-8 only).
+%description -n python3-%{module} -l pl.UTF-8
+blockdiag generuje pliki obrazów diagramów blokowych z tekstowych
+plików opisu.
+
+Funkcje:
+- generowanie diagramów z tekstu w stylu dot (podstawowa funkcja).
+- obsługa wielu języków dla etykiet węzłów (tylko UTF-8).
+
%prep
%setup -q -n %{module}-%{version}
-%{__sed} -i -e 's/^from ez_setup/#from ez_setup/' setup.py
-%{__sed} -i -e 's/^use_setuptools()/#use_setuptools()/' setup.py
+%patch0 -p1
%build
+%if %{with python2}
%py_build
+%if %{with tests}
+PYTHONPATH=$(pwd)/src \
+nosetests-%{py_ver} src/blockdiag/tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+# disable test which fails on utf-8 vs latin-1 inconsistency
+PYTHONPATH=$(pwd)/src \
+nosetests-%{py3_ver} src/blockdiag/tests -e test_setup_inline_svg_is_true_with_multibytes
+%endif
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
-%py_install \
- --root $RPM_BUILD_ROOT
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/tests
-%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}_sphinxhelper.*
+%if %{with python2}
+%py_install
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/blockdiag/tests
+
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/{blockdiag,blockdiag-2}
install -d $RPM_BUILD_ROOT%{_mandir}/man1
-cp -p %{module}.1 $RPM_BUILD_ROOT%{_mandir}/man1
+cp -p blockdiag.1 $RPM_BUILD_ROOT%{_mandir}/man1/blockdiag-2.1
%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/blockdiag/tests
+
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/{blockdiag,blockdiag-3}
+ln -s blockdiag-3 $RPM_BUILD_ROOT%{_bindir}/blockdiag
+install -d $RPM_BUILD_ROOT%{_mandir}/man1
+cp -p blockdiag.1 $RPM_BUILD_ROOT%{_mandir}/man1/blockdiag-3.1
+echo '.so blockdiag-3.1' >$RPM_BUILD_ROOT%{_mandir}/man1/blockdiag.1
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/%{module}
-%{_mandir}/man1/%{module}.1*
-%{py_sitescriptdir}/%{module}
-%if "%{py_ver}" > "2.4"
+%doc CHANGES.rst README.rst
+%attr(755,root,root) %{_bindir}/blockdiag-2
+%{py_sitescriptdir}/blockdiag
+%{py_sitescriptdir}/blockdiag_sphinxhelper.py[co]
%{py_sitescriptdir}/%{module}-%{version}-*.egg-info
+%{_mandir}/man1/blockdiag-2.1*
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc CHANGES.rst README.rst
+%attr(755,root,root) %{_bindir}/blockdiag
+%attr(755,root,root) %{_bindir}/blockdiag-3
+%{py3_sitescriptdir}/blockdiag
+%{py3_sitescriptdir}/blockdiag_sphinxhelper.py
+%{py3_sitescriptdir}/__pycache__/blockdiag_sphinxhelper.cpython-*.py[co]
+%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%{_mandir}/man1/blockdiag.1*
+%{_mandir}/man1/blockdiag-3.1*
%endif
diff --git a/python-blockdiag-tests.patch b/python-blockdiag-tests.patch
new file mode 100644
index 0000000..d4d9e3a
--- /dev/null
+++ b/python-blockdiag-tests.patch
@@ -0,0 +1,17 @@
+--- blockdiag-1.5.4/src/blockdiag/tests/test_utils_fontmap.py.orig 2018-07-22 13:48:38.000000000 +0200
++++ blockdiag-1.5.4/src/blockdiag/tests/test_utils_fontmap.py 2021-02-06 12:31:08.863287467 +0100
+@@ -223,7 +223,13 @@
+ _config = u("[fontmap]\nsansserif: %s\nsansserif: %s\n") % \
+ (self.fontpath[0], self.fontpath[1])
+ config = StringIO(_config)
+- if sys.version_info[0] == 2:
++ has_configparser = False
++ try:
++ import configparser
++ has_configparser = True
++ except ImportError:
++ pass
++ if (sys.version_info[0] == 2) and not has_configparser:
+ fmap = FontMap(config)
+
+ font1 = fmap.find()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-blockdiag.git/commitdiff/0a2b7beb2556c495a6cdd46fa041b6b2e9cfdf64
More information about the pld-cvs-commit
mailing list