[grin] Add patch to work with Python 2.7 and later Add argparse req. if needed

terjeros terjeros at fedoraproject.org
Mon May 9 17:32:53 UTC 2011


commit e37e158dcabcca84182686315fa6aab3af77b12f
Author: Terje Røsten <terje.rosten at ntnu.no>
Date:   Mon May 9 19:32:42 2011 +0200

    Add patch to work with Python 2.7 and later
    Add argparse req. if needed

 grin-1.2.1-argparse.patch |   31 +++++++++++++++++++++++++++++++
 grin.spec                 |   19 ++++++++++++++++---
 2 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/grin-1.2.1-argparse.patch b/grin-1.2.1-argparse.patch
new file mode 100644
index 0000000..5f261bb
--- /dev/null
+++ b/grin-1.2.1-argparse.patch
@@ -0,0 +1,31 @@
+--- grin-1.2.1/setup.py~	2010-08-08 01:44:07.000000000 +0200
++++ grin-1.2.1/setup.py	2011-05-09 15:37:19.024527713 +0200
+@@ -1,4 +1,5 @@
+ import os
++import sys
+ from setuptools import setup
+ 
+ kwds = {}
+@@ -9,6 +10,11 @@
+ kwds['long_description'] = f.read()
+ f.close()
+ 
++# argparse part of python 2.7 and 3.2
++if sys.version_info < (2, 7, 0):
++    install_requires = ['argparse >= 1.1']
++else:
++    install_requires = []
+ 
+ setup(
+     name = 'grin',
+@@ -34,9 +40,7 @@
+             "grind = grin:grind_main",
+         ],
+     ),
+-    install_requires = [
+-        'argparse >= 1.1',
+-    ],
++    install_requires = install_requires,
+     tests_require = [
+         'nose >= 0.10',
+     ],
diff --git a/grin.spec b/grin.spec
index 8ed8d44..5631af2 100644
--- a/grin.spec
+++ b/grin.spec
@@ -1,3 +1,7 @@
+%if 0%{?fedora} < 15 || 0%{?rhel} < 7
+%global need_argparse 1
+%endif
+
 %if ! (0%{?rhel} > 5)
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 %endif
@@ -6,12 +10,16 @@
 Summary:       Grep-like tool for source code
 Name:          grin
 Version:       1.2.1
-Release:       2%{?dist}
+Release:       3%{?dist}
 License:       BSD
 Group:         Applications/Text
 URL:           http://pypi.python.org/pypi/grin
 Source0:       http://pypi.python.org/packages/source/g/grin/%{name}-%{version}.tar.gz
+Patch0:        grin-1.2.1-argparse.patch
 Requires:      python-setuptools
+%if 0%{?need_argparse}
+Requires:      python-argparse
+%endif
 BuildArch:     noarch
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: python-setuptools-devel python-nose
@@ -36,6 +44,7 @@ Some features grin feature are:
 
 %prep
 %setup -q
+%patch0 -p1
 %{__chmod} 0644 examples/*
 %{__sed} -i -e '1d' grin.py
 
@@ -61,6 +70,10 @@ nosetests
 %{python_sitelib}/%{name}-%{version}-py%{pyver}.egg-info/
 
 %changelog
+* Mon May 09 2011 Terje Rosten <terje.rosten at ntnu.no> - 1.2.1-2
+- Add patch to work with Python 2.7 and later
+- Add argparse req. if needed
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.1-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
@@ -68,8 +81,8 @@ nosetests
 - 1.2.1
 
 * Sun Dec 26 2010 Thomas Spura <tomspur at fedoraproject.org> - 1.1.1-5
-- update python_sitelib macro
-- don't requires python-argparse (#665727)
+- Update python_sitelib macro
+- Don't requires python-argparse (#665727)
 
 * Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 1.1.1-4
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild


More information about the scm-commits mailing list