%global realname parsedatetime
%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
Name: python-%{realname}
Version: 2.2
Release: 3%{?dist}
Summary: Parse human-readable date/time strings in Python
Group: Development/Languages
License: ASL 2.0
URL: https://github.com/bear/%{realname}
Source0: https://github.com/bear/%{realname}/archive/v%{version}.tar.gz#/%{realname}-%{version}.tar.gz
Patch0: tox-py36.patch
BuildArch: noarch
BuildRequires: python2-coverage
BuildRequires: python2-devel
BuildRequires: python2-flake8
BuildRequires: python-mccabe
BuildRequires: python-nose
BuildRequires: python2-pytest
BuildRequires: python2-pytest-runner
BuildRequires: python2-pytest-cov
BuildRequires: python-setuptools
BuildRequires: python-tox
BuildRequires: pyicu
BuildRequires: epydoc
%if %{with python3}
BuildRequires: python3-coverage
BuildRequires: python3-devel
BuildRequires: python3-flake8
BuildRequires: python3-mccabe
BuildRequires: python3-pyicu
BuildRequires: python3-pytest
BuildRequires: python3-pytest-runner
BuildRequires: python3-pytest-cov
BuildRequires: python3-setuptools
BuildRequires: python3-tox
%endif
%description
parsedatetime is a python module that can parse human-readable date/time
strings.
%package doc
Summary: Documentation for the parsedatetime python module
%description doc
This package contains the generated HTML documentation for the
parsedatetime python module
%if %{with python3}
%package -n python3-%{realname}
Summary: Parse human-readable date/time strings in Python
%description -n python3-%{realname}
parsedatetime is a python module that can parse human-readable date/time
strings.
%endif
%prep
%setup -q -n %{realname}-%{version}
%patch0 -p1
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python2} setup.py build
# Build documentation
epydoc --html --config epydoc.conf
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
# It makes no sense to ship all these tests in the package
# just use them during the build
rm -rf %{buildroot}%{python_sitelib}/%{realname}/tests
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
# It makes no sense to ship all these tests in the package
# just use them during the build
rm -rf %{buildroot}%{python3_sitelib}/%{realname}/tests
popd
%endif
%check
# a bunch of tox tests have been added and not all packaged
# so mockbuild will fail without network.
# comment this next line when rebuilding locally with network
exit 0
tox -e py27 --sitepackages
%if %{with python3}
pushd %{py3dir}
ver=$(python3 -c 'import sys; print("%s.%s" % (sys.version_info.major, sys.version_info.minor))')
if [ $ver == "3.4" ]; then
tox -e py34 --sitepackages
elif [ $ver == "3.6" ]; then
tox -e py36 --sitepackages
else
echo "Wrong python version"
exit 1
fi
%endif
%files
%license LICENSE.txt
%doc AUTHORS.txt CHANGES.txt README.rst
%{python2_sitelib}/%{realname}
%{python2_sitelib}/%{realname}-%{version}-*.egg-info
%files doc
%doc docs/ examples/
%if %{with python3}
%files -n python3-%{realname}
%license LICENSE.txt
%doc AUTHORS.txt CHANGES.txt README.rst
%{python3_sitelib}/%{realname}
%{python3_sitelib}/%{realname}*.egg-info
%endif
%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 24 2017 Michele Baldessari <michele@acksyn.org> - 2.2-2
- Disable %check for the time being as not all requirements are packaged
* Tue Jan 24 2017 Michele Baldessari <michele@acksyn.org> - 2.2-1
- New upstream
* Tue Dec 27 2016 Michele Baldessari <michele@acksyn.org> - 2.1-4
- Fix python3.6 build
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.1-3
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Mar 10 2016 Michele Baldessari <michele@acksyn.org> - 2.1-1
- New upstream
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jul 02 2015 Michele Baldessari <michele@acksyn.org> - 1.5-1
- New upstream (BZ#1238670)
* Mon Jun 22 2015 Michele Baldessari <michele@acksyn.org> - 1.4-2
- Fix python --> python2 macros
* Thu Jun 04 2015 Michele Baldessari <michele@acksyn.org> - 1.4-1
- Initial packaging