Blob Blame History Raw
%global pypi_name dbfread
%global project_owner olemb
%global github_name dbfread
%global commit 300b2d7d907388cc3578d3fa4472e0419ccd34b9
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global desc DBF is a file format used by databases such dBase, Visual FoxPro, and \
FoxBase+. This library reads DBF files and returns the data as native Python \
data types for further processing. It is primarily intended for batch jobs and \
one-off scripts.\
\
Full documentation at https://dbfread.readthedocs.io/\
\
See docs/changes.rst for a full list of changes in each version.


Name:           python-%{pypi_name}
Version:        2.0.7
Release:        3.git%{shortcommit}%{?dist}
Summary:        Read DBF Files with Python

License:        MIT
URL:            https://pypi.python.org/pypi/dbfread
Source0:        https://github.com/%{project_owner}/%{github_name}/archive/%{commit}/%{github_name}-%{commit}.tar.gz
BuildArch:      noarch

%description
%{desc}


%package -n     python2-%{pypi_name}
BuildRequires:  python2-devel
BuildRequires:  python2-pytest
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
%{desc}


%package -n     python3-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
%{desc}


%package -n    python-%{pypi_name}-doc
Summary:       %{summary}
BuildRequires: python2-sphinx
BuildArch:     noarch

%description -n python-%{pypi_name}-doc
%{desc}

Documentation package.


%prep
%setup -qn %{github_name}-%{commit}
# Remove shebang in examples
sed -i '1{\@^#!/usr/bin/env python@d}' examples/{*.py,**/*.py,dbf2sqlite}
# Make sure examples are not executable
chmod -x examples/{*.py,**/*.py,dbf2sqlite}


%build
%py2_build
%py3_build

# Build documentation
pushd docs
    make html
    rm -f _build/html/.buildinfo
popd


%install
%py3_install
%py2_install


%check
# The script will launch pytest for Python 2 and 3.
python3 run_tests.py


%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info/
%{python2_sitelib}/%{pypi_name}/


%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{python3_sitelib}/%{pypi_name}/


%files -n python-%{pypi_name}-doc
%license LICENSE
%doc README.rst docs/_build/ examples


%changelog
* Tue Apr 04 2017 Julien Enselme <jujens@jujens.eu> - 2.0.7-3.git300b2d7
- Fix shebang in examples

* Mon Mar 13 2017 Julien Enselme <jujens@jujens.eu> - 2.0.7-2.git300b2d7
- Add dependency to sphinx to build the documentation

* Sun Mar 12 2017 Julien Enselme <jujens@jujens.eu> - 2.0.7-1.git300b2d7
- Inital package