mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-07 18:14:05 +00:00
Fix Python version pin (#2085)
This commit is contained in:
@@ -117,7 +117,8 @@ RUN set -x && \
|
||||
'jupyter_core' && \
|
||||
rm -rf /tmp/bin/ && \
|
||||
# Pin major.minor version of python
|
||||
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
|
||||
# https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning
|
||||
mamba list --full-name 'python' | tail -1 | tr -s ' ' | cut -d ' ' -f 1,2 | sed 's/\.[^.]*$/.*/' >> "${CONDA_DIR}/conda-meta/pinned" && \
|
||||
mamba clean --all -f -y && \
|
||||
fix-permissions "${CONDA_DIR}" && \
|
||||
fix-permissions "/home/${NB_USER}"
|
||||
|
@@ -22,3 +22,13 @@ def test_python_version(container: TrackedContainer) -> None:
|
||||
major_minor_version = full_version[: full_version.rfind(".")]
|
||||
|
||||
assert major_minor_version == EXPECTED_PYTHON_VERSION
|
||||
|
||||
|
||||
def test_python_pinned_version(container: TrackedContainer) -> None:
|
||||
LOGGER.info(f"Checking that pinned python version is {EXPECTED_PYTHON_VERSION}.*")
|
||||
logs = container.run_and_wait(
|
||||
timeout=5,
|
||||
tty=True,
|
||||
command=["cat", "/opt/conda/conda-meta/pinned"],
|
||||
)
|
||||
assert logs.startswith(f"python {EXPECTED_PYTHON_VERSION}.*")
|
||||
|
Reference in New Issue
Block a user