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
prototyping pythonfinder pep514 support #6140
base: main
Are you sure you want to change the base?
Conversation
key_path = r"Software\Python\PythonCore" | ||
try: | ||
import winreg | ||
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path) as key: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's two other registry locations we need to apply the same process to, to find user-land installations and 32-bit installs on 64-bit Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help with all this -- greatly appreciated. Do you know what the other paths would be? I can get back to looking at this soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per PEP-0514, the three registry paths that need to be checked are:
HKEY_CURRENT_USER\Software\Python\<Company>\<Tag>
HKEY_LOCAL_MACHINE\Software\Python\<Company>\<Tag>
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Python\<Company>\<Tag>
You can check them all the same way, there's some notes there about what to do if you see the same Company-Tag combination in different registry paths, and specific notes about how to disambiguate 32-bit and 64-bit Python older than 3.5, which did not include architecture in its Tag, and so has the same Company-Tag for 32-bit and 64-bit installs.
@@ -302,6 +317,39 @@ def which(self, name) -> PathEntry | None: | |||
non_empty_match = next(iter(m for m in matches if m is not None), None) | |||
return non_empty_match | |||
|
|||
def find_python_versions_from_windows_launcher(self): | |||
# Open the registry key for Python launcher | |||
key_path = r"Software\Python\PythonCore" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to support non-PythonCore environments at some point, e.g., conda.
Accept PR suggestion Co-authored-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickly plumbed through the architecture, since we should have that available for Python 3.5 onwards.
Co-authored-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Co-authored-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Co-authored-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Co-authored-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Prototyping bringing back a level of pep514 support to pythonfinder (would back-vendor it to pythonfinder if successful).
The checklist
news/
directory to describe this fix with the extension.bugfix.rst
,.feature.rst
,.behavior.rst
,.doc.rst
..vendor.rst
. or.trivial.rst
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.