%bcond_without doc # HTML documentation build
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
+%bcond_with tests # unit tests [fail with pytest 3.0?]
%define module py
Summary: Library with cross-python path, ini-parsing, io, code, log facilities
Summary(pl.UTF-8): Biblioteka wspierająca obsługę ścieżek, ini, we/wy, kodowania i logowania w wielu Pythonach
Name: python-%{module}
-Version: 1.4.28
-Release: 3
+Version: 1.7.0
+Release: 2
License: MIT
Group: Development/Languages/Python
-Source0: https://pypi.python.org/packages/source/p/py/py-%{version}.tar.gz
-# Source0-md5: 30b807e1fe1b886578c47337d424a083
+#Source0Download: https://pypi.org/simple/py/
+Source0: https://files.pythonhosted.org/packages/source/p/py/py-%{version}.tar.gz
+# Source0-md5: e53ac12db4286737837ef3ccb4158301
Source1: http://docs.python.org/objects.inv?/python-objects.inv
# Source1-md5: 3d3c0b594b2e91d559418c107d973633
Patch0: %{name}-offline.patch
-URL: https://pypi.python.org/pypi/py
+URL: https://pypi.org/project/py/
%if %{with python2}
-BuildRequires: python-devel >= 1:2.5
+BuildRequires: python-devel >= 1:2.7
BuildRequires: python-setuptools >= 7.0
+BuildRequires: python-setuptools_scm
+%if %{with tests}
+%if %(locale -a | grep -q '^C\.utf8$'; echo $?)
+BuildRequires: glibc-localedb-all
+%endif
+BuildRequires: python-pytest >= 2.9.0
+%endif
%endif
%if %{with python3}
-BuildRequires: python3-devel >= 1:3.2
-BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-devel >= 1:3.4
+BuildRequires: python3-modules >= 1:3.4
BuildRequires: python3-setuptools >= 7.0
+BuildRequires: python3-setuptools_scm
+%if %{with tests}
+%if %(locale -a | grep -q '^C\.utf8$'; echo $?)
+BuildRequires: glibc-localedb-all
+%endif
+BuildRequires: python3-pytest >= 2.9.0
+%endif
%endif
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
+BuildRequires: rpmbuild(macros) >= 1.710
%{?with_doc:BuildRequires: sphinx-pdg >= 1.0}
%{?with_doc:BuildRequires: python-devel-tools}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
- py.iniconfig - łatwa analiza plików .ini
- py.code - dynamiczne generowanie kodu i introspekcji
+%package apidocs
+Summary: Documentation for Python py library
+Summary(pl.UTF-8): Dokumentacja do biblioteki Pythona py
+Group: Documentation
+
+%description apidocs
+Documentation for Python py library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja do biblioteki Pythona py.
+
%prep
%setup -q -n %{module}-%{version}
%patch0 -p1
%build
%if %{with python2}
-%py_build \
- --build-base build-2
+%py_build
+
+%if %{with tests}
+LC_ALL=C.UTF-8 \
+%{__python} -m pytest testing
+%endif
%endif
%if %{with python3}
-%py3_build \
- --build-base build-3
+%py3_build
+
+%if %{with tests}
+LC_ALL=C.UTF-8 \
+%{__python3} -m pytest testing
+%endif
%endif
%if %{with doc}
%endif
%if %{with python3}
-%{__python3} -- setup.py \
- build --build-base build-3 \
- install \
- --root=$RPM_BUILD_ROOT \
- --optimize=2
-
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/py/test.py
+%py3_install
%endif
%clean
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc CHANGELOG LICENSE README.txt %{?with_doc:doc/_build/html}
+%doc AUTHORS CHANGELOG LICENSE README.rst
%{py_sitescriptdir}/%{module}
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-py
%defattr(644,root,root,755)
-%doc CHANGELOG LICENSE README.txt %{?with_doc:doc/_build/html}
+%doc AUTHORS CHANGELOG LICENSE README.rst
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc doc/_build/html/{_modules,_static,announce,*.html,*.js}
+%endif