Blob Blame History Raw
%global upname patsy

%global with_python3 1
Name: python-%{upname}
Version: 0.2.1
Release: 2%{?dist}
Summary: Describing statistical models in Python using symbolic formulas

Group: Development/Languages
# All code is under BSD except patsy.compat that is under Python
# See LICENSE.txt for details
License: BSD and Python

URL: https://github.com/pydata/patsy
Source0: https://pypi.python.org/packages/source/p/patsy/patsy-%{version}.tar.gz
# Disable test if pandas not present
Patch0: patsy-nopandas.patch

BuildArch: noarch

BuildRequires: python2-devel python-nose
# For the docs
BuildRequires: python-sphinx python-matplotlib python-ipython-console
BuildRequires: numpy
# For splines
BuildRequires: scipy  
BuildRequires: python-pandas
Requires: numpy scipy python-pandas

%description
A Python package for describing statistical models and for building design 
matrices. It is closely inspired by and compatible with the 'formula' 
mini-language used in R and S.

%package doc
Summary: Documentation for %{name}, includes full API docs
BuildArch: noarch

%description doc
This package contains the full API documentation for %{name}.

%if 0%{?with_python3}
%package -n python3-%{upname}
Summary: Describing statistical models in Python using symbolic formulas
BuildRequires: python3-devel python3-nose
# For the docs
BuildRequires: python3-sphinx python3-matplotlib python3-ipython-console
BuildRequires: python3-numpy
# For splines
BuildRequires: python3-scipy  
# No python3-pandas
# BuildRequires: python3-pandas
Requires: python3-numpy python3-scipy

%description -n python3-%{upname}
A Python package for describing statistical models and for building design 
matrices. It is closely inspired by and compatible with the 'formula' 
mini-language used in R and S.

%package -n python3-%{upname}-doc
Summary: Documentation for %{name}, includes full API docs
BuildArch: noarch

%description -n python3-%{upname}-doc
This package contains the full API documentation for %{name}.

%endif # with_python3

%prep
%setup -q -n %{upname}-%{version}
%patch0 -p1

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

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%build
%{__python2} setup.py build
%{__python2} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
# Creating the docs with python3-sphinx doesn't work
#%{__python3} setup.py build_sphinx
popd
%endif # with_python3

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

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

%check
pushd %{buildroot}/%{python2_sitelib}
nosetests-%{python2_version} patsy
popd
%if 0%{?with_python3}
pushd %{buildroot}/%{python3_sitelib}
nosetests-%{python3_version} patsy
popd
%endif # with_python3

%files
%doc LICENSE.txt README TODO
%{python2_sitelib}/patsy*

%files doc
%doc LICENSE.txt README TODO build/sphinx/html

%if 0%{?with_python3}
%files -n python3-%{upname}
%doc LICENSE.txt README TODO
%{python3_sitelib}/patsy*

%files -n python3-%{upname}-doc
%doc LICENSE.txt README TODO build/sphinx/html
%endif # with_python3

%changelog
* Sat Jan 11 2014 Sergio Pascual <sergio.pasra@gmail.com> - 0.2.1-2
- Split docs in a subpackage
- License is BSD and Python

* Fri Dec 13 2013 Sergio Pascual <sergio.pasra@gmail.com> - 0.2.1-1
- Initial specfile