Only build scipy once (per Python)
The build_sphinx setup.py command previously used to build the docs calls build_ext --inplace internally. That's one build. Later the install command was called and that calls build as well. Inplace and non-inplace builds happen separately. By first explicitly building with build and then invoking sphinx trough the Makefile, we can use install --skip-build (%pyX_install). Explicit call to sphinx also removes the need to remove conf.py from bundled projects. This also saves us setting the build flags in %install, which was previously only needed because of the build happening there. While doing this, I've also switched the build section to build for for Python 3 and Python 2 in a loop to make the specfile DRY.
This commit is contained in:
parent
c1994df3a0
commit
33f8ec88d1
80
scipy.spec
80
scipy.spec
@ -129,73 +129,37 @@ openblas_libs = openblasp
|
||||
%endif
|
||||
EOF
|
||||
|
||||
# sphinx_build somehow randomly decides which docs to build here
|
||||
# there is: doc/source/conf.py - scipy docs - we want that one
|
||||
# doc/sphinxext/doc/conf.py - bundled numpydoc documentation
|
||||
# doc/scipy-sphinx-theme/conf.py - testing documentation for the theme
|
||||
rm doc/sphinxext -r # contains only bundled numpydoc
|
||||
rm doc/scipy-sphinx-theme/conf.py
|
||||
# remove bundled numpydoc
|
||||
rm doc/sphinxext -r
|
||||
|
||||
|
||||
%build
|
||||
env CFLAGS="$RPM_OPT_FLAGS -lm" \
|
||||
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
|
||||
%ifarch %{openblas_arches}
|
||||
for PY in %{python3_version} %{python2_version}; do
|
||||
env CFLAGS="$RPM_OPT_FLAGS -lm" \
|
||||
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
|
||||
%ifarch %{openblas_arches}
|
||||
OPENBLAS=%{_libdir} \
|
||||
%else
|
||||
%else
|
||||
ATLAS=%{_libdir}/atlas \
|
||||
%endif
|
||||
%endif
|
||||
FFTW=%{_libdir} BLAS=%{_libdir} LAPACK=%{_libdir} \
|
||||
%__python3 setup.py config_fc \
|
||||
%{_bindir}/python$PY setup.py config_fc \
|
||||
--fcompiler=gnu95 --noarch \
|
||||
%if %{with doc}
|
||||
build_sphinx
|
||||
rm -r build/sphinx/html/.buildinfo
|
||||
mv build/sphinx build/sphinx-%{python3_version}
|
||||
%else
|
||||
build
|
||||
%endif # with doc
|
||||
|
||||
env CFLAGS="$RPM_OPT_FLAGS" \
|
||||
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
|
||||
%ifarch %{openblas_arches}
|
||||
OPENBLAS=%{_libdir} \
|
||||
%else
|
||||
ATLAS=%{_libdir}/atlas \
|
||||
%endif
|
||||
FFTW=%{_libdir} BLAS=%{_libdir} LAPACK=%{_libdir} \
|
||||
%__python2 setup.py config_fc \
|
||||
--fcompiler=gnu95 --noarch \
|
||||
%if %{with doc}
|
||||
build_sphinx
|
||||
rm -r build/sphinx/html/.buildinfo
|
||||
mv build/sphinx build/sphinx-%{python2_version}
|
||||
%else
|
||||
build
|
||||
%endif # with doc
|
||||
|
||||
%if %{with doc}
|
||||
pushd doc
|
||||
export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/)
|
||||
make html SPHINXBUILD=sphinx-build-$PY
|
||||
rm -rf build/html/.buildinfo
|
||||
mv build build-$PY
|
||||
popd
|
||||
%endif
|
||||
done
|
||||
|
||||
%install
|
||||
env CFLAGS="$RPM_OPT_FLAGS -lm" \
|
||||
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
|
||||
%ifarch %{openblas_arches}
|
||||
OPENBLAS=%{_libdir} \
|
||||
%else
|
||||
ATLAS=%{_libdir}/atlas \
|
||||
%endif
|
||||
FFTW=%{_libdir} BLAS=%{_libdir} LAPACK=%{_libdir} \
|
||||
%__python3 setup.py install --root=%{buildroot}
|
||||
|
||||
env CFLAGS="$RPM_OPT_FLAGS" \
|
||||
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
|
||||
%ifarch %{openblas_arches}
|
||||
OPENBLAS=%{_libdir} \
|
||||
%else
|
||||
ATLAS=%{_libdir}/atlas \
|
||||
%endif
|
||||
FFTW=%{_libdir} BLAS=%{_libdir} LAPACK=%{_libdir} \
|
||||
%__python2 setup.py install --root=%{buildroot}
|
||||
|
||||
%py3_install
|
||||
%py2_install
|
||||
|
||||
%check
|
||||
# Skip all tests on s390x because they hangs unexpectedly and randomly
|
||||
@ -221,7 +185,7 @@ popd
|
||||
%if %{with doc}
|
||||
%files -n python2-scipy-doc
|
||||
%license LICENSE.txt
|
||||
%doc build/sphinx-%{python2_version}/html
|
||||
%doc doc/build-%{python2_version}/html
|
||||
%endif # with doc
|
||||
|
||||
%files -n python3-scipy
|
||||
@ -232,7 +196,7 @@ popd
|
||||
%if %{with doc}
|
||||
%files -n python3-scipy-doc
|
||||
%license LICENSE.txt
|
||||
%doc build/sphinx-%{python3_version}/html
|
||||
%doc doc/build-%{python3_version}/html
|
||||
%endif # with doc
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user