Uh oh!
There was an error while loading. Please reload this page.
gh-99204: Calculate base_executable by alternate names in POSIX venvs - #99206
Conversation
FFY00
left a comment
There was a problem hiding this comment.
I think this is a reasonable fix, but let's see if others agree.
Uh oh!
There was an error while loading. Please reload this page.
zooba
commented
Nov 9, 2022
Conceptually it seems fine. Not sure whether we should mark this a "QUIRK" and aim to resolve it in some other way? I'll leave that to the POSIX people to decide |
e427dea to
76403d8Compare… venvs Check to see if `base_executable` exists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified by `home`. If no alternative is found, previous behavior is preserved. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
76403d8 to
0683b37Comparezooba
commented
Nov 9, 2022
Please don't force push changes when doing PRs. We'll squash merge at the end, but for now I have to re-review from the start because the diff is broken. I don't have time for that right now, but if someone else signs off and the variable names are indeed fixed, they can merge. |
vfazio
commented
Nov 9, 2022
@zooba sorry about that, my mistake completely. Diff below - _base_exe = basename(executable)- for _candidate in (DEFAULT_PROGRAM_NAME, f'python{VERSION_MAJOR}.{VERSION_MINOR}'):- _candidate += EXE_SUFFIX if EXE_SUFFIX else ''- if _base_exe == _candidate:+ base_exe = basename(executable)+ for candidate in (DEFAULT_PROGRAM_NAME, f'python{VERSION_MAJOR}.{VERSION_MINOR}'):+ candidate += EXE_SUFFIX if EXE_SUFFIX else ''+ if base_exe == candidate:
continue
- _candidate = joinpath(executable_dir, _candidate)+ candidate = joinpath(executable_dir, candidate)
# Only set base_executable if the candidate exists.
# If no candidate succeeds, subsequent errors related to
# base_executable (like FileNotFoundError) remain in the
# context of the original executable name
- if isfile(_candidate):- base_executable = _candidate+ if isfile(candidate):+ base_executable = candidate
break
break
else: |
would there be any concerns about me also making a PR targeting 3.11? Fixing it here means not having to work around it in downstream packages. |
miss-islington
commented
Nov 10, 2022
… venvs (pythonGH-99206) Check to see if `base_executable` exists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified by `home`. If no alternative is found, previous behavior is preserved. Signed-off-by: Vincent Fazio <vfazio@gmail.com> (cherry picked from commit c41b13d) Co-authored-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Vincent Fazio <vfazio@gmail.com>
bedevere-bot
commented
Nov 10, 2022
GH-99340 is a backport of this pull request to the 3.11 branch. |
zooba
commented
Nov 10, 2022
We'll let the bot do it. Should backport fine, as we haven't really been working on anything new in this file |
…GH-99206) Check to see if `base_executable` exists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified by `home`. If no alternative is found, previous behavior is preserved. Signed-off-by: Vincent Fazio <vfazio@gmail.com> (cherry picked from commit c41b13d) Co-authored-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Vincent Fazio <vfazio@gmail.com>
… venvs (pythonGH-99206) Check to see if `base_executable` exists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified by `home`. If no alternative is found, previous behavior is preserved. Signed-off-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Vincent Fazio <vfazio@gmail.com>
… venvs (pythonGH-99206) Check to see if `base_executable` exists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified by `home`. If no alternative is found, previous behavior is preserved. Signed-off-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Check to see if
base_executableexists. If it does not, attempt to use known alternative names of the python binary to find an executable in the path specified byhome.If no alternative is found, previous behavior is preserved.
--copies#99204