Skip to content
Merged
Show file tree
Hide file tree
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
132 changes: 44 additions & 88 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ def updateExecutableIcon(executablePath, iconPath):
win32api.EndUpdateResource(handle, False)


def build_shimmy_launcher(launcher_name, command, icon_path, mkshim_program='mkshim240.py'):
"""Build .exe launcher with mkshim.py and pywin32"""
def build_shimmy_launcher(launcher_name, command, icon_path, mkshim_program='mkshim400.py'):
"""Build .exe launcher with mkshim400.py and pywin32"""

# define where is mkshim
mkshim_program = str(Path(__file__).resolve().parent / mkshim_program)
Expand Down Expand Up @@ -590,23 +590,25 @@ def create_launcher_shimmy(
icon,
command=None,
args=None,
workdir=r"$EXEDIR\scripts",
workdir=r"", # not used, use $env:WINPYDIRICONS variable in command line
mkshim_program="mkshim400.py", # to force another one
):
"""Create exe launcher with mkshim.py"""
"""Create an exe launcher with mkshim.py"""
assert name.endswith(".exe")
portable_dir = str(Path(__file__).resolve().parent / "portable")
icon_fname = str(Path(portable_dir) / "icons" / icon)
assert Path(icon_fname).is_file()

# prepare mkshim.py script
# $env:WINPYDIRICONS variable give the icons directory
if command is None:
if args is not None and ".pyw" in args:
command = "${WINPYDIR}\pythonw.exe"
command = "${WINPYDIR}\pythonw.exe" #not used
else:
command = "${WINPYDIR}\python.exe"
command = "${WINPYDIR}\python.exe" #not used
iconlauncherfullname= str(Path(self.winpydir) / name)
true_command = command.replace(r"$SYSDIR\cmd.exe","cmd.exe")+ " " + args
build_shimmy_launcher(iconlauncherfullname, true_command, icon_fname)
build_shimmy_launcher(iconlauncherfullname, true_command, icon_fname, mkshim_program=mkshim_program)

def create_launcher(
self,
Expand Down Expand Up @@ -819,97 +821,65 @@ def _create_launchers(self):
self.create_launcher_shimmy(
"WinPython Command Prompt.exe",
"cmd.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k cmd.bat",
command="scripts\\cmd.bat",
command=".\\cmd.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

#self.create_launcher(
# "WinPython Powershell Prompt.exe",
# "powershell.ico",
# command="$SYSDIR\cmd.exe",
# args=r"/k cmd_ps.bat",
#)

self.create_launcher_shimmy(
"WinPython Powershell Prompt.exe",
"powershell.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k scripts\\cmd_ps.bat",
command="scripts\\cmd_ps.bat",
args=r"",
command="Powershell.exe",
args=r"start-process -WindowStyle Hidden -FilePath ([dollar]ENV:WINPYDIRICONS + '\scripts\cmd_ps.bat')",
#command="%WINPYDIRICONS%\\scripts\\cmd_ps.bat",
#args=r"",
)

#self.create_launcher(
#self.create_launcher_shimmy(
# "WinPython Terminal.exe",
# "terminal.ico",
# command="wscript.exe",
# args=r"Noshell.vbs WinPython_Terminal.bat",
# command="Powershell.exe",
# args=r"start-process -WindowStyle Hidden './scripts/WinPython_Terminal.bat",
#)

self.create_launcher_shimmy(
"WinPython Interpreter.exe",
"python.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k scripts\\winpython.bat",
command="scripts\\winpython.bat",
command=".\\winpython.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

#self.create_launcher(
# "IDLE (Python GUI).exe",
# "python.ico",
# command="wscript.exe",
# args=r"Noshell.vbs winidle.bat",
#)

#dos window behind, but that disappear

self.create_launcher_shimmy(
"IDLE (Python GUI).exe",
"python.ico",
command="Powershell.exe",
args=r"start-process -WindowStyle Hidden './scripts/winidle.bat'",
args=r"start-process -WindowStyle Hidden -FilePath ([dollar]ENV:WINPYDIRICONS + '\scripts\winidle.bat')",
#command="scripts\\Noshell.vbs scripts\\winidle.bat",
#args=r"",
)

#self.create_launcher(
# "Spyder.exe",
# "spyder.ico",
# command="wscript.exe",
# args=r"Noshell.vbs winspyder.bat",
#)

self.create_launcher_shimmy(
"Spyder.exe",
"spyder.ico",
command="Powershell.exe",
args=r"start-process -WindowStyle Hidden './scripts/winspyder.bat'",
args=r"start-process -WindowStyle Hidden -FilePath ([dollar]ENV:WINPYDIRICONS + '\scripts\winspyder.bat')",
)

#self.create_launcher(
# "Spyder reset.exe",
# "spyder_reset.ico",
# command="wscript.exe",
# args=r"scripts\\Noshell.vbs scripts\\spyder_reset.bat",
#)

self.create_launcher_shimmy(
"Spyder reset.exe",
"spyder_reset.ico",
command="Powershell.exe",
args=r"start-process -WindowStyle Hidden './scripts/spyder_reset.bat",
args=r"start-process -WindowStyle Hidden -FilePath ([dollar]ENV:WINPYDIRICONS + '\scripts\spyder_reset.bat')",
#args=r"start-process -WindowStyle Hidden './scripts/spyder_reset.bat",
)

self.create_launcher_shimmy(
"WinPython Control Panel.exe",
"winpython.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k scripts\\wpcp.bat",
command="scripts\\wpcp.bat",
command=".\\wpcp.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

# Jupyter launchers
Expand All @@ -918,41 +888,27 @@ def _create_launchers(self):
self.create_launcher_shimmy(
"Jupyter Notebook.exe",
"jupyter.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k winipython_notebook.bat", # like VSCode + Rise way
command="scripts\\winipython_notebook.bat",
command="winipython_notebook.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

#self.create_launcher(
# "Jupyter Lab.exe",
# "jupyter.ico",
# command="$SYSDIR\cmd.exe",
# args=r"/k winjupyter_lab.bat",
#)

self.create_launcher_shimmy(
"Jupyter Lab.exe",
"jupyter.ico",
#command="$SYSDIR\cmd.exe",
#args=r"/k winjupyter_lab.bat",
command="scripts\\winjupyter_lab.bat",
command="winjupyter_lab.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

# VSCode launcher
#self.create_launcher_shimmy(
# "VS Code.exe",
# "code.ico",
# command="wscript.exe",
# args=r"scripts\\Noshell.vbs scripts\\winvscode.bat",
#)

self.create_launcher_shimmy(
"VS Code.exe",
"code.ico",
command="scripts\\winvscode.bat",
command="winvscode.bat",
args=r"",
mkshim_program="mkshim400s.py",
)

self._print_done()
Expand Down Expand Up @@ -1568,15 +1524,15 @@ def _create_batch_scripts(self):
self.create_batch_script(
"cmd.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd %WINPYWORKDIR1%
cmd.exe /k""",
)

self.create_batch_script(
"WinPython_Terminal.bat",
r"""@echo off
rem call "%~dp0env_for_icons.bat" %*
rem call "%~dp0env_for_icons.bat"
rem if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd %WINPYWORKDIR1%
rem "%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe"
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
Expand All @@ -1587,7 +1543,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"python.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
rem backward compatibility for python command-line users
if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd %WINPYWORKDIR1%
"%WINPYDIR%\python.exe" %*
Expand All @@ -1598,7 +1554,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winpython.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
rem backward compatibility for non-ptpython users
if exist "%WINPYDIR%\scripts\ptpython.exe" (
Expand All @@ -1613,7 +1569,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winidle.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*
""",
Expand All @@ -1623,7 +1579,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winspyder.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
rem cd/D "%WINPYWORKDIR%"
if exist "%WINPYDIR%\scripts\spyder3.exe" (
"%WINPYDIR%\scripts\spyder3.exe" %* -w "%WINPYWORKDIR1%"
Expand All @@ -1636,7 +1592,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"spyder_reset.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
if exist "%WINPYDIR%\scripts\spyder3.exe" (
"%WINPYDIR%\scripts\spyder3.exe" --reset %*
Expand All @@ -1649,7 +1605,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winipython_notebook.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
"%WINPYDIR%\scripts\jupyter-notebook.exe" %*
""",
Expand All @@ -1658,7 +1614,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winjupyter_lab.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
"%WINPYDIR%\scripts\jupyter-lab.exe" %*
""",
Expand All @@ -1667,7 +1623,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"winqtconsole.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR1%"
"%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
""",
Expand Down Expand Up @@ -1702,7 +1658,7 @@ def _create_batch_scripts(self):
self.create_batch_script(
"wpcp.bat",
r"""@echo off
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
rem cd/D "%WINPYWORKDIR1%"
rem "%WINPYDIR%\python.exe" -m winpython.controlpanel %*
if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd/d %WINPYWORKDIR1%
Expand Down Expand Up @@ -1736,7 +1692,7 @@ def _create_batch_scripts(self):
"winvscode.bat",
r"""@echo off
rem launcher for VScode
call "%~dp0env_for_icons.bat" %*
call "%~dp0env_for_icons.bat"
rem cd/D "%WINPYWORKDIR1%"
if exist "%WINPYDIR%\..\t\vscode\code.exe" (
"%WINPYDIR%\..\t\vscode\code.exe" %*
Expand Down
64 changes: 64 additions & 0 deletions mkshim400.py

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions mkshim400s.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '10.2.20240825'
__version__ = '10.3.20240901'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'