Commit 2ad5c810 authored by Scott Wittenburg's avatar Scott Wittenburg

docker: Fix issues arising after update to v5.7.0-RC2

Use proper CMake variables to enable building against either system
python version 2 or 3, based on user-provided build-time argument.
parent aa8bba69
......@@ -45,6 +45,13 @@
#
# (default is "false" -> build tree and cmake are removed)
#
# PYTHON_VERSION
#
# 2
# 3
#
# (default is "2")
#
ARG BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
FROM ${BASE_IMAGE}
......@@ -54,6 +61,16 @@ ARG PARAVIEW_TAG=v5.7.0-RC2
ARG SUPERBUILD_TAG=v5.7.0-RC2
ARG SUPERBUILD_REPO=https://gitlab.kitware.com/paraview/paraview-superbuild.git
ARG DEV_BUILD=false
ARG PYTHON_VERSION=2
# The following environment variables help with the Python 2 vs 3 option while
# we still support both of them. In order for this approach to work, we need
# the RUN command to use bash instead of sh for variable indirection.
SHELL ["/bin/bash", "-c"]
ENV SYSTEM_PYTHON_2_PIP pip
ENV SYSTEM_PYTHON_3_PIP pip3
ENV SYSTEM_PYTHON_PIP "SYSTEM_PYTHON_${PYTHON_VERSION}_PIP"
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
......@@ -66,12 +83,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libtool \
openssl \
python2.7-dev \
python-pip \
python-setuptools \
pkg-config && \
if [ "${PYTHON_VERSION}" = "2" ]; then apt-get install -y --no-install-recommends python2.7-dev python-pip python-setuptools; fi && \
if [ "${PYTHON_VERSION}" = "3" ]; then apt-get install -y --no-install-recommends python3-dev python3-pip python3-setuptools; fi && \
rm -rf /var/lib/apt/lists/* && \
pip install mako
${!SYSTEM_PYTHON_PIP} install mako
# Create a non-root user
RUN groupadd pv-user && \
......
......@@ -36,6 +36,22 @@ The option for this are the same as for `SUPERBUILD_TAG`, above.
In order to allow you to preserve both the superbuild build tree as well as the version of `CMake` used during the build, this option accepts a value of `"true"`. Any other value (including the default of `"false"`) results in the build tree and `CMake` installation getting cleaned out to reduce the final size of the built image. This option can be helpful if you want to use the resulting `Docker` image to develop plugins against a particular version of ParaView.
#### `PYTHON_VERSION`
While the ParaView Superbuild supports building ParaView with either Python 2 or 3, this option is available to choose the version of system python to install in the container and use in the ParaView build. The available options are simply `2` or `3`, with `2` being the default. Due to how ubuntu handles python 2 and 3 packages, we have chosen to embed environment variables in the resulting image that indicate the name of the `pip` program. These environment variables are defined as follows:
```
ENV SYSTEM_PYTHON_2_PIP pip
ENV SYSTEM_PYTHON_3_PIP pip3
ENV SYSTEM_PYTHON_PIP "SYSTEM_PYTHON_${PYTHON_VERSION}_PIP"
```
where `${PYTHON_VERSION}` is interpreted from the user-supplied python version. In this way, a user of the resulting container can determine the appropriate program to use for installing packages by interpolating the `SYSTEM_PYTHON_PIP` environment variable as follows:
```bash
PIP_CMD="${!SYSTEM_PYTHON_PIP}"
```
### Build command-line examples
The simplest build just accepts all the defaults:
......
......@@ -24,8 +24,9 @@ if("$ENV{RENDERING}" STREQUAL "egl")
set(PARAVIEW_EXTRA_CMAKE_ARGUMENTS "-DOpenGL_GL_PREFERENCE:STRING=GLVND" CACHE STRING "")
# If we're going to have support for EGL, index would be nice too
# If we have support for EGL, index and rtx would be nice eventually too
set(ENABLE_nvidiaindex OFF CACHE BOOL "")
set(ENABLE_visrtx OFF CACHE BOOL "")
else()
message('Builing with OSMESA rendering')
set(ENABLE_osmesa ON CACHE BOOL "")
......@@ -51,7 +52,17 @@ set(ENABLE_paraviewtutorialdata OFF CACHE BOOL "")
# Python related
set(ENABLE_python ON CACHE BOOL "")
set(USE_SYSTEM_python ON CACHE BOOL "")
if("$ENV{PYTHON_VERSION}" STREQUAL "2")
set(ENABLE_python2 ON CACHE BOOL "")
set(USE_SYSTEM_python2 ON CACHE BOOL "")
set(ENABLE_python3 OFF CACHE BOOL "")
set(USE_SYSTEM_python3 OFF CACHE BOOL "")
else()
set(ENABLE_python2 OFF CACHE BOOL "")
set(USE_SYSTEM_python2 OFF CACHE BOOL "")
set(ENABLE_python3 ON CACHE BOOL "")
set(USE_SYSTEM_python3 ON CACHE BOOL "")
endif()
set(USE_SYSTEM_pythonsetuptools ON CACHE BOOL "")
set(ENABLE_matplotlib ON CACHE BOOL "")
set(ENABLE_scipy ON CACHE BOOL "")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment