From 063d1b22f1fdfcf277f1b76fa8190aa571643ada Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Dec 08 2015 14:52:22 +0000 Subject: Build for epel7 --- diff --git a/.gitignore b/.gitignore index e69de29..2cbdc9b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/parsedatetime-1.5.tar.gz diff --git a/fix-non-executable-script-init.patch b/fix-non-executable-script-init.patch new file mode 100644 index 0000000..a7a00b9 --- /dev/null +++ b/fix-non-executable-script-init.patch @@ -0,0 +1,8 @@ +diff -up parsedatetime-1.4/parsedatetime/__init__.py.orig parsedatetime-1.4/parsedatetime/__init__.py +--- parsedatetime-1.4/parsedatetime/__init__.py.orig 2015-06-04 20:20:30.547391210 +0200 ++++ parsedatetime-1.4/parsedatetime/__init__.py 2015-06-04 20:20:36.820432846 +0200 +@@ -1,4 +1,3 @@ +-#!/usr/bin/env python + # -*- coding: utf-8 -*- + # + # vim: sw=2 ts=2 sts=2 diff --git a/python-parsedatetime.spec b/python-parsedatetime.spec new file mode 100644 index 0000000..c93d52c --- /dev/null +++ b/python-parsedatetime.spec @@ -0,0 +1,130 @@ +%global realname parsedatetime + +%if 0%{?fedora} +%bcond_without python3 +%else +%bcond_with python3 +%endif + +Name: python-%{realname} +Version: 1.5 +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: fix-non-executable-script-init.patch +Patch1: test-failure-eom-is-correct-but-expectation-is-wrong.patch + +BuildArch: noarch +BuildRequires: python2-devel +BuildRequires: python-setuptools +BuildRequires: epydoc +%if %{with python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%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 +%patch1 -p1 + +# Fixes spurious-executable-perm warning +chmod 644 implementation_notes.txt + +%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 +%{__python2} run_tests.py + +%if %{with python3} +pushd %{py3dir} +%{__python3} run_tests.py test +%endif + + +%files +%license LICENSE.txt +%doc AUTHORS.txt CHANGES.txt INSTALL.txt README.rst THANKS.txt +%{python2_sitelib}/%{realname} +%{python2_sitelib}/%{realname}-%{version}-*.egg-info + +%files doc +%doc docs/ examples/ implementation_notes.txt locale_date_grouping_notes.txt + +%if %{with python3} +%files -n python3-%{realname} +%license LICENSE.txt +%doc AUTHORS.txt CHANGES.txt INSTALL.txt README.rst THANKS.txt +%{python3_sitelib}/%{realname} +%{python3_sitelib}/%{realname}*.egg-info +%endif + +%changelog +* Fri Dec 04 2015 Robert Buchholz - 1.5-3 +- Fix test failure in December + +* Tue Nov 10 2015 Fedora Release Engineering - 1.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Thu Jul 02 2015 Michele Baldessari - 1.5-1 +- New upstream (BZ#1238670) +* Mon Jun 22 2015 Michele Baldessari - 1.4-2 +- Fix python --> python2 macros +* Thu Jun 04 2015 Michele Baldessari - 1.4-1 +- Initial packaging diff --git a/sources b/sources index e69de29..8f0b9dc 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +f7b6b8258728ca9aa2ef536b3f221baf parsedatetime-1.5.tar.gz diff --git a/test-failure-eom-is-correct-but-expectation-is-wrong.patch b/test-failure-eom-is-correct-but-expectation-is-wrong.patch new file mode 100644 index 0000000..6f1b321 --- /dev/null +++ b/test-failure-eom-is-correct-but-expectation-is-wrong.patch @@ -0,0 +1,37 @@ +From 617f7d9dfc43855df2207dcd43ca25d140bf7b46 Mon Sep 17 00:00:00 2001 +From: Robert Buchholz +Date: Fri, 4 Dec 2015 01:07:32 +0100 +Subject: [PATCH] Test failure: eom is correct, but expectation is wrong + +This test fails in december, because the source time of calculation (s) +is in the next year (because it is generated after yr += 1). + +Upstream PR: +https://github.com/bear/parsedatetime/pull/146 + +--- + parsedatetime/tests/TestStartTimeFromSourceTime.py | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/parsedatetime/tests/TestStartTimeFromSourceTime.py b/parsedatetime/tests/TestStartTimeFromSourceTime.py +index 586bae9..8f5a1db 100644 +--- a/parsedatetime/tests/TestStartTimeFromSourceTime.py ++++ b/parsedatetime/tests/TestStartTimeFromSourceTime.py +@@ -26,13 +26,12 @@ class test(unittest.TestCase): + # to get the end of the current month + (yr, mth, dy, hr, mn, sec, _, _, _) = s.timetuple() + +- m = mth ++ s = datetime.datetime(yr, mth, dy, 13, 14, 15) ++ + mth += 1 + if mth > 12: + mth = 1 + yr += 1 +- +- s = datetime.datetime(yr, m, dy, 13, 14, 15) + t = datetime.datetime(yr, mth, 1, 13, 14, 15) + datetime.timedelta(days=-1) + + start = s.timetuple() +-- +2.5.0