@@ -28,26 +28,17 @@ def python_version(self):
28
28
if hasattr (self , "_python_version" ):
29
29
return self ._python_version
30
30
31
- try :
32
- with open (self .binder_path ("runtime.txt" )) as f :
33
- runtime = f .read ().strip ()
34
- except FileNotFoundError :
35
- runtime = ""
36
-
37
- if runtime .startswith ("python-" ):
38
- runtime_python_version = runtime .split ("-" , 1 )[1 ]
31
+ name , version , _ = self .runtime
32
+
33
+ if name == "python" :
34
+ runtime_python_version = version
39
35
else :
40
- # not a Python runtime (e.g. R, which subclasses this)
41
- # use the default Python
42
36
runtime_python_version = self .major_pythons ["3" ]
43
37
self .log .warning (
44
38
f"Python version unspecified in runtime.txt, using current default Python version { runtime_python_version } . This will change in the future."
45
39
)
46
40
47
41
runtime_python_version_info = runtime_python_version .split ("." )
48
- if len (runtime_python_version_info ) == 1 :
49
- runtime_python_version = self .major_pythons [runtime_python_version_info [0 ]]
50
- runtime_python_version_info = runtime_python_version .split ("." )
51
42
52
43
pyproject_file = self .binder_path ("pyproject.toml" )
53
44
with open (pyproject_file , "rb" ) as _pyproject_file :
@@ -135,12 +126,9 @@ def get_assemble_scripts(self):
135
126
def detect (self ):
136
127
"""Check if current repo should be built with the pyproject.toml buildpack."""
137
128
# first make sure python is not explicitly unwanted
138
- runtime_txt = self .binder_path ("runtime.txt" )
139
- if os .path .exists (runtime_txt ):
140
- with open (runtime_txt ) as f :
141
- runtime = f .read ().strip ()
142
- if not runtime .startswith ("python-" ):
143
- return False
129
+ name , _ , _ = self .runtime
130
+ if name != "python" :
131
+ return False
144
132
145
133
pyproject_file = self .binder_path ("pyproject.toml" )
146
134
0 commit comments