From 69a116a07faaa564faade473fdfcdb744072b36e Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 18 Apr 2018 12:40:04 +0200 Subject: [PATCH] handle runtime not being Python in Python BuildPack because R buildpack subclasses the Python buildpack, where runtime.txt should be ignored for retrieving the Python version --- repo2docker/buildpacks/python/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repo2docker/buildpacks/python/__init__.py b/repo2docker/buildpacks/python/__init__.py index dad1b046..8141a30d 100644 --- a/repo2docker/buildpacks/python/__init__.py +++ b/repo2docker/buildpacks/python/__init__.py @@ -16,7 +16,14 @@ class PythonBuildPack(CondaBuildPack): with open(self.binder_path('runtime.txt')) as f: runtime = f.read().strip() except FileNotFoundError: - runtime = 'python-' + self.major_pythons['3'] + runtime = '' + + if not runtime.startswith('python-'): + # not a Python runtime (e.g. R, which subclasses this) + # use the default Python + self._python_version = self.major_pythons['3'] + return self._python_version + py_version_info = runtime.split('-', 1)[1].split('.') py_version = '' if len(py_version_info) == 1: