From 88d489de52d40ed61ea73e30907576ebee754828 Mon Sep 17 00:00:00 2001 From: Raniere Gaia Costa da Silva Date: Fri, 22 Aug 2025 12:58:30 +0200 Subject: [PATCH] Fail earlier when user try to install future version of R Closes https://github.com/jupyterhub/repo2docker/issues/1455 --- repo2docker/buildpacks/r.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index 9a81f046..a7057675 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -1,6 +1,7 @@ import datetime import os import re +import warnings from functools import lru_cache import requests @@ -99,9 +100,18 @@ class RBuildPack(PythonBuildPack): # available. Users can however explicitly specify the full version to get something specific if r_version in version_map: r_version = version_map[r_version] - elif len(r_version.split(".")) == 2: - # must have x.y.z version, add .0 for unrecognized (future) R versions - r_version += ".0" + else: + # Instead of appending ".0" to future R versions, + # repo2docker fails earlier with a meaningful message to the user. + # If repo2docker doesn't fail here, repo2docker might fail later + # without a meaningul message to the user. + raise RuntimeError( + f"R version {r_version} is not supported. Please open an issue using https://github.com/jupyterhub/repo2docker/issues/new?template=BLANK_ISSUE.", + ) + else: + warnings.warn( + f"Using R version {r_version} instead of full version, i.e. MAJOR.MINOR.PATCH." + ) # translate to the full version string self._r_version = r_version