@@ -264,19 +264,25 @@ def infer_python_version_and_executable(options: Options,
264
264
265
265
# TODO: (ethanhs) Look at folding these checks and the site packages subprocess calls into
266
266
# one subprocess call for speed.
267
- if special_opts .python_executable is not None and special_opts .python_version is not None :
268
- options .python_version = special_opts .python_version
269
- options .python_executable = special_opts .python_executable
270
- elif special_opts .python_executable is None and special_opts .python_version is not None :
271
- options .python_version = special_opts .python_version
267
+
268
+ # Use the command line specified python_version/executable, or fall back to one set in the
269
+ # config file
270
+ python_version = special_opts .python_version or options .python_version
271
+ python_executable = special_opts .python_executable or options .python_executable
272
+
273
+ if python_executable is not None and python_version is not None :
274
+ options .python_version = python_version
275
+ options .python_executable = python_executable
276
+ elif python_executable is None and python_version is not None :
277
+ options .python_version = python_version
272
278
py_exe = None
273
279
if not special_opts .no_executable :
274
- py_exe = _python_executable_from_version (special_opts . python_version )
280
+ py_exe = _python_executable_from_version (python_version )
275
281
options .python_executable = py_exe
276
- elif special_opts . python_version is None and special_opts . python_executable is not None :
282
+ elif python_version is None and python_executable is not None :
277
283
options .python_version = _python_version_from_executable (
278
- special_opts . python_executable )
279
- options .python_executable = special_opts . python_executable
284
+ python_executable )
285
+ options .python_executable = python_executable
280
286
281
287
282
288
HEADER = """%(prog)s [-h] [-v] [-V] [more options; see below]
0 commit comments