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
pull/298/head
Min RK 2018-04-18 12:40:04 +02:00
rodzic 3b091a5502
commit 69a116a07f
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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: