[python-ngram/el6] initial import (#1096188)

Björn Esser besser82 at fedoraproject.org
Fri May 9 14:14:29 UTC 2014


commit 09a261ba13bdb880ff3ecf75f54041cfa50dfe67
Author: Björn Esser <bjoern.esser at gmail.com>
Date:   Fri May 9 16:13:57 2014 +0200

    initial import (#1096188)

 .gitignore        |    5 ++
 python-ngram.spec |  181 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 sources           |    1 +
 3 files changed, 187 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..090749b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*~
+*.rpm
+*.tar*
+*.zip
+results_*/
diff --git a/python-ngram.spec b/python-ngram.spec
new file mode 100644
index 0000000..6801bc8
--- /dev/null
+++ b/python-ngram.spec
@@ -0,0 +1,181 @@
+# Conditional for release and snapshot builds. Uncomment for release-builds.
+%global rel_build 1
+
+# Failsafe backport of Python2-macros for RHEL <= 6
+%{!?python_sitelib:	%global python_sitelib		%(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python_sitearch:	%global python_sitearch		%(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%{!?python_version:	%global python_version		%(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
+%{!?__python2:		%global __python2		%{__python}}
+%{!?python2_sitelib:	%global python2_sitelib		%{python_sitelib}}
+%{!?python2_sitearch:	%global python2_sitearch	%{python_sitearch}}
+%{!?python2_version:	%global python2_version		%{python_version}}
+
+# Settings used for build from snapshots.
+%{!?rel_build:%global commit		282578b9ef65aa2ec72153d6eb1fcff5c273a42f}
+%{!?rel_build:%global commit_date	20121007}
+%{!?rel_build:%global shortcommit	%(c=%{commit};echo ${c:0:7})}
+%{!?rel_build:%global gitver		git%{commit_date}-%{shortcommit}}
+%{!?rel_build:%global gitrel		.git%{commit_date}.%{shortcommit}}
+%{!?rel_build:%global gittar		%{name}-%{version}-%{gitver}.tar.gz}
+%{?rel_build: %global gittar		%{name}-%{version}.tar.gz}
+
+# Can we build a Py3-pkg?
+%if 0%{?fedora} || 0%{?rhel} >= 8
+%global with_python3 1
+%endif #0%{?fedora} || 0%{?rhel} >= 8
+
+%global common_description						\
+The NGram class extends the Python 'set' class with efficient fuzzy	\
+search for members by means of an N-gram similarity measure.  It	\
+also has static methods to compare a pair of strings.			\
+									\
+The N-grams are character based not word-based, and the class does	\
+not implement a language model, merely searching for members by		\
+string similarity.
+
+%global pypi_name ngram
+
+Name:			python-%{pypi_name}
+Version:		3.3.0
+Release:		1%{?gitrel}%{?dist}
+Summary:		Set-based subclass providing fuzzy search based on N-grams
+
+License:		LGPLv3+
+URL:			https://github.com/gpoulter/%{name}
+# Sources for release-builds.
+%{?rel_build:Source0:	%{url}/archive/%{version}.tar.gz#/%{gittar}}
+# Sources for snapshot-builds.
+%{!?rel_build:Source0:	%{url}/archive/%{commit}.tar.gz#/%{gittar}}
+
+BuildArch:		noarch
+
+BuildRequires:		python-nose
+BuildRequires:		python2-devel
+
+%if 0%{?rhel} && 0%{?rhel} <= 6
+BuildRequires:		python-argparse
+
+Requires:		python-argparse
+%endif #0%{?rhel} && 0%{?rhel} <= 6
+
+%description
+%{common_description}
+
+
+%package doc
+Summary:		Documentation-files for %{name}
+
+# On RHEL <= 6 we need sphinx-10-build from EPEL.
+%if 0%{?fedora} || 0%{?rhel} >= 7
+BuildRequires:		python-sphinx
+%else #0%{?fedora} || 0%{?rhel} >= 7
+BuildRequires:		python-sphinx10
+%endif #0%{?fedora} || 0%{?rhel} >= 7
+
+%description doc
+This package contains the documentation-files for %{name}.
+
+
+%if 0%{?with_python3}
+%package -n python3-%{pypi_name}
+Summary:		Set-based subclass providing fuzzy search based on N-grams
+
+BuildRequires:		python3-devel
+BuildRequires:		python3-nose
+
+%description -n python3-%{pypi_name}
+%{common_description}
+%endif #0%{?with_python3}
+
+
+%prep
+%setup -q%{!?rel_build:n %{name}-%{commit}}
+rm -rf *%{pypi_name}*.egg-info
+
+# On RHEL <= 6 we need sphinx-10-build from EPEL.
+%if 0%{?rhel} && 0%{?rhel} <= 6
+sed -i -e 's!sphinx-build$!%{_bindir}/sphinx-1.0-build!' docs/Makefile
+%endif #0%{?rhel} && 0%{?rhel} <= 6
+
+# Fix path to script in testsuite.
+sed -i -e 's!csvjoin.py!scripts/&!g' tests/test_csvjoin.py
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif #0%{?with_python3}
+
+
+%build
+%{__python2} setup.py build
+
+# Build the autodocs.
+pushd docs
+make %{?_smp_mflags} html
+rm -f _build/html/.buildinfo
+find _build/html -type f -print0 | xargs -0 sed -i -e 's!\r$!!'
+popd
+
+# Build the Python3-version.
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif #0%{?with_python3}
+
+
+%install
+# Prefer the scripts in %%{_bindir} from Python2-pkg.
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
+rm -f %{buildroot}%{_bindir}/*
+popd
+%endif #0%{?with_python3}
+
+%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
+
+# Fixup the hashbang in Python-scripts.
+# Remove the file-ext from Python-scripts.
+for _file in %{buildroot}/%{_bindir}/*
+do
+  _new="`echo ${_file} | sed -e 's!.py$!!'`"
+  sed -e '1s@^#!.*python$@#!%{__python2}@' < ${_file} > ${_new} &&	\
+  chmod 0755 ${_new} &&							\
+  touch -r ${_file} ${_new} &&						\
+  rm -f ${_file}
+done
+
+
+%check
+export PYTHONPATH="`pwd`"
+nosetests -v
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+export PYTHONPATH="`pwd`"
+nosetests-%{python3_version} -v
+popd
+%endif #0%{?with_python3}
+ 
+%files
+%doc COPYING* README
+%{_bindir}/csvjoin
+%{python2_sitelib}/%{pypi_name}.py*
+%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
+
+%files doc
+%doc COPYING* README docs/_build/html
+
+%if 0%{?with_python3}
+%files -n python3-%{pypi_name}
+%doc COPYING* README
+%{python3_sitelib}/__pycache__/%{pypi_name}.cpython-%(echo %{python3_version} | sed -e 's!\.!!g').py?
+%{python3_sitelib}/%{pypi_name}.py*
+%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
+%endif #0%{?with_python3}
+
+
+%changelog
+* Fri May 09 2014 Björn Esser <bjoern.esser at gmail.com> - 3.3.0-1
+- initial rpm release (#1096188)
diff --git a/sources b/sources
index e69de29..42dd733 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+e1479aa66a05476709a2deed62d777f5  python-ngram-3.3.0.tar.gz


More information about the scm-commits mailing list