Blob Blame History Raw
# Works with system erfa
%bcond_without system_erfa

# EPEL has older wcslib
%if 0%{?fedora} 
%bcond_without system_wcslib
%else
%bcond_with system_wcslib
%endif

%global srcname astropy

Name:           python2-%{srcname}
Version:        2.0.6
Release:        2%{?dist}
Summary:        A Community Python Library for Astronomy

License:        BSD
URL:            http://astropy.org
Source0:        https://files.pythonhosted.org/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz
Source1:        astropy-README.dist
Source2:        astropy-ply.py
Patch0:         python-astropy-system-configobj.patch
Patch1:         python-astropy-system-six.patch

BuildRequires:  gcc
BuildRequires:  git
BuildRequires:  graphviz
BuildRequires:  cfitsio-devel
BuildRequires:  expat-devel
%if %{with system_erfa}
BuildRequires:  erfa-devel
%else
Provides:       bundled(erfa) = 1.3.0
%endif
%if %{with system_wcslib}
BuildRequires:  wcslib-devel >= 5.14
%else   
Provides:       bundled(wcslib) = 5.16
%endif
BuildRequires:  texlive-ucs
BuildRequires:  python2-configobj
BuildRequires:  python2-Cython
BuildRequires:  python2-devel
BuildRequires:  python2-h5py
BuildRequires:  python2-matplotlib
BuildRequires:  python2-numpy
BuildRequires:  python2-pandas
BuildRequires:  python2-ply
BuildRequires:  python2-pytest
BuildRequires:  python2-pyyaml
BuildRequires:  python2-scipy
BuildRequires:  python2-setuptools
BuildRequires:  python2-six
BuildRequires:  python2-sphinx

Requires:       python2-configobj
Requires:       python2-h5py
Requires:       python2-matplotlib
Requires:       python2-numpy
Requires:       python2-ply
Requires:       python2-pytest
Requires:       python2-pyyaml
Requires:       python2-scipy
Requires:       python2-six
Requires:       /usr/bin/xmllint

# Pandas is not a strict requirement, but useful
Recommends:     python2-pandas

%{?python_provide:%python_provide python2-%{srcname}}
Provides: bundled(jquery) = 1.11

# wcsaxes has been merged into astropy, therefore we obsolete and provide
# the old python-wcsaxes package here
Provides:       python2-wcsaxes = %{version}-%{release}
Obsoletes:      python2-wcsaxes < 0.9-9

%description
The Astropy project is a common effort to develop a single core package 
for Astronomy.  Major packages such as PyFITS, PyWCS, vo, and asciitable 
already merged in, and many more components being worked on. In 
particular, we are developing imaging, photometric, and spectroscopic 
functionality, as well as frameworks for cosmology, unit handling, and 
coordinate transformations.

%package doc
Summary:        Documentation for %{name}, includes full API docs
# Disabled for the moment to avoid name collision
# of generated names between arches
# BuildArch: noarch
%{?python_provide:%python_provide python2-%{srcname}-doc}
 
%description doc
This package contains the full API documentation for %{name}.


%prep
%autosetup -p1 -n %{srcname}-%{version}
cp %{SOURCE1} README.dist
# Required to support wcslib 4.5
find -name wcsconfig.h -delete
rm -rf astropy*egg-info
# Use system ply
cp %{SOURCE2} astropy/extern/ply.py

# Remove expat, erfa, cfitsio and wcslib
rm -rf cextern/cfitsio
%if %{with system_erfa}
rm -rf cextern/erfa
%endif
rm -rf cextern/expat
%if %{with system_wcslib}
rm -rf cextern/wcslib
%endif

echo "[build]" >> setup.cfg
#echo "use_system_libraries=1" >> setup.cfg
echo "use_system_cfitsio=1" >> setup.cfg
%if %{with system_erfa}
echo "use_system_erfa=1" >> setup.cfg
%endif
echo "use_system_expat=1" >> setup.cfg
%if %{with system_wcslib}
echo "use_system_wcslib=1" >> setup.cfg
%endif


%build
%global py_setup_args --offline
%py2_build
# Use cairo backend due to https://bugzilla.redhat.com/show_bug.cgi?id=1394975
export MPLBACKEND=cairo
%{__python2} setup.py build_sphinx --offline %{?epel:|| :}
rm -f docs/_build/html/.buildinfo


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

%check
%ifnarch s390x
pushd %{buildroot}/%{python2_sitearch}
py.test-%{python2_version} -k "not (test_write_read_roundtrip or test_web_profile or TestStandardProfileHTTPSHub or TestStandardProfileHTTPSHubClient or TestStandardProfile or test_mask_array)" astropy
popd
%endif # ifnarch s390x


%files
%doc README.rst README.dist
%license LICENSE.rst
# We exclude the "binaries" here, they are part of the astropy-tools package
# (subpackage of python-astropy). No need for Python 2 versions here.
%exclude %{_bindir}/*
%{python2_sitearch}/*

%files doc
%doc README.rst README.dist docs/_build/html
%license LICENSE.rst

%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sat May 26 2018 Christian Dersch <lupinix@mailbox.org> - 2.0.6-1
- new version

* Wed Mar 14 2018 Christian Dersch <lupinix@mailbox.org> - 2.0.5-2
- initial package, splitting out the python2 subpackage of python-astropy (new
  upstream releases Python 3 only)