Skip to content

Commit ddf3a59

Browse files
committed
migrate to single mkshim400.py method
1 parent 3c7a96f commit ddf3a59

File tree

6 files changed

+41
-171
lines changed

6 files changed

+41
-171
lines changed

make.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,17 @@ def updateExecutableIcon(executablePath, iconPath):
252252
win32api.EndUpdateResource(handle, False)
253253

254254

255-
def build_shimmy_launcher(launcher_name, command, icon_path, mkshim_program='mkshim400.py'):
256-
"""Build .exe launcher with mkshim400.py and pywin32"""
255+
def build_shimmy_launcher(launcher_name, command, icon_path, mkshim_program='mkshim400.py', workdir=''):
256+
"""Build .exe launcher with mkshim_program and pywin32"""
257257

258258
# define where is mkshim
259259
mkshim_program = str(Path(__file__).resolve().parent / mkshim_program)
260260
python_program = utils.get_python_executable()
261261

262262
# Create the executable using mkshim.py or mkshim240.py
263263
mkshim_command = f'{python_program} "{mkshim_program}" -f "{launcher_name}" -c "{command}"'
264+
if workdir !='': # V03 of shim: we can handle an optional sub-directory
265+
mkshim_command += f' --subdir "{workdir}"'
264266
print(f"Building .exe launcher with {mkshim_program}:", mkshim_command)
265267
subprocess.run(mkshim_command, shell=True)
266268

@@ -590,7 +592,7 @@ def create_launcher_shimmy(
590592
icon,
591593
command=None,
592594
args=None,
593-
workdir=r"", # not used, use $env:WINPYDIRICONS variable in command line
595+
workdir=r"", # ".\script" to go to sub-directory of the icon
594596
mkshim_program="mkshim400.py", # to force another one
595597
):
596598
"""Create an exe launcher with mkshim.py"""
@@ -608,7 +610,7 @@ def create_launcher_shimmy(
608610
command = "${WINPYDIR}\python.exe" #not used
609611
iconlauncherfullname= str(Path(self.winpydir) / name)
610612
true_command = command.replace(r"$SYSDIR\cmd.exe","cmd.exe")+ " " + args
611-
build_shimmy_launcher(iconlauncherfullname, true_command, icon_fname, mkshim_program=mkshim_program)
613+
build_shimmy_launcher(iconlauncherfullname, true_command, icon_fname, mkshim_program=mkshim_program, workdir=workdir)
612614

613615
def create_launcher(
614616
self,
@@ -823,7 +825,7 @@ def _create_launchers(self):
823825
"cmd.ico",
824826
command=".\\cmd.bat",
825827
args=r"",
826-
mkshim_program="mkshim400s.py",
828+
workdir=r".\scripts"
827829
)
828830

829831
self.create_launcher_shimmy(
@@ -847,7 +849,7 @@ def _create_launchers(self):
847849
"python.ico",
848850
command=".\\winpython.bat",
849851
args=r"",
850-
mkshim_program="mkshim400s.py",
852+
workdir=r".\scripts"
851853
)
852854

853855
self.create_launcher_shimmy(
@@ -879,7 +881,7 @@ def _create_launchers(self):
879881
"winpython.ico",
880882
command=".\\wpcp.bat",
881883
args=r"",
882-
mkshim_program="mkshim400s.py",
884+
workdir=r".\scripts"
883885
)
884886

885887
# Jupyter launchers
@@ -890,7 +892,7 @@ def _create_launchers(self):
890892
"jupyter.ico",
891893
command="winipython_notebook.bat",
892894
args=r"",
893-
mkshim_program="mkshim400s.py",
895+
workdir=r".\scripts"
894896
)
895897

896898
self.create_launcher_shimmy(
@@ -900,15 +902,15 @@ def _create_launchers(self):
900902
#args=r"/k winjupyter_lab.bat",
901903
command="winjupyter_lab.bat",
902904
args=r"",
903-
mkshim_program="mkshim400s.py",
905+
workdir=r".\scripts"
904906
)
905907

906908
self.create_launcher_shimmy(
907909
"VS Code.exe",
908910
"code.ico",
909911
command="winvscode.bat",
910912
args=r"",
911-
mkshim_program="mkshim400s.py",
913+
workdir=r".\scripts"
912914
)
913915

914916
self._print_done()

mkshim.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

mkshim240.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

mkshim400.py

Lines changed: 28 additions & 8 deletions
Large diffs are not rendered by default.

mkshim400s.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '10.3.20240901'
31+
__version__ = '10.4.20240904'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

0 commit comments

Comments
 (0)