# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals
# http://rpm.org/user_doc/conditional_builds.html
%if 0%{?fedora} >= 30
# disabled by default
%bcond_with py2
%else
%bcond_without py2
%endif
# Upstream does not use tags, so I'm using the commit that released this
# version
%global commit d1893e5ef37da6850f50d45476ac207b9c7bfc75
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%bcond_without tests
%global srcname pymatreader
%global desc %{expand: \
A Python module to read Matlab files. This module works with both the old (<
7.3) and the new (>= 7.3) HDF5 based format. The output should be the same for
both kinds of files.
Documentation can be found here: http://pymatreader.readthedocs.io/en/latest/}
Name: python-%{srcname}
Version: 0.0.19
Release: 2%{?dist}
Summary: Convenient reader for Matlab mat files
License: BSD
URL: https://pypi.python.org/pypi/%{srcname}
Source0: https://gitlab.com/obob/%{srcname}/-/archive/%{commit}/%{srcname}-%{shortcommit}.tar.gz
BuildArch: noarch
%{?python_enable_dependency_generator}
%description
%{desc}
%if %{with py2}
%package -n python2-%{srcname}
Summary: %{summary}
BuildRequires: python2-devel
BuildRequires: %{py2_dist scipy}
BuildRequires: %{py2_dist numpy}
BuildRequires: %{py2_dist nose}
BuildRequires: %{py2_dist xmltodict}
BuildRequires: %{py2_dist h5py}
BuildRequires: %{py2_dist twine}
BuildRequires: %{py2_dist future}
BuildRequires: %{py2_dist wheel}
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
%{desc}
%endif
%package -n python3-%{srcname}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: %{py3_dist sphinx}
BuildRequires: %{py3_dist sphinx_rtd_theme}
BuildRequires: %{py3_dist scipy}
BuildRequires: %{py3_dist numpy}
BuildRequires: %{py3_dist nose}
BuildRequires: %{py3_dist xmltodict}
BuildRequires: %{py3_dist h5py}
BuildRequires: %{py3_dist twine}
BuildRequires: %{py3_dist future}
BuildRequires: %{py3_dist wheel}
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
%{desc}
%package doc
Summary: %{summary}
%description doc
Documentation for %{name}.
%prep
%autosetup -n %{srcname}-%{commit}
rm -rf %{srcname}.egg-info
%build
%py3_build
%if %{with py2}
%py2_build
%endif
pushd doc
make SPHINXBUILD=sphinx-build-3 html
rm -rf build/html/.doctrees
rm -rf build/html/.buildinfo
# conver to utf8
pushd build/html
iconv --from=ISO-8859-1 --to=UTF-8 objects.inv > objects.inv.new && \
touch -r objects.inv objects.inv.new && \
mv objects.inv.new objects.inv
popd
popd
%install
%if %{with py2}
%py2_install
%endif
%py3_install
%check
%if %{with tests}
%if %{with py2}
nosetests-%{python2_version}
%endif
nosetests-%{python3_version}
%endif
%if %{with py2}
%files -n python2-%{srcname}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info
%{python2_sitelib}/%{srcname}
%endif
%files -n python3-%{srcname}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
%{python3_sitelib}/%{srcname}
%files doc
%license LICENSE
%doc doc/build/html
%changelog
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.19-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Apr 08 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.0.19-1
- Update to latest upstream release 0.0.19
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Nov 20 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.0.17-1
- Initial build