[packages/python-cssutils] - updated to 1.0.2 - added tests patch (fixes tests with CPython 2.x) - added mock patch (don't requ
qboosh
qboosh at pld-linux.org
Mon Jul 3 21:25:44 CEST 2017
commit 9565b20895237e42b8bfb0730861970071627828
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Jul 3 21:27:15 2017 +0200
- updated to 1.0.2
- added tests patch (fixes tests with CPython 2.x)
- added mock patch (don't require external mock with python 3, unittest.mock is enough)
- added python3- package
python-cssutils-mock.patch | 36 ++++++++++++++
python-cssutils-tests.patch | 11 +++++
python-cssutils.spec | 118 +++++++++++++++++++++++++++++++++++---------
3 files changed, 141 insertions(+), 24 deletions(-)
---
diff --git a/python-cssutils.spec b/python-cssutils.spec
index d076d01..619c3d0 100644
--- a/python-cssutils.spec
+++ b/python-cssutils.spec
@@ -1,22 +1,37 @@
+#
+# Conditional build:
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+%bcond_without tests # unit tests
+
%define module cssutils
%define encutils_ver 0.9.8
-Summary: A CSS Cascading Style Sheets library for Python
-Summary(pl.UTF-8): Biblioteka CSS (Cascading Style Sheets) dla Pythona
+Summary: A CSS Cascading Style Sheets library for Python 2
+Summary(pl.UTF-8): Biblioteka CSS (Cascading Style Sheets) dla Pythona 2
Name: python-%{module}
-Version: 0.9.9
-Release: 4
+Version: 1.0.2
+Release: 1
Epoch: 1
License: LGPL v3+
Group: Libraries/Python
-Source0: http://cheeseshop.python.org/packages/source/c/cssutils/%{module}-%{version}.zip
-# Source0-md5: 5f8ea824cc0e0518b574da20e895be08
+Source0: http://files.pythonhosted.org/packages/source/c/cssutils/%{module}-%{version}.tar.gz
+# Source0-md5: dc66d96c2d78f1687f59ac412fe9d318
+Patch0: %{name}-tests.patch
+Patch1: %{name}-mock.patch
URL: http://cthedot.de/cssutils/
+%if %{with python2}
BuildRequires: python-devel >= 1:2.5
+%{?with_tests:BuildRequires: python-mock}
BuildRequires: python-setuptools
+%endif
+%if %{with python3}
+BuildRequires: python3-2to3 >= 1:3.2
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-setuptools
+%endif
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.710
-BuildRequires: unzip
-%pyrequires_eq python-modules
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires: python-modules >= 1:2.5
Provides: python-encutils = %{encutils_ver}
Obsoletes: python-encutils < %{encutils_ver}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -30,8 +45,26 @@ Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
Level 2 CSS.
+%package -n python3-%{module}
+Summary: A CSS Cascading Style Sheets library for Python 3
+Summary(pl.UTF-8): Biblioteka CSS (Cascading Style Sheets) dla Pythona 3
+Group: Libraries/Python
+Requires: python3-modules >= 1:3.2
+
+%description -n python3-%{module}
+A Python package to parse and build CSS Cascading Style Sheets. Partly
+implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.
+
+%description -n python3-%{module} -l pl.UTF-8
+Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
+Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
+Level 2 CSS.
+
%prep
%setup -q -n %{module}-%{version}
+%patch0 -p1
+%patch1 -p1
+
eval $(PYTHONPATH=src python -c "from encutils import VERSION;print 'VERSION=%%s' %% VERSION")
if [ $VERSION != %{encutils_ver} ]; then
echo "Please set encutils_ver to $VERSION"
@@ -39,35 +72,72 @@ if [ $VERSION != %{encutils_ver} ]; then
fi
%build
+%if %{with python2}
%py_build
+%if %{with tests}
+%{__python} -m unittest discover -t build-2/lib -s build-2/lib/cssutils/tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m unittest discover -t build-3/lib -s build-3/lib/cssutils/tests
+%endif
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
-%py_install \
- --single-version-externally-managed \
- --optimize=2 \
- --root $RPM_BUILD_ROOT
+%if %{with python3}
+%py3_install
+
+for f in csscapture csscombine cssparse ; do
+ %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-3
+done
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/cssutils/tests
+%endif
+
+%if %{with python2}
+%py_install
+
+for f in csscapture csscombine cssparse ; do
+ %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-2
+ ln -sf ${f}-2 $RPM_BUILD_ROOT%{_bindir}/$f
+done
%py_postclean
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/cssutils/tests
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
%doc README.txt
%attr(755,root,root) %{_bindir}/csscapture
%attr(755,root,root) %{_bindir}/csscombine
%attr(755,root,root) %{_bindir}/cssparse
-%dir %{py_sitescriptdir}/cssutils
-%dir %{py_sitescriptdir}/cssutils/css
-%dir %{py_sitescriptdir}/cssutils/scripts
-%dir %{py_sitescriptdir}/cssutils/stylesheets
-%dir %{py_sitescriptdir}/encutils
-%attr(755,root,root) %{py_sitescriptdir}/cssutils/*.py[co]
-%attr(755,root,root) %{py_sitescriptdir}/cssutils/css/*.py[co]
-%attr(755,root,root) %{py_sitescriptdir}/cssutils/scripts/*.py[co]
-%attr(755,root,root) %{py_sitescriptdir}/cssutils/stylesheets/*.py[co]
-%attr(755,root,root) %{py_sitescriptdir}/encutils/*.py[co]
-%{py_sitescriptdir}/*.egg-info
+%attr(755,root,root) %{_bindir}/csscapture-2
+%attr(755,root,root) %{_bindir}/csscombine-2
+%attr(755,root,root) %{_bindir}/cssparse-2
+%{py_sitescriptdir}/cssutils
+%{py_sitescriptdir}/encutils
+%{py_sitescriptdir}/cssutils-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/csscapture-3
+%attr(755,root,root) %{_bindir}/csscombine-3
+%attr(755,root,root) %{_bindir}/cssparse-3
+%{py3_sitescriptdir}/cssutils
+%{py3_sitescriptdir}/encutils
+%{py3_sitescriptdir}/cssutils-%{version}-py*.egg-info
+%endif
diff --git a/python-cssutils-mock.patch b/python-cssutils-mock.patch
new file mode 100644
index 0000000..cac4c08
--- /dev/null
+++ b/python-cssutils-mock.patch
@@ -0,0 +1,36 @@
+--- cssutils-1.0.2/src/cssutils/tests/test_cssutils.py.orig 2017-03-04 10:53:23.000000000 +0100
++++ cssutils-1.0.2/src/cssutils/tests/test_cssutils.py 2017-07-03 21:07:40.163504334 +0200
+@@ -13,8 +13,7 @@
+ try:
+ import mock
+ except ImportError:
+- mock = None
+- print "install mock library to run all tests"
++ import unittest.mock as mock
+
+
+ class CSSutilsTestCase(basetest.BaseTestCase):
+--- cssutils-1.0.2/src/cssutils/tests/test_parse.py.orig 2015-11-25 23:11:26.000000000 +0100
++++ cssutils-1.0.2/src/cssutils/tests/test_parse.py 2017-07-03 21:08:16.740170584 +0200
+@@ -12,8 +12,7 @@
+ try:
+ import mock
+ except ImportError:
+- mock = None
+- print "install mock library to run all tests"
++ import unittest.mock as mock
+
+
+ class CSSParserTestCase(basetest.BaseTestCase):
+--- cssutils-1.0.2/src/cssutils/tests/test_util.py.orig 2016-10-27 13:55:21.000000000 +0200
++++ cssutils-1.0.2/src/cssutils/tests/test_util.py 2017-07-03 21:08:36.456837025 +0200
+@@ -13,8 +13,7 @@
+ try:
+ import mock
+ except ImportError:
+- mock = None
+- print "install mock library to run all tests"
++ import unittest.mock as mock
+
+ import basetest
+ import encutils
diff --git a/python-cssutils-tests.patch b/python-cssutils-tests.patch
new file mode 100644
index 0000000..33ceaac
--- /dev/null
+++ b/python-cssutils-tests.patch
@@ -0,0 +1,11 @@
+--- cssutils-1.0.2/src/cssutils/tests/test_errorhandler.py.orig 2017-07-03 19:31:47.420236687 +0200
++++ cssutils-1.0.2/src/cssutils/tests/test_errorhandler.py 2017-07-03 19:31:51.623569973 +0200
+@@ -84,7 +84,7 @@
+ self.assertEqual(str(e), 'CSSImportRule: Unexpected ident. [1:9: x]')
+ self.assertEqual(e.line, 1)
+ self.assertEqual(e.col, 9)
+- if sys.platform.startswith('java'):
++ if sys.platform.startswith('java') or sys.version_info[0] < 3:
+ self.assertEqual(e.msg, u'CSSImportRule: Unexpected ident. [1:9: x]')
+ else:
+ self.assertEqual(e.args, (u'CSSImportRule: Unexpected ident. [1:9: x]',))
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-cssutils.git/commitdiff/9565b20895237e42b8bfb0730861970071627828
More information about the pld-cvs-commit
mailing list