From 5f9cbb18be4e1b7705631d15d8be146cf57ad678 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20J=C3=BCrges?= <jurges@astron.nl>
Date: Mon, 25 Mar 2019 15:01:51 +0000
Subject: [PATCH] SW-612:  Specify Python3 in build packages

---
 Docker/lofar-base/Dockerfile.tmpl     | 21 ++++++++++-----------
 Docker/lofar-pipeline/Dockerfile.tmpl |  4 ++--
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Docker/lofar-base/Dockerfile.tmpl b/Docker/lofar-base/Dockerfile.tmpl
index 18b5b42692d..1dbe139b7de 100644
--- a/Docker/lofar-base/Dockerfile.tmpl
+++ b/Docker/lofar-base/Dockerfile.tmpl
@@ -12,7 +12,7 @@ ENV INSTALLDIR=/opt
 # environment
 #
 ENV DEBIAN_FRONTEND=noninteractive \
-    PYTHON_VERSION=2.7
+    PYTHON_VERSION=3.5
 
 #
 # versions
@@ -32,11 +32,10 @@ ENV J=6
 #
 #RUN sed -i 's/archive.ubuntu.com/osmirror.rug.nl/' /etc/apt/sources.list 
 RUN apt-get update && \
-    apt-get install -y python2.7 libpython2.7 && \
+    apt-get install -y python${PYTHON_VERSION} libpython${PYTHON_VERSION} && \
     apt-get install -y libopenblas-base libcfitsio-bin libwcs5 libfftw3-bin libhdf5-10 libboost-python${BOOST_VERSION}.0 && \
-    apt-get install -y python-pip && \
-    pip install numpy && \
-    apt-get purge -y python-pip && \
+    apt-get install -y python3-pip && \
+    pip3 install numpy && \
     apt-get autoremove -y --purge && \
     apt-get install -y nano sudo vim
 
@@ -97,7 +96,7 @@ RUN apt-get update && apt-get install -y git cmake g++ gfortran libboost-system-
 #   Pyrap
 # *******************
 #
-RUN apt-get update && apt-get install -y git make g++ python-setuptools libboost-python-dev libcfitsio3-dev wcslib-dev && \
+RUN apt-get update && apt-get install -y git make g++ python3-setuptools libboost-python-dev libcfitsio3-dev wcslib-dev && \
     mkdir ${INSTALLDIR}/python-casacore && \
     cd ${INSTALLDIR}/python-casacore && git clone https://github.com/casacore/python-casacore && \
     if [ "$PYTHON_CASACORE_VERSION" != "latest" ]; then cd ${INSTALLDIR}/python-casacore/python-casacore && git checkout tags/v${PYTHON_CASACORE_VERSION}; fi && \
@@ -107,7 +106,7 @@ RUN apt-get update && apt-get install -y git make g++ python-setuptools libboost
     export PYTHONPATH=${INSTALLDIR}/python-casacore/lib/python${PYTHON_VERSION}/site-packages:${INSTALLDIR}/python-casacore/lib64/python${PYTHON_VERSION}/site-packages:$PYTHONPATH && cd ${INSTALLDIR}/python-casacore/python-casacore && ./setup.py install --prefix=${INSTALLDIR}/python-casacore/ && \
     bash -c "find ${INSTALLDIR}/python-casacore/lib -name '*.so' | xargs strip || true" && \
     bash -c "rm -rf ${INSTALLDIR}/python-casacore/python-casacore" && \
-    apt-get purge -y git make g++ python-setuptools libboost-python-dev libcfitsio3-dev wcslib-dev && \
+    apt-get purge -y git make g++ python3-setuptools libboost-python-dev libcfitsio3-dev wcslib-dev && \
     apt-get autoremove -y --purge
 
 #
@@ -122,20 +121,20 @@ RUN apt-get update && apt-get install -y sasl2-bin libuuid1 libnss3 libnspr4 xqi
 
 # Install
 # QPID daemon legacy store would require: libaio-dev libdb5.1++-dev
-RUN apt-get update && apt-get install -y subversion swig ruby ruby-dev python-dev libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential debhelper libsslcommon2-dev libxqilla-dev python-setuptools libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev && \
+RUN apt-get update && apt-get install -y subversion swig ruby ruby-dev python3-dev libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential debhelper libsslcommon2-dev libxqilla-dev python3-setuptools libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev && \
     mkdir ${INSTALLDIR}/qpid && \
     svn --non-interactive -q co ${LOFAR_BRANCH_URL}/LCS/MessageBus/qpid/ ${INSTALLDIR}/qpid && \
     bash -c "HOME=/tmp ${INSTALLDIR}/qpid/local/sbin/build_qpid" && \
     bash -c "strip ${INSTALLDIR}/qpid/{bin,lib}/* || true" && \
     bash -c "rm -rf /tmp/sources" && \
-    apt-get purge -y subversion swig ruby ruby-dev python-dev libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential debhelper libsslcommon2-dev libxqilla-dev python-setuptools libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev && \
+    apt-get purge -y subversion swig ruby ruby-dev python3-dev libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential debhelper libsslcommon2-dev libxqilla-dev python3-setuptools libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev && \
     apt-get autoremove -y --purge
 #
 # *******************
 #   DAL
 # *******************
 #
-RUN apt-get update && apt-get install -y git cmake g++ swig python-dev libhdf5-dev && \
+RUN apt-get update && apt-get install -y git cmake g++ swig python3-dev libhdf5-dev && \
     mkdir ${INSTALLDIR}/DAL && \
     cd ${INSTALLDIR}/DAL && git clone https://github.com/nextgen-astrodata/DAL.git src && cd src && git checkout v3.3.0 && cd .. && \
     mkdir ${INSTALLDIR}/DAL/build && cd ${INSTALLDIR}/DAL/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/DAL ../src && \
@@ -143,7 +142,7 @@ RUN apt-get update && apt-get install -y git cmake g++ swig python-dev libhdf5-d
     make install && \
     bash -c "find ${INSTALLDIR}/DAL/lib -name '*.so' | xargs strip || true" && \
     bash -c "rm -rf ${INSTALLDIR}/DAL/{src,build}" && \
-    apt-get purge -y git cmake g++ swig python-dev libhdf5-dev && \
+    apt-get purge -y git cmake g++ swig python3-dev libhdf5-dev && \
     apt-get autoremove -y --purge
 
 #
diff --git a/Docker/lofar-pipeline/Dockerfile.tmpl b/Docker/lofar-pipeline/Dockerfile.tmpl
index ca558efa87f..dea5c6cf046 100644
--- a/Docker/lofar-pipeline/Dockerfile.tmpl
+++ b/Docker/lofar-pipeline/Dockerfile.tmpl
@@ -86,7 +86,7 @@ ENV LOFAR_BRANCH=${LOFAR_BRANCH_NAME} \
 
 
 # Install
-RUN apt-get update && apt-get install -y subversion cmake g++ gfortran bison flex liblog4cplus-dev libhdf5-dev libblitz0-dev libboost-dev libboost-python-dev python-dev libxml2-dev pkg-config libpng12-dev libfftw3-dev libunittest++-dev libxml++2.6-dev libgsl-dev libboost-filesystem${BOOST_VERSION}-dev libboost-date-time${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev libboost-regex${BOOST_VERSION} binutils-dev libcfitsio3-dev wcslib-dev libopenblas-dev && \
+RUN apt-get update && apt-get install -y subversion cmake g++ gfortran bison flex liblog4cplus-dev libhdf5-dev libblitz0-dev libboost-dev libboost-python-dev python3-dev libxml2-dev pkg-config libpng12-dev libfftw3-dev libunittest++-dev libxml++2.6-dev libgsl-dev libboost-filesystem${BOOST_VERSION}-dev libboost-date-time${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev libboost-regex${BOOST_VERSION} binutils-dev libcfitsio3-dev wcslib-dev libopenblas-dev && \
     mkdir -p ${INSTALLDIR}/lofar/build/${LOFAR_BUILDVARIANT} && \
     cd ${INSTALLDIR}/lofar && \
     svn --non-interactive -q co -r ${LOFAR_REVISION} -N ${LOFAR_BRANCH_URL} src; \
@@ -99,7 +99,7 @@ RUN apt-get update && apt-get install -y subversion cmake g++ gfortran bison fle
     bash -c "chmod a+rwx  ${INSTALLDIR}/lofar/var/{log,run}" && \
     bash -c "strip ${INSTALLDIR}/lofar/{bin,sbin,lib64}/* || true" && \
     bash -c "rm -rf ${INSTALLDIR}/lofar/{build,src}" && \
-    apt-get purge -y subversion cmake g++ gfortran bison flex liblog4cplus-dev libhdf5-dev libblitz0-dev libboost-dev libboost-python-dev python-dev libxml2-dev pkg-config libpng12-dev libfftw3-dev libunittest++-dev libxml++2.6-dev libgsl-dev libboost-filesystem${BOOST_VERSION}-dev libboost-date-time${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev binutils-dev libcfitsio3-dev wcslib-dev libopenblas-dev && \
+    apt-get purge -y subversion cmake g++ gfortran bison flex liblog4cplus-dev libhdf5-dev libblitz0-dev libboost-dev libboost-python-dev python3-dev libxml2-dev pkg-config libpng12-dev libfftw3-dev libunittest++-dev libxml++2.6-dev libgsl-dev libboost-filesystem${BOOST_VERSION}-dev libboost-date-time${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev binutils-dev libcfitsio3-dev wcslib-dev libopenblas-dev && \
     apt-get autoremove -y --purge
 
 # install additional bashrc files
-- 
GitLab