%global with_python3 1
%global srcname emcee
%global common_description \
emcee is a stable, well tested Python implementation of the affine-invariant \
ensemble sampler for Markov chain Monte Carlo (MCMC) proposed by \
Goodman & Weare (2010). The code is open source and has already been \
used in several published projects in the Astrophysics literature.
Name: python-%{srcname}
Version: 2.2.1
Release: 2%{?dist}
Summary: The Python ensemble sampling toolkit for affine-invariant MCMC
License: MIT
URL: http://dan.iel.fm/emcee/current/
Source0: https://pypi.io/packages/source/e/emcee/emcee-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python-nose numpy
BuildArch: noarch
Requires: numpy
%{?python_provide:%python_provide python-%{srcname}}
%description
%{common_description}
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: The Python ensemble sampling toolkit for affine-invariant MCMC
BuildRequires: python3-devel
BuildRequires: python3-nose python3-numpy
Requires: python3-numpy
%description -n python3-%{srcname}
%{common_description}
%endif # with_python3
%prep
%setup -qn %{srcname}-%{version}
# Delete first line if it starts with shebang
pushd emcee
find -name '*.py' | xargs sed -i '1{/^#!/d}' __init__.py
popd
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
%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}
%check
pushd %{buildroot}/%{python2_sitelib}
nosetests-%{python2_version} -v emcee
popd
%if 0%{?with_python3}
pushd %{buildroot}/%{python3_sitelib}
nosetests-%{python3_version} -v emcee
popd
%endif # with_python3
%files
%doc AUTHORS.rst HISTORY.rst README.rst
%license LICENSE
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc AUTHORS.rst HISTORY.rst README.rst
%license LICENSE
%{python3_sitelib}/*
%endif # with_python3
%changelog
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.2.1-2
- Rebuild for Python 3.6
* Wed Jul 27 2016 Sergio Pascual <sergiopr@fedoraproject.org> - 2.2.1-1
- New upstream source (2.2.1)
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Jul 14 2016 Sergio Pascual <sergiopr@fedoraproject.org> - 2.2.0-2
- Remove reference to patch in specfile
* Wed Jul 13 2016 Sergio Pascual <sergiopr@fedoraproject.org> - 2.2.0-1
- New upstream source (2.2.0)
- Update pypi url
- Remove numpy 1.11 patch (upstream fixed it)
* Tue Mar 29 2016 Sergio Pascual <sergiopr@fedoraproject.org> - 2.1.0-5
- Provide python2 package
- Fix problem with numpy 1.11
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sun Jun 15 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 2.1.0-1
- Initial spec