[packages/python-dtopt] - pl, actually run tests (python2 only)
qboosh
qboosh at pld-linux.org
Fri Jul 20 18:02:25 CEST 2018
commit c3f99d726160766e5bf2e474bbf719b6e2be266d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Fri Jul 20 18:04:19 2018 +0200
- pl, actually run tests (python2 only)
python-dtopt.spec | 102 +++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 74 insertions(+), 28 deletions(-)
---
diff --git a/python-dtopt.spec b/python-dtopt.spec
index 6cecc0d..7c2b9a0 100644
--- a/python-dtopt.spec
+++ b/python-dtopt.spec
@@ -1,26 +1,31 @@
#
# Conditional build:
+%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
-%bcond_without tests # do not perform "make test"
+%bcond_without tests # unit tests
%define module dtopt
Summary: Add options to doctest examples while they are running
+Summary(pl.UTF-8): Dodawanie opcji do przykładów doctest w trakcie ich działania
Name: python-%{module}
Version: 0.1
Release: 8
License: MIT
Group: Libraries/Python
-Source0: http://pypi.python.org/packages/source/d/dtopt/dtopt-%{version}.tar.gz
+#Source0Download: https://pypi.org/simple/dtopt/
+Source0: https://files.pythonhosted.org/packages/source/d/dtopt/dtopt-%{version}.tar.gz
# Source0-md5: 9a41317149e926fcc408086aedee6bab
-URL: http://pypi.python.org/pypi/dtopt/
-BuildRequires: python-distribute
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.710
+URL: https://pypi.org/project/dtopt/
+%if %{with python2}
+BuildRequires: python-setuptools
+%endif
%if %{with python3}
-BuildRequires: python3-devel
-BuildRequires: python3-distribute
-BuildRequires: python3-modules
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools
%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -28,45 +33,89 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
dtopts adds options to doctest examples while they are running. When
using the doctest module it is often convenient to use the ELLIPSIS
option, which allows you to use ... as a wildcard. But you either have
-to setup the test runner to use this option, or you must put #doctest:
-+ELLIPSIS on every example that uses this feature. dtopt lets you
-enable this option globally from within a doctest, by doing: >>> from
-dtopt import ELLIPSIS
+to setup the test runner to use this option, or you must put
+"#doctest: +ELLIPSIS" on every example that uses this feature. dtopt
+lets you enable this option globally from within a doctest, by doing:
+>>> from dtopt import ELLIPSIS
+
+%description -l pl.UTF-8
+dtopts dodaje opcje do przykładów doctest w trakcie ich działania.
+Przy korzystaniu z modułu doctest często wygodne jest użycie opcji
+ELLIPSIS, pozwalającej na użycie ... jako maski globalnej. Ale albo
+trzeba konfigurować narzędzie uruchamiające do użycia tej opcji, albo
+umieszczać "#doctest: +ELLIPSIS" przy każdym przykładzie używającym
+tej opcji. dtopt pozwala włączyć tę opcję globalnie z poziomu doctest
+poprzez:
+>>> from dtopt import ELLIPSIS
%package -n python3-dtopt
Summary: Add options to doctest examples while they are running
+Summary(pl.UTF-8): Dodawanie opcji do przykładów doctest w trakcie ich działania
Group: Libraries/Python
%description -n python3-dtopt
dtopts adds options to doctest examples while they are running. When
using the doctest module it is often convenient to use the ELLIPSIS
option, which allows you to use ... as a wildcard. But you either have
-to setup the test runner to use this option, or you must put #doctest:
-+ELLIPSIS on every example that uses this feature. dtopt lets you
-enable this option globally from within a doctest, by doing: >>> from
-dtopt import ELLIPSIS
+to setup the test runner to use this option, or you must put
+"#doctest: +ELLIPSIS" on every example that uses this feature. dtopt
+lets you enable this option globally from within a doctest, by doing:
+>>> from dtopt import ELLIPSIS
+
+%description -n python3-dtopt -l pl.UTF-8
+dtopts dodaje opcje do przykładów doctest w trakcie ich działania.
+Przy korzystaniu z modułu doctest często wygodne jest użycie opcji
+ELLIPSIS, pozwalającej na użycie ... jako maski globalnej. Ale albo
+trzeba konfigurować narzędzie uruchamiające do użycia tej opcji, albo
+umieszczać "#doctest: +ELLIPSIS" przy każdym przykładzie używającym
+tej opcji. dtopt pozwala włączyć tę opcję globalnie z poziomu doctest
+poprzez:
+>>> from dtopt import ELLIPSIS
%prep
%setup -q -n %{module}-%{version}
-# Remove bundled egg info if it exists.
-rm -r *.egg-info
+# Remove bundled egg info
+%{__rm} -r *.egg-info
%build
+%if %{with python2}
%py_build
+%if %{with tests}
+PYTHONPATH=$(pwd) \
+%{__python} dtopt/tests.py
+%endif
+%endif
+
%if %{with python3}
%py3_build
+
+%if 0 && %{with tests}
+# as of 0.1, uses python2 syntax
+PYTHONPATH=$(pwd) \
+%{__python3} dtopt/tests.py 2>&1 | tee tests.log
+# "one error is good"
+grep -q ' 1 failures' tests.log
+%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
%py_install
+%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/dtopt/tests.py*
%py_postclean
+%endif
%if %{with python3}
%py3_install
+
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/tests.py
+# probably won't be compiled due to python2 syntax
+rm -f $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/__pycache__/tests.cpython-*.py*
%endif
%clean
@@ -74,17 +123,14 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc docs/*
-%dir %{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/%{module}/*.py[co]
-%{py_sitescriptdir}/%{module}-*.egg-info
+%doc docs/*.txt
+%{py_sitescriptdir}/dtopt
+%{py_sitescriptdir}/dtopt-%{version}-py*.egg-info
%if %{with python3}
%files -n python3-dtopt
%defattr(644,root,root,755)
-%doc docs/*
-%dir %{py3_sitescriptdir}/dtopt
-%{py3_sitescriptdir}/%{module}/*.py
-%{py3_sitescriptdir}/%{module}/__pycache__
-%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%doc docs/*.txt
+%{py3_sitescriptdir}/dtopt
+%{py3_sitescriptdir}/dtopt-%{version}-py*.egg-info
%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-dtopt.git/commitdiff/c3f99d726160766e5bf2e474bbf719b6e2be266d
More information about the pld-cvs-commit
mailing list