Skip to content

tweak associate.py, manual step #1561

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
Apr 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions winpython/associate.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def register(target, current=True, verbose=True):
spyder = str((Path(target).parent / "Spyder.exe").resolve())

if not Path(spyder).is_file():
spyder = f'{pythonw}" "{target}\Scripts\spyder'
spyder = rf'{pythonw}" "{target}\Scripts\spyder'
winreg.SetValueEx(
winreg.CreateKey(root, KEY_C2 % ("", "open")),
"",
Expand All @@ -157,14 +157,14 @@ def register(target, current=True, verbose=True):
"",
0,
winreg.REG_SZ,
'"%s" "%s\Lib\idlelib\idle.pyw" -n -e "%%1"' % (pythonw, target),
rf'"{pythonw}" "{target}\Lib\idlelib\idle.pyw" -n -e "%1"',
)
winreg.SetValueEx(
winreg.CreateKey(root, KEY_C2 % ("NoCon", EWI)),
"",
0,
winreg.REG_SZ,
'"%s" "%s\Lib\idlelib\idle.pyw" -n -e "%%1"' % (pythonw, target),
rf'"{pythonw}" "{target}\Lib\idlelib\idle.pyw" -n -e "%1"',
)
winreg.SetValueEx(
winreg.CreateKey(root, KEY_C2 % ("", EWS)),
Expand Down Expand Up @@ -338,9 +338,9 @@ def register(target, current=True, verbose=True):

# Create start menu entries for all WinPython launchers
spec = importlib.util.find_spec('pythoncom')
if verbose and spec is None:
print(f"Can't create WinPython menu as pywin32 package is not installed")
if verbose and spec is not None:
if spec is None:
print(f"Registered WinPython, but not start menu as pywin32 package is needed")
if spec is not None:
print(f'Creating WinPython menu for all icons in {target}')
for path, desc, fname in _get_shortcut_data(target, current=current):
utils.create_shortcut(path, desc, fname, verbose=verbose)
Expand Down Expand Up @@ -414,8 +414,8 @@ def unregister(target, current=True, verbose=True):
)
# remove menu shortcuts
spec = importlib.util.find_spec('pythoncom')
if verbose and spec is None:
print(f"Can't remove WinPython menu as pywin32 package is not installed")
if spec is None:
print(f"un-Registered WinPython, but not start menu as pywin32 package is needed")
if verbose and spec is not None:
print(f'Removing WinPython menu for all icons in {target}')
_remove_start_menu_folder(target, current=current)
Expand Down