Blob Blame History Raw
%global pypi_name yaql

%{!?python2_shortver: %global python2_shortver %(%{__python2} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}

%if 0%{?fedora}
%global with_python3 1
%{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}
%endif


Name:           python-%{pypi_name}
Version:        1.1.0
Release:        3%{?dist}
Summary:        Yet Another Query Language

License:        ASL 2.0
URL:            https://pypi.python.org/pypi/%{pypi_name}
Source0:        http://pypi.python.org/packages/source/y/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

BuildArch:      noarch

%description
YAQL library has a out of the box large set of commonly used functions.

%package -n     python2-%{pypi_name}
Summary:        YAQL library has a out of the box large set of commonly used functions.
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
BuildRequires:  python-pbr
BuildRequires:  python-sphinx
BuildRequires:  python-oslo-sphinx

Requires:       python-six
Requires:       python-pbr
Requires:       python-babel
Requires:       python-ply
Requires:       python-dateutil

%description -n python2-%{pypi_name}
YAQL library has a out of the box large set of commonly used functions


# Python3 package
%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        YAQL library has a out of the box large set of commonly used functions.
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python-tools
BuildRequires:  python3-pbr
BuildRequires:  python3-sphinx
BuildRequires:  python3-oslo-sphinx

Requires:       python3-six
Requires:       python3-pbr
Requires:       python3-babel
Requires:       python3-ply
Requires:       python3-dateutil

%description -n python3-%{pypi_name}
YAQL library has a out of the box large set of commonly used functions.
%endif

# Documentation package
%package -n python-%{pypi_name}-doc
Summary:        Documentation for YAQL library

%description -n python-%{pypi_name}-doc
Documentation for YAQL library


%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# Let RPM handle the dependencies
rm -f test-requirements.txt requirements.txt

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3 --write --nobackups %{py3dir}
%endif

%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.UTF-8 %{__python3} setup.py build
popd
%endif
# generate html docs 
sphinx-build doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.UTF-8 %{__python3} setup.py install --skip-build --root %{buildroot}
mv %{buildroot}/%{_bindir}/%{pypi_name} %{buildroot}/%{_bindir}/python3-%{pypi_name}
popd
%endif

%{__python2} setup.py install --skip-build --root %{buildroot}

# rename binaries, make compat symlinks
pushd %{buildroot}%{_bindir}
for i in %{pypi_name}-{2,%{?python2_shortver}}; do
    ln -sf %{pypi_name} $i
done

%if 0%{?with_python3}
for i in %{pypi_name}-{3,%{?python3_shortver}}; do
    ln -sf  python3-%{pypi_name} $i
done
%endif
popd

# Delete tests
rm -fr %{buildroot}%{python_sitelib}/tests

 
%files -n python2-%{pypi_name}
%license LICENSE
%doc doc/source/readme.rst README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{_bindir}/%{pypi_name}-2*
%{_bindir}/%{pypi_name}

# Files for python3
%if 0%{?with_python3}
%files -n python3-%{pypi_name} 
%license LICENSE
%doc doc/source/readme.rst README.rst
%{_bindir}/python3-%{pypi_name}
%{_bindir}/%{pypi_name}-3*
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif

%files -n python-%{pypi_name}-doc
%doc html
%license LICENSE


%changelog
* Mon Aug 22 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.0-3
- Fix Requires in python2-yaql

* Fri Apr  8 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.0-2
- Fix RHBZ#1282081

* Fri Apr  8 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.0-1
- Upstream 1.1.0

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Nov 18 2015 Marcos Fermin Lobo <marcos.fermin.lobo@cern.ch> 1.0.2-1.el7
- Update to 1.0.2

* Thu Nov 12 2015 Kalev Lember <klember@redhat.com> - 0.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Aug 26 2015 Marcos Fermin Lobo <marcos.fermin.lobo@cern.ch> 0.2.7-1
- First RPM for FC23