|
Björn Esser |
09a261b |
# Conditional for release and snapshot builds. Uncomment for release-builds.
|
|
|
a363dd3 |
#global rel_build 1
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# Settings used for build from snapshots.
|
|
|
a363dd3 |
%{!?rel_build:%global commit 325e2798e7fac914d94ccfbbd96a244ab5494a24}
|
|
|
a363dd3 |
%{!?rel_build:%global commit_date 20161104}
|
|
Björn Esser |
09a261b |
%{!?rel_build:%global shortcommit %(c=%{commit};echo ${c:0:7})}
|
|
Björn Esser |
09a261b |
%{!?rel_build:%global gitver git%{commit_date}-%{shortcommit}}
|
|
Björn Esser |
09a261b |
%{!?rel_build:%global gitrel .git%{commit_date}.%{shortcommit}}
|
|
Björn Esser |
09a261b |
%{!?rel_build:%global gittar %{name}-%{version}-%{gitver}.tar.gz}
|
|
Björn Esser |
09a261b |
%{?rel_build: %global gittar %{name}-%{version}.tar.gz}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%if 0%{?fedora} || 0%{?rhel} >= 8
|
|
|
a363dd3 |
%bcond_without python3
|
|
|
a363dd3 |
%else # 0#{?fedora} || 0#{?rhel} >= 8
|
|
|
a363dd3 |
%bcond_with python3
|
|
|
a363dd3 |
%endif # 0#{?fedora} || 0#{?rhel} >= 8
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
%global common_desc \
|
|
Björn Esser |
09a261b |
The NGram class extends the Python 'set' class with efficient fuzzy \
|
|
Björn Esser |
09a261b |
search for members by means of an N-gram similarity measure. It \
|
|
Björn Esser |
09a261b |
also has static methods to compare a pair of strings. \
|
|
Björn Esser |
09a261b |
\
|
|
Björn Esser |
09a261b |
The N-grams are character based not word-based, and the class does \
|
|
Björn Esser |
09a261b |
not implement a language model, merely searching for members by \
|
|
Björn Esser |
09a261b |
string similarity.
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
%global common_sum Set-based subclass providing fuzzy search based on N-grams
|
|
Björn Esser |
09a261b |
%global pypi_name ngram
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
Name: python-%{pypi_name}
|
|
|
a363dd3 |
Version: 3.3.0
|
|
|
a363dd3 |
Release: 10%{?gitrel}%{?dist}
|
|
|
a363dd3 |
Summary: %{common_sum}
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
License: LGPLv3+
|
|
|
a363dd3 |
URL: https://github.com/gpoulter/%{name}
|
|
|
a363dd3 |
%if 0%{?rel_build}
|
|
|
a363dd3 |
Source0: %{url}/archive/%{version}.tar.gz#/%{gittar}
|
|
|
a363dd3 |
%else # 0%%{?rel_build}
|
|
|
a363dd3 |
Source0: %{url}/archive/%{commit}.tar.gz#/%{gittar}
|
|
|
a363dd3 |
%endif # 0%%{?rel_build}
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
BuildArch: noarch
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
BuildRequires: help2man
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%description
|
|
|
a363dd3 |
%{common_desc}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%package doc
|
|
|
a363dd3 |
Summary: Documentation-files for %{name}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# On RHEL <= 6 we need sphinx-10-build from EPEL.
|
|
Björn Esser |
09a261b |
%if 0%{?fedora} || 0%{?rhel} >= 7
|
|
Björn Esser |
09a261b |
BuildRequires: python-sphinx
|
|
Björn Esser |
09a261b |
%else #0%{?fedora} || 0%{?rhel} >= 7
|
|
Björn Esser |
09a261b |
BuildRequires: python-sphinx10
|
|
Björn Esser |
09a261b |
%endif #0%{?fedora} || 0%{?rhel} >= 7
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%description doc
|
|
Björn Esser |
09a261b |
This package contains the documentation-files for %{name}.
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
%package -n python2-%{pypi_name}
|
|
|
a363dd3 |
Summary: %{common_sum}
|
|
|
a363dd3 |
|
|
|
a363dd3 |
BuildRequires: python-nose
|
|
|
a363dd3 |
BuildRequires: python-setuptools
|
|
|
a363dd3 |
BuildRequires: python2-devel
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%if (0%{?rhel} && 0%{?rhel} <= 6)
|
|
|
a363dd3 |
BuildRequires: python-argparse
|
|
|
a363dd3 |
|
|
|
a363dd3 |
Requires: python-argparse
|
|
|
a363dd3 |
%endif # (0%%{?rhel} && 0%%{?rhel} <= 6)
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%{?python_provide:%python_provide python2-%{pypi_name}}
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%description -n python2-%{pypi_name}
|
|
|
a363dd3 |
%{common_desc}
|
|
|
a363dd3 |
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%if %{with python3}
|
|
Björn Esser |
09a261b |
%package -n python3-%{pypi_name}
|
|
|
a363dd3 |
Summary: %{common_sum}
|
|
|
a363dd3 |
|
|
|
a363dd3 |
BuildRequires: python3-devel
|
|
|
a363dd3 |
BuildRequires: python3-nose
|
|
|
a363dd3 |
BuildRequires: python3-setuptools
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
%{?python_provide:%python_provide python3-%{pypi_name}}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%description -n python3-%{pypi_name}
|
|
|
a363dd3 |
%{common_desc}
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%prep
|
|
|
a363dd3 |
%if 0%{?rel_build}
|
|
|
a363dd3 |
%autosetup -p 1
|
|
|
a363dd3 |
%else # 0%%{?rel_build}
|
|
|
a363dd3 |
%autosetup -n %{name}-%{commit} -p 1
|
|
|
a363dd3 |
%endif # 0%%{?rel_build}
|
|
|
a363dd3 |
%{__rm} -rf *.egg*
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# On RHEL <= 6 we need sphinx-10-build from EPEL.
|
|
|
a363dd3 |
%if (0%{?rhel} && 0%{?rhel} <= 6)
|
|
|
a363dd3 |
%{__sed} -i -e 's!sphinx-build$!%{_bindir}/sphinx-1.0-build!' \
|
|
|
a363dd3 |
docs/Makefile
|
|
|
a363dd3 |
%endif # (0%%{?rhel} && 0%%{?rhel} <= 6)
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# Fix path to script in testsuite.
|
|
|
a363dd3 |
%{__sed} -i -e 's!csvjoin.py!scripts/&!g' tests/test_csvjoin.py
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%build
|
|
|
a363dd3 |
%py2_build
|
|
|
a363dd3 |
%if %{with python3}
|
|
|
a363dd3 |
%py3_build
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# Build the autodocs.
|
|
Björn Esser |
09a261b |
pushd docs
|
|
|
a363dd3 |
%make_build html
|
|
|
a363dd3 |
%{__rm} -f _build/html/.buildinfo
|
|
|
a363dd3 |
%{_bindir}/find _build/html -type f -print0 | \
|
|
|
a363dd3 |
%{_bindir}/xargs -0 %{__sed} -i -e 's!\r$!!'
|
|
Björn Esser |
09a261b |
popd
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%install
|
|
|
a363dd3 |
%py2_install
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
# Fixup the hashbang in Python-scripts.
|
|
|
a363dd3 |
# Remove the file-ext from Python-scripts.
|
|
|
a363dd3 |
for _file in %{buildroot}/%{_bindir}/*.py ; do
|
|
|
a363dd3 |
_new="`/bin/echo ${_file} | %{__sed} -e 's!.py$!!'`"
|
|
|
a363dd3 |
%{__sed} -e '1s@^#!.*python$@#!%{__python2}@' \
|
|
|
a363dd3 |
< ${_file} > ${_new}
|
|
|
a363dd3 |
%{__chmod} 0755 ${_new}
|
|
|
a363dd3 |
/bin/touch -r ${_file} ${_new}
|
|
|
a363dd3 |
%{__rm} -f ${_file}
|
|
|
a363dd3 |
%if %{with python3}
|
|
|
a363dd3 |
%{__mv} -f ${_new} ${_new}-%{python2_version}
|
|
|
a363dd3 |
%else # %%{with python3}
|
|
|
a363dd3 |
/bin/ln -f ${_new} ${_new}-%{python2_version}
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
|
a363dd3 |
done
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%if %{with python3}
|
|
|
a363dd3 |
%py3_install
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
# Fixup the hashbang in Python-scripts.
|
|
Björn Esser |
09a261b |
# Remove the file-ext from Python-scripts.
|
|
|
a363dd3 |
for _file in %{buildroot}/%{_bindir}/*.py ; do
|
|
|
a363dd3 |
_new="`/bin/echo ${_file} | %{__sed} -e 's!.py$!!'`"
|
|
|
a363dd3 |
%{__sed} -e '1s@^#!.*python$@#!%{__python3}@' \
|
|
|
a363dd3 |
< ${_file} > ${_new}
|
|
|
a363dd3 |
%{__chmod} 0755 ${_new}
|
|
|
a363dd3 |
/bin/touch -r ${_file} ${_new}
|
|
|
a363dd3 |
%{__rm} -f ${_file}
|
|
|
a363dd3 |
/bin/ln -f ${_new} ${_new}-%{python3_version}
|
|
|
a363dd3 |
done
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%if 0%{?fedora} || 0%{?rhel} >= 7
|
|
|
a363dd3 |
# Create man-pages.
|
|
|
a363dd3 |
%{__mkdir} -p %{buildroot}%{_mandir}/man1
|
|
|
a363dd3 |
export PYTHONPATH="$(/bin/pwd)"
|
|
|
a363dd3 |
for _file in %{buildroot}%{_bindir}/* ; do
|
|
|
a363dd3 |
_of="$(/bin/basename ${_file}).1"
|
|
|
a363dd3 |
%{_bindir}/help2man --version-string='%{version}' -s 1 -N \
|
|
|
a363dd3 |
-o %{buildroot}%{_mandir}/man1/${_of} ${_file}
|
|
Björn Esser |
09a261b |
done
|
|
|
a363dd3 |
unset PYTHONPATH
|
|
|
a363dd3 |
%{_bindir}/find %{buildroot} -type f -name '*.pyc' -print -delete
|
|
|
a363dd3 |
%{_bindir}/find %{buildroot} -type f -name '*.pyo' -print -delete
|
|
|
a363dd3 |
%endif # 0%%{?fedora} || 0%%{?rhel} >= 7
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%check
|
|
|
a363dd3 |
export PYTHONPATH="$(/bin/pwd)"
|
|
|
a363dd3 |
%{_bindir}/nosetests -v
|
|
|
a363dd3 |
%if %{with python3}
|
|
|
a363dd3 |
%{_bindir}/nosetests-%{python3_version} -v
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
|
a363dd3 |
unset PYTHONPATH
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%files doc
|
|
|
a363dd3 |
%license COPYING*
|
|
|
a363dd3 |
%doc README docs/_build/html
|
|
|
a363dd3 |
|
|
|
a363dd3 |
|
|
|
a363dd3 |
%files -n python2-%{pypi_name}
|
|
|
a363dd3 |
%license COPYING*
|
|
|
a363dd3 |
%doc README
|
|
|
a363dd3 |
%if %{without python3}
|
|
Björn Esser |
09a261b |
%{_bindir}/csvjoin
|
|
|
a363dd3 |
%if 0%{?fedora} || 0%{?rhel} >= 7
|
|
|
a363dd3 |
%{_mandir}/man1/csvjoin.1*
|
|
|
a363dd3 |
%endif # 0%%{?fedora} || 0%%{?rhel} >= 7
|
|
|
a363dd3 |
%endif # %%{without python3}
|
|
|
a363dd3 |
%{_bindir}/csvjoin-%{python2_version}
|
|
|
a363dd3 |
%if 0%{?fedora} || 0%{?rhel} >= 7
|
|
|
a363dd3 |
%{_mandir}/man1/csvjoin-%{python2_version}.1*
|
|
|
a363dd3 |
%endif # 0%%{?fedora} || 0%%{?rhel} >= 7
|
|
|
a363dd3 |
%{python2_sitelib}/%{pypi_name}.py
|
|
|
a363dd3 |
%{python2_sitelib}/%{pypi_name}.py?
|
|
Björn Esser |
09a261b |
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
|
a363dd3 |
%if %{with python3}
|
|
Björn Esser |
09a261b |
%files -n python3-%{pypi_name}
|
|
|
a363dd3 |
%license COPYING*
|
|
|
a363dd3 |
%doc README
|
|
|
a363dd3 |
%{_bindir}/csvjoin
|
|
|
a363dd3 |
%{_bindir}/csvjoin-%{python3_version}
|
|
|
a363dd3 |
%{_mandir}/man1/csvjoin.1*
|
|
|
a363dd3 |
%{_mandir}/man1/csvjoin-%{python3_version}.1*
|
|
|
a363dd3 |
%{python3_sitelib}/__pycache__/%{pypi_name}.cpython-%{python3_version_nodots}*.py?
|
|
|
a363dd3 |
%{python3_sitelib}/%{pypi_name}.py
|
|
Björn Esser |
09a261b |
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
|
|
|
a363dd3 |
%endif # %%{with python3}
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
|
|
Björn Esser |
09a261b |
%changelog
|
|
|
a363dd3 |
* Sun Apr 09 2017 Björn Esser <besser82@fedoraproject.org> - 3.3.0-10.git20161104.325e279
|
|
|
a363dd3 |
- Updated to snapshot
|
|
|
a363dd3 |
- Provide main-binary in Python3-package (rhbz#1437181)
|
|
|
a363dd3 |
- Refactored spec to recent guidelines
|
|
|
a363dd3 |
- Add man-pages on Fedora and EPEL >= 7
|
|
|
a363dd3 |
|
|
|
a0f4500 |
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.0-9
|
|
|
a0f4500 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
|
|
a0f4500 |
|
|
|
87593e9 |
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.3.0-8
|
|
|
87593e9 |
- Rebuild for Python 3.6
|
|
|
87593e9 |
|
|
|
f902909 |
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-7
|
|
|
f902909 |
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
|
|
f902909 |
|
|
|
0b6e31a |
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.0-6
|
|
|
0b6e31a |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
|
|
0b6e31a |
|
|
|
d072c40 |
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-5
|
|
|
d072c40 |
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
|
|
Björn Esser |
a9e439a |
- Add pycache-glob for Python >= 3.5
|
|
|
d072c40 |
|
|
|
9a8a4a6 |
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-4
|
|
|
9a8a4a6 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
|
|
9a8a4a6 |
|
|
|
1d70897 |
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-3
|
|
|
1d70897 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
|
|
1d70897 |
|
|
|
23c5d24 |
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 3.3.0-2
|
|
|
23c5d24 |
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
|
|
|
23c5d24 |
|
|
Björn Esser |
09a261b |
* Fri May 09 2014 Björn Esser <bjoern.esser@gmail.com> - 3.3.0-1
|
|
Björn Esser |
09a261b |
- initial rpm release (#1096188)
|