#
# Conditional build:
%bcond_without doc # Sphinx documentation
+%bcond_without tests # unit tests
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
Summary: Python 2 module to parse, read and write Microsoft OLE2 files
Summary(pl.UTF-8): Moduł Pythona 2 do analizy, odczytu i zapisu plików Microsoft OLE2
Name: python-olefile
-Version: 0.44
-Release: 2
+Version: 0.46
+Release: 1
License: BSD
Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/olefile/
Source0: https://files.pythonhosted.org/packages/source/o/olefile/olefile-%{version}.zip
-# Source0-md5: fc625554e4e7f0c2ddcd00baa3c74ff5
-URL: https://pypi.python.org/pypi/olefile
+# Source0-md5: af351575e53aa00c36ae1c71ee9b0043
+URL: https://pypi.org/project/olefile
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
%if %{with python2}
-BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-modules >= 1:2.7
BuildRequires: python-setuptools
%endif
%if %{with python3}
-BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-modules >= 1:3.4
BuildRequires: python3-setuptools
%endif
BuildRequires: sed >= 4.0
-%{?with_doc:BuildRequires: sphinx-pdg}
-Requires: python-modules >= 1:2.6
+%if %{with doc}
+BuildRequires: python3-sphinx_rtd_theme
+BuildRequires: sphinx-pdg-3
+%endif
+Requires: python-modules >= 1:2.7
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
Summary: Python 3 module to parse, read and write Microsoft OLE2 files
Summary(pl.UTF-8): Moduł Pythona 3 do analizy, odczytu i zapisu plików Microsoft OLE2
Group: Libraries/Python
-Requires: python3-modules >= 1:3.2
+Requires: python3-modules >= 1:3.4
%description -n python3-olefile
Python 3 package to parse, read and write Microsoft OLE2 files (also
%prep
%setup -q -n olefile-%{version}
-# fix #!/usr/bin/env python -> #!/usr/bin/python:
-#%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
-
-%{__sed} -i -e 's/distutils\.core/setuptools/' setup.py
-
%build
%if %{with python2}
%py_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/build-2/lib \
+%{__python} tests/test_olefile.py
+%endif
%endif
%if %{with python3}
%py3_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/build-3/lib \
+%{__python3} tests/test_olefile.py
+%endif
%endif
%if %{with doc}
-%{__make} -C doc html
+%{__make} -C doc html \
+ SPHINXBUILD=sphinx-build-3
%endif
%install
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc README.md olefile/{CONTRIBUTORS.txt,LICENSE.txt}
-%{py_sitescriptdir}/OleFileIO_PL.py[co]
+%doc CONTRIBUTORS.txt LICENSE.txt README.md
%{py_sitescriptdir}/olefile
%{py_sitescriptdir}/olefile-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-olefile
%defattr(644,root,root,755)
-%doc README.md olefile/{CONTRIBUTORS.txt,LICENSE.txt}
-%{py3_sitescriptdir}/OleFileIO_PL.py
-%{py3_sitescriptdir}/__pycache__/OleFileIO_PL.cpython-*.py[co]
+%doc CONTRIBUTORS.txt LICENSE.txt README.md
%{py3_sitescriptdir}/olefile
%{py3_sitescriptdir}/olefile-%{version}-py*.egg-info
%endif