Blob Blame History Raw
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif

%global modname sieve

Name:             python-sieve
Version:          0.1.6
Release:          7%{?dist}
Summary:          XML Comparison Utils

Group:            Development/Libraries
License:          MIT
URL:              http://pypi.python.org/pypi/sieve
Source0:          http://pypi.python.org/packages/source/s/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:        noarch


BuildRequires:    python2-devel
BuildRequires:    python-six
BuildRequires:    python-lxml
BuildRequires:    python-nose

%if 0%{?with_python3}
BuildRequires:    python3-devel
BuildRequires:    python3-six
BuildRequires:    python3-lxml
BuildRequires:    python3-nose
%endif

Requires:   python-six
Requires:   python-lxml


%description
Ripped from FormEncode and strainer just to support Pythons 2 and 3.
Intended for use in your webapp test suites.

Example usage::

    >>> from sieve.operators import eq_xml, in_xml 
    >>> a = "<foo><bar>Value</bar></foo>" 
    >>> b = """ 
    ... <foo> 
    ...     <bar>
    ...         Value 
    ...     </bar> 
    ... </foo> 
    ... """
    >>> eq_xml(a, b)
    True 
    >>> c = "<html><body><foo><bar>Value</bar></foo></body></html"
    >>> in_xml(a, c)  # 'needle' in a 'haystack'
    True


%if 0%{?with_python3}
%package -n python3-sieve
Summary:        XML Comparison Utils
Group:          Development/Libraries

Requires:   python3-six
Requires:   python3-lxml

%description -n python3-sieve
Ripped from FormEncode and strainer just to support Pythons 2 and 3.
Intended for use in your webapp test suites.

Example usage::

    >>> from sieve.operators import eq_xml, in_xml 
    >>> a = "<foo><bar>Value</bar></foo>" 
    >>> b = """ 
    ... <foo> 
    ...     <bar>
    ...         Value 
    ...     </bar> 
    ... </foo> 
    ... """
    >>> eq_xml(a, b)
    True 
    >>> c = "<html><body><foo><bar>Value</bar></foo></body></html"
    >>> in_xml(a, c)  # 'needle' in a 'haystack'
    True
%endif

%prep
%setup -q -n %{modname}-%{version}

rm -rf %{modname}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif

%{__python} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%{__python} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif


%files
%doc README.rst LICENSE.txt
%{python_sitelib}/%{modname}
%{python_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-%{modname}
%doc LICENSE.txt README.rst
%{python3_sitelib}/%{modname}
%{python3_sitelib}/%{modname}-%{version}-*

%endif


%changelog
* Sat Nov 03 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-7
- Move python3 requirements into the correct section.

* Tue Oct 30 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-6
- Bump release to get around a koji hiccup again.

* Mon Oct 22 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-5
- Bump release to get around a koji hiccup.

* Tue Sep 25 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-4
- Added requirement on python3-six back in since that package has been split.

* Mon Sep 24 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-3
- Removed upstream egg-info in prep section.

* Fri Jun 22 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-2
- Fix to python-six dependencies.  (no python3-six)

* Fri Jun 22 2012 Ralph Bean <rbean@redhat.com> - 0.1.6-1
- Initial package for Fedora