aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/make
diff options
context:
space:
mode:
authorRaul Infante-Sainz <infantesainz@gmail.com>2020-04-06 09:12:47 +0100
committerRaul Infante-Sainz <infantesainz@gmail.com>2020-04-06 09:13:59 +0100
commitd0a51f78d4705c2496c42a02c49b0bc70e931cf7 (patch)
tree83def4052a9d09f2353188def28653313ea6c4c0 /reproduce/software/make
parent647ce436871b5b692fa07ff166b731f72dff8bf8 (diff)
Astropy now depending on the Expat library to fix internal conflict
Until now, Astropy was instructed to build its own internal copy of the Expat library. However, with the recent commits before, Maneage now includes an installation of Expat and Astropy can't keep the two (its internal version and the project's version) separate, so they conflict and don't let Astropy get built. With this commit, the problem is fixed by setting the Expat library as an explicit dependency of Astropy and asking Astropy to ignore its internal copy. While doing this, I recognized that it is much easier and elegant to add steps in various stages of the `pybuild' function through hooks instead of variables. So the fifth argument of the `pybuild' function was removed and now it actually checks if hooks are defined as functions and if so, they will be called. The `pyhook_after' function was also implemented in the installation of `pybind11' (which needed it, given that the 5th argument of `pybuild' was removed) and after doing a test-build, I noticed that two lines were not ending with a `\' in `boost' (a dependency of `pybind11'). Commit written originally by Mohammad Akghlaghi
Diffstat (limited to 'reproduce/software/make')
-rw-r--r--reproduce/software/make/high-level.mk6
-rw-r--r--reproduce/software/make/python.mk30
2 files changed, 26 insertions, 10 deletions
diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk
index 603e710..7d2577a 100644
--- a/reproduce/software/make/high-level.mk
+++ b/reproduce/software/make/high-level.mk
@@ -520,8 +520,8 @@ $(ibidir)/boost: $(ibidir)/openmpi \
vstr=$$(echo $(boost-version) | sed -e's/\./_/g')
rm -rf $(ddir)/boost_$$vstr
topdir=$(pwd); cd $(ddir);
- tar xf $(word 1,$(filter $(tdir)/%,$|))
- && cd boost_$$vstr
+ tar xf $(word 1,$(filter $(tdir)/%,$|)) \
+ && cd boost_$$vstr \
&& ./bootstrap.sh --prefix=$(idir) --with-libraries=all \
--with-python=python3 \
&& echo "using mpi ;" > project-config.jam \
@@ -1069,7 +1069,7 @@ $(ibidir)/minizip: $(ibidir)/automake \
&& rm $(iidir)/minizip/crypt.h \
&& cd ../../.. \
&& rm -rf $$unpackdir \
- && echo "Minizip $(minizip)" > $@
+ && echo "Minizip $(minizip-version)" > $@
$(ibidir)/missfits: | $(tdir)/missfits-$(missfits-version).tar.gz
$(call gbuild, missfits-$(missfits-version), static) \
diff --git a/reproduce/software/make/python.mk b/reproduce/software/make/python.mk
index fef1605..9c79abc 100644
--- a/reproduce/software/make/python.mk
+++ b/reproduce/software/make/python.mk
@@ -335,7 +335,10 @@ $(ibidir)/python: $(ibidir)/libffi \
# 2) Unpacked directory name after unpacking the tarball
# 3) site.cfg file (optional).
# 4) Official software name (for paper).
-# 5) Manual step after installation.
+#
+# Hooks:
+# pyhook_before: optional steps before running `python setup.py build'
+# pyhook_after: optional steps after running `python setup.py install'
pybuild = cd $(ddir); rm -rf $(2); \
if ! $(1) $(word 1,$(filter $(tdir)/%,$|)); then \
echo; echo "Tar error"; exit 1; \
@@ -346,11 +349,10 @@ pybuild = cd $(ddir); rm -rf $(2); \
-e 's|@INCDIR[@]|'"$(idir)/include"'|' \
$(3) > site.cfg; \
fi; \
- if [ x"$(5)" = x ]; then after="echo no after"; \
- else after="$(5)"; fi \
+ if type pyhook_before &>/dev/null; then pyhook_before; fi \
&& python setup.py build \
&& python setup.py install \
- && $$after \
+ && if type pyhook_after &>/dev/null; then pyhook_after; fi \
&& cd .. \
&& rm -rf $(2) \
&& echo "$(4)" > $@
@@ -381,12 +383,24 @@ $(ipydir)/astroquery: $(ipydir)/astropy \
Astroquery $(astroquery-version))
$(ipydir)/astropy: $(ipydir)/h5py \
+ $(ibidir)/expat \
$(ipydir)/scipy \
$(ipydir)/numpy \
$(ipydir)/pyyaml \
$(ipydir)/html5lib \
$(ipydir)/beautifulsoup4 \
| $(tdir)/astropy-$(astropy-version).tar.gz
+ # Currently, when the Expat library is already built in a project
+ # (for example as a dependency of another program), Astropy's
+ # internal building of Expat will conflict with the project's. So
+ # we have added Expat as a dependency of Astropy (so it is always
+ # built before it, and we tell Astropy to use the project's
+ # libexpat.
+ pyhook_before () {
+ echo "" >> setup.cfg
+ echo "[build]" >> setup.cfg
+ echo "use_system_expat=1" >> setup.cfg
+ }
$(call pybuild, tar xf, astropy-$(astropy-version)) \
&& cp $(dtexdir)/astropy.tex $(ictdir)/ \
&& echo "Astropy $(astropy-version) \citep{astropy2013,astropy2018}" > $@
@@ -474,7 +488,7 @@ $(ipydir)/galsim: $(ipydir)/future \
$(ipydir)/pybind11 \
$(ipydir)/lsstdesccoord \
| $(tdir)/galsim-$(galsim-version).tar.gz
- $(call pybuild, tar xf, GalSim-$(galsim-version), ,) \
+ $(call pybuild, tar xf, GalSim-$(galsim-version)) \
&& cp $(dtexdir)/galsim.tex $(ictdir)/ \
&& echo "Galsim $(galsim-version) \citep{galsim}" > $@
@@ -610,9 +624,11 @@ $(ipydir)/pybind11: $(ibidir)/eigen \
$(ibidir)/boost \
$(ipydir)/setuptools \
| $(tdir)/pybind11-$(pybind11-version).tar.gz
+ pyhook_after() {
+ cp -r include/pybind11 $(iidir)/python$(python-major-version)m/
+ }
$(call pybuild, tar xf, pybind11-$(pybind11-version), ,\
- pybind11 $(pybind11-version),
- cp -r include/pybind11 $(iidir)/python$(python-major-version)m/)
+ pybind11 $(pybind11-version))
$(ipydir)/pycparser: $(ipydir)/setuptools \
| $(tdir)/pycparser-$(pycparser-version).tar.gz