Make sure images have /usr/bin/python
authorM. Eric Irrgang <ericirrgang@gmail.com>
Thu, 14 May 2020 08:28:06 +0000 (11:28 +0300)
committerArtem Zhmurov <zhmurov@gmail.com>
Wed, 20 May 2020 04:12:37 +0000 (04:12 +0000)
Append a Docker RUN command to make sure that /usr/bin/python either
already exists or is configured as a python3 alias.

Refs #3528

admin/containers/scripted_gmx_docker_builds.py

index 266597c19279443623f52289be8036e368a40c0a..90ec00337afd76bab8763998bba94b9235695f59 100644 (file)
@@ -487,6 +487,11 @@ def build_stages(args) -> typing.Iterable[hpccm.Stage]:
         # stages['main'] += hpccm.primitives.copy(_from='pyenv', src=['/root/.bashrc'],
         #                                         dest='/root/')
 
+    # Make sure that `python` resolves to something.
+    stages['main'] += hpccm.primitives.shell(commands=['test -x /usr/bin/python || '
+                                                       'update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && '
+                                                       '/usr/bin/python --version'])
+
     # Note that the list of stages should be sorted in dependency order.
     for build_stage in stages.values():
         if build_stage is not None: