Skip to content

Resolve pythonPath before comparing it to shebang #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2017
Merged

Resolve pythonPath before comparing it to shebang #273

merged 1 commit into from
Nov 22, 2017

Conversation

fnesveda
Copy link

@fnesveda fnesveda commented Nov 21, 2017

When comparing if the path to the Python interpreter from the shebang in a file and the pythonPath setting point to one and the same interpreter, resolve pythonPath to the path to the actual Python interpreter executable before the comparison.

This solves the problem of having python.pythonPath set to a symlink to the actual Python interpreter and having a /usr/bin/env shebang in a file, where both would actually point to the same interpreter, but the Set as interpreter CodeLens would display anyway, because it wouldn't recognize that.

For example, on macOS, with Python installed by Homebrew,#!/usr/bin/env python3 and python.pythonPath: "/usr/local/bin/python3" both actually point to the same interpreter and give sys.executable == '/usr/local/opt/python3/bin/python3.6', but they would be treated as different interpreters.

When comparing if the path to the Python interpreter from the shebang in a file and the pythonPath setting point to one and the same interpreter, resolve pythonPath to the path to the actual Python interpreter executable before the comparison.
@brettcannon
Copy link
Member

@DonJayamanne what do you think?

@DonJayamanne DonJayamanne merged commit 7372367 into microsoft:master Nov 22, 2017
@brettcannon brettcannon added this to the December 2017 milestone Nov 22, 2017
DonJayamanne added a commit that referenced this pull request Dec 14, 2017
* upstream/master:
  Resolve pythonPath before comparing it to shebang (#273)
@fnesveda fnesveda deleted the shebangCodeLensResolvePythonPath branch February 14, 2019 09:14
@fnesveda fnesveda restored the shebangCodeLensResolvePythonPath branch February 14, 2019 09:15
@fnesveda fnesveda deleted the shebangCodeLensResolvePythonPath branch February 14, 2019 09:20
@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants