Blob Blame History Raw
%global with_python3 1
%global upname statsmodels

Name: python-%{upname}
Version: 0.6.1
Release: 1%{?dist}
Summary: Statistics in Python
# Package is licensed under BSD (3 clauses)
# except the following files in Public Domain
# statsmodels/datasets/elnino/data.py
# statsmodels/datasets/randhie/data.py
License: BSD and Public Domain

URL: http://statsmodels.sourceforge.net/
Source0: http://pypi.python.org/packages/source/s/statsmodels/%{upname}-%{version}.tar.gz

BuildRequires: python2-devel python-nose
BuildRequires: numpy scipy Cython python-patsy python-pandas
BuildRequires: python-sphinx python-ipython-sphinx
BuildRequires: python-matplotlib

Requires: numpy scipy python-patsy python-pandas

%description
statsmodels is a Python module that provides classes and functions for the 
estimation of many different statistical models, as well as for conducting 
statistical tests, and statistical data exploration. An extensive list of 
result statistics are available for each estimator. The results are tested 
against existing statistical packages to ensure that they are correct.

%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: Statistics in Python
BuildRequires: python3-devel python3-nose
BuildRequires: python3-numpy python3-scipy python3-Cython python3-patsy python3-pandas
BuildRequires: python3-sphinx python3-matplotlib python-ipython-sphinx

Requires: python3-numpy python3-scipy python3-patsy python3-pandas

%description -n python3-%{upname}
statsmodels is a Python module that provides classes and functions for the 
estimation of many different statistical models, as well as for conducting 
statistical tests, and statistical data exploration. An extensive list of 
result statistics are available for each estimator. The results are tested 
against existing statistical packages to ensure that they are correct.

%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 -qn %{upname}-%{version}

pushd statsmodels
# Copy license files
cp -a stats/libqsturng/LICENSE.txt ../LICENSE.libqsturng.txt
cp -a datasets/README.txt ../README.datasets.txt
cp -a datasets/COPYING ../COPYING.datasets

# remove shebang
sed -i -e "1d" datasets/co2/data.py
sed -i -e "1d" datasets/engel/data.py
sed -i -e "1d" datasets/fair/data.py
sed -i -e "1d" datasets/modechoice/data.py
sed -i -e "1d" datasets/statecrime/data.py
sed -i -e "1d" datasets/strikes/data.py
sed -i -e "1d" datasets/template_data.py
sed -i -e "1d" regression/quantile_regression.py
sed -i -e "1d" tools/print_version.py
# remove exec bit
chmod -x datasets/cancer/cancer.csv
popd

%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|#!%{__python}|'

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

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="%{optflags}" %{__python3} setup.py build
# Not working
#%{__python3} setup.py build_sphinx
popd
# Copying the python2 docs for the moment
mkdir -p build/sphinx3
cp -a build/sphinx/html build/sphinx3
%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 --skip-build --root %{buildroot}

find %{buildroot} -name "*.so" | xargs chmod 755

# Remove files that shouldn't be installed
pushd %{buildroot}/%{python2_sitearch}/%{upname}
rm stats/libqsturng/LICENSE.txt
popd

pushd %{buildroot}/%{python3_sitearch}/%{upname}
rm stats/libqsturng/LICENSE.txt
popd

%check
# Fake matplotlibrc
mkdir matplotlib
touch matplotlib/matplotlibrc
export XDG_CONFIG_HOME=`pwd`
pushd %{buildroot}/%{python2_sitearch}
nosetests-%{python2_version} %{upname}
popd
%if 0%{?with_python3}
pushd %{buildroot}/%{python3_sitearch}
nosetests-%{python3_version} %{upname}
popd
%endif # with_python3
 
%files
%doc COPYRIGHTS.txt  README_l1.txt README.rst LICENSE.txt LICENSE.libqsturng.txt README.datasets.txt COPYING.datasets
%{python2_sitearch}/*

%files doc
%doc COPYRIGHTS.txt  README_l1.txt README.rst LICENSE.txt LICENSE.libqsturng.txt README.datasets.txt COPYING.datasets build/sphinx/html

%if 0%{?with_python3}
%files -n python3-%{upname}
%doc COPYRIGHTS.txt  README_l1.txt README.rst LICENSE.txt LICENSE.libqsturng.txt README.datasets.txt COPYING.datasets
%{python3_sitearch}/*

%files -n python3-%{upname}-doc
%doc COPYRIGHTS.txt  README_l1.txt README.rst LICENSE.txt LICENSE.libqsturng.txt README.datasets.txt COPYING.datasets build/sphinx3/html

%endif # with_python3

%changelog
* Fri Dec 05 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.6.1-1
- New upstream source, bugfix (0.6.1)

* Mon Nov 17 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.6.0-1
- New upstream source (0.6.0)

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jun 17 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-11
- Enabled documentation

* Thu Jun 12 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-10
- Documentation broken due to IPython incompatibility, disable for the moment
- Examples moved out installed package
- Disabled tests for the moment

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Jan 24 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-8
- Enable tests in arm
- Disable failling test in i686
- Disable failling test in arm

* Tue Jan 21 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-7
- Disable tests in arm

* Mon Jan 20 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-6
- Add README.txt and COPYING from datasets to doc

* Sun Jan 19 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-5
- Added url for bug report of removed tests
- Minor fixes in the spec
- Included other LICENSE.txt in the documentation

* Wed Jan 15 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-4
- Use an empty matplotlibrc for tests

* Wed Jan 15 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-3
- Patch those tests that fail

* Fri Jan 10 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-2
- Add ipython to build documentation

* Fri Jan 10 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.5.0-1
- Initial spec