Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif
%global real_name pyquery
%global with_tests 1

Name:           python-%{real_name}
Version:        1.4.0
Release:        1%{?dist}
Summary:        A jQuery-like library for python
Group:          Development/Libraries
License:        BSD
URL:            http://pypi.python.org/pypi/pyquery
Source0:        %pypi_source pyquery

# skip some tests that need network
Patch1:         python-pyquery-skip-test-requiring-net-connection.patch

BuildArch:      noarch
BuildRequires:  python2-devel, python2-setuptools

# test deps
BuildRequires:  python2-beautifulsoup
BuildRequires:  python2-cssselect
BuildRequires:  python2-lxml >= 2.1
BuildRequires:  python2-nose
BuildRequires:  python2-requests
BuildRequires:  python2-restkit
BuildRequires:  python2-webob
%if 0%{?with_tests}
BuildRequires:  python2-webtest
%endif

%global _description\
python-pyquery allows you to make jQuery queries on XML documents. The API is\
as much as possible the similar to jQuery. python-pyquery uses lxml for fast\
XML and HTML manipulation.

%description %_description

%package -n python2-pyquery
Summary: %summary
Requires:       python2-lxml >= 2.1
Requires:       python2-cssselect
%{?python_provide:%python_provide python2-pyquery}

%description -n python2-pyquery %_description

%if 0%{?with_python3}
%package -n python3-pyquery
Summary:        A jQuery-like library for python3
Group:          Applications/System
BuildRequires:  python3-devel, python3-setuptools

# test deps
BuildRequires:  python3-cssselect
BuildRequires:  python3-lxml >= 2.1
BuildRequires:  python3-nose
BuildRequires:  python3-requests
BuildRequires:  python3-webob
%if 0%{?with_tests}
BuildRequires:  python3-webtest
%endif

Requires:       python3-lxml >= 2.1
Requires:       python3-cssselect

%description -n python3-pyquery
python3-pyquery allows you to make jQuery queries on XML documents. The API is 
as much as possible the similar to jQuery. python-pyquery uses lxml for fast 
XML and HTML manipulation.

%endif #with_python3

%prep
%autosetup -n %{real_name}-%{version} -p1

%if 0%{?with_python3}
    rm -rf %{py3dir}
    cp -a . %{py3dir}
    find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

%build
%if 0%{?with_python3}
    pushd %{py3dir}
    %py3_build
    popd
%endif # with_python3

%py2_build


%install
%if 0%{?with_python3}
    pushd %{py3dir}
    %py3_install
    popd
%endif # with_python3

%py2_install


%check
%if 0%{?with_tests}
%if 0%{?with_python3}
    pushd %{py3dir}
    nosetests-%{python3_version}
    popd
%endif # with_python3

nosetests-2
%endif

%files -n python2-pyquery
%doc CHANGES.rst README.rst
%{python2_sitelib}/pyquery/
%{python2_sitelib}/pyquery*.egg-info/

%if 0%{?with_python3}
%files -n python3-pyquery
%doc CHANGES.rst README.rst
%{python3_sitelib}/pyquery/
%{python3_sitelib}/pyquery*.egg-info/
%endif

%changelog
* Wed Jul 25 2018 Pierre-Yves Chibon <pingou@pingoured.fr> - 1.4.0-1
- Update to 1.4.0

* Wed Jul 25 2018 Pierre-Yves Chibon <pingou@pingoured.fr> - 1.3.0-7
- Use the py2 version of the macros

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-6
- Rebuilt for Python 3.7

* Sun Jun 17 2018 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-5
- Bootstrap for Python 3.7

* Wed Feb 28 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.3.0-4
- Use /usr/bin/python2 instead of /usr/bin/python when building and installing.

* Tue Feb 27 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.3.0-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Dec 18 2017 Kevin Fenzi <kevin@scrye.com> - 1.3.0-1
- Update to 1.3.0. Fixes bug #1505136

* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 1.2.17-7
- Cleanup spec file conditionals

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.2.17-6
- Python 2 binary package renamed to python2-pyquery
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.17-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild