From 698b2d6ffbc6812b93c84b23a5a8a77d821bf203 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Tue, 16 Jun 2020 13:48:26 +0300 Subject: [PATCH] Use importlib_resources in Python 3.6 images. Python 3.7 adds importlib.resources to the standard library, which provides an efficient built in alternative to pkg_resources. Backported functionality is available in the importlib_resources package. We should add it to our Docker images to allow testing new features while we still officially support Python 3.6. See also issue #2961 --- admin/containers/scripted_gmx_docker_builds.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/containers/scripted_gmx_docker_builds.py b/admin/containers/scripted_gmx_docker_builds.py index 4aa57d5176..cf54164604 100644 --- a/admin/containers/scripted_gmx_docker_builds.py +++ b/admin/containers/scripted_gmx_docker_builds.py @@ -300,7 +300,7 @@ def add_tsan_stage(input_args, output_stages: typing.Mapping[str, hpccm.Stage]): def prepare_venv(version: StrictVersion) -> typing.Sequence[str]: """Get shell commands to set up the venv for the requested Python version.""" major = version.version[0] - minor = version.version[1] + minor = version.version[1] # type: int pyenv = '$HOME/.pyenv/bin/pyenv' @@ -329,6 +329,11 @@ def prepare_venv(version: StrictVersion) -> typing.Sequence[str]: 'setuptools>=42' \ 'scikit-build>=0.10'""".format(path=venv_path)) + # TODO: Remove 'importlib_resources' dependency when Python >=3.7 is required. + if minor == 6: + commands.append("""{path}/bin/python -m pip install --upgrade \ + 'importlib_resources'""".format(path=venv_path)) + return commands -- 2.11.4.GIT