Skip to content

Commit dbcd1f7

Browse files
authored
Merge pull request winpython#1498 from stonebig/master
move ".bat" fixed scripts out of make.py
2 parents dc93b62 + 57c7e50 commit dbcd1f7

22 files changed

+86
-142
lines changed

make.py

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,6 @@ def _create_initial_batch_scripts(self):
636636
"""
637637
self.create_batch_script("WinPython_PS_Prompt.ps1", ps1_content, replacements=batch_replacements)
638638

639-
cmd_ps_bat_content = r"""@echo off
640-
call "%~dp0env_for_icons.bat"
641-
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
642-
"""
643-
self.create_batch_script("cmd_ps.bat", cmd_ps_bat_content, replacements=batch_replacements)
644-
645639

646640
env_for_icons_bat_content = r"""@echo off
647641
call "%~dp0env.bat"
@@ -703,34 +697,11 @@ def _create_standard_batch_scripts(self):
703697
if self.distribution and (Path(self.distribution.target) / r"lib-python\3\idlelib").is_dir():
704698
batch_replacements.append((r"\Lib\idlelib", r"\lib-python\3\idlelib"))
705699

706-
707700
self.create_batch_script("readme.txt", """These batch files are required to run WinPython icons.
708701
These files should help the user writing his/her own
709702
The environment variables are set-up in 'env.bat' and 'env_for_icons.bat'.""",
710703
)
711704

712-
self.create_batch_script(
713-
"make_winpython_movable.bat",
714-
r"""@echo off
715-
call "%~dp0env.bat"
716-
echo patch pip and current launchers for move
717-
718-
"%WINPYDIR%\python.exe" -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True)"
719-
pause""",
720-
replacements=batch_replacements
721-
)
722-
723-
self.create_batch_script(
724-
"make_winpython_fix.bat",
725-
r"""@echo off
726-
call "%~dp0env.bat"
727-
echo patch pip and current launchers for non-move
728-
729-
"%WINPYDIR%\python.exe" -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=False)"
730-
pause""",
731-
replacements=batch_replacements
732-
)
733-
734705
for ini_patch_script in [
735706
("make_working_directory_be_not_winpython.bat", "[active_environment", "[inactive_environment", "[inactive_environment_per_user]", "[active_environment_per_user]"),
736707
("make_working_directory_be_winpython.bat", "[active_environment", "[inactive_environment"),
@@ -744,119 +715,6 @@ def _create_standard_batch_scripts(self):
744715
content += f""""%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\\settings\winpython.ini', '{patch2[0]}', '{patch2[1]}' )" """
745716
self.create_batch_script(name, content)
746717

747-
748-
self.create_batch_script("cmd.bat", r"""@echo off
749-
call "%~dp0env_for_icons.bat" %*
750-
cmd.exe /k""", replacements=batch_replacements)
751-
752-
self.create_batch_script("WinPython_Terminal.bat", r"""@echo off
753-
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
754-
exit""", replacements=batch_replacements)
755-
756-
self.create_batch_script("python.bat", r"""@echo off
757-
call "%~dp0env_for_icons.bat" %*
758-
"%WINPYDIR%\python.exe" %*""", replacements=batch_replacements)
759-
760-
self.create_batch_script(
761-
"winpython.bat",
762-
r"""@echo off
763-
call "%~dp0env_for_icons.bat" %*
764-
rem backward compatibility for non-ptpython users
765-
if exist "%WINPYDIR%\scripts\ptpython.exe" (
766-
"%WINPYDIR%\scripts\ptpython.exe" %*
767-
) else (
768-
"%WINPYDIR%\python.exe" %*
769-
)""",
770-
replacements=batch_replacements
771-
)
772-
773-
self.create_batch_script(
774-
"winidle.bat",
775-
r"""@echo off
776-
call "%~dp0env_for_icons.bat" %*
777-
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*""",
778-
replacements=batch_replacements
779-
)
780-
781-
self.create_batch_script(
782-
"winspyder.bat",
783-
r"""@echo off
784-
call "%~dp0env_for_icons.bat" %*
785-
"%WINPYDIR%\scripts\spyder.exe" %* -w "%WINPYWORKDIR1%" """,
786-
)
787-
788-
self.create_batch_script(
789-
"spyder_reset.bat",
790-
r"""@echo off
791-
call "%~dp0env_for_icons.bat"
792-
"%WINPYDIR%\scripts\spyder.exe" --reset %*""",
793-
)
794-
795-
for jupyter_script in [
796-
("winipython_notebook.bat", "jupyter-notebook.exe"),
797-
("winjupyter_lab.bat", "jupyter-lab.exe"),
798-
("winqtconsole.bat", "jupyter-qtconsole.exe"),
799-
]:
800-
name, exe = jupyter_script
801-
self.create_batch_script(name, f"""@echo off
802-
call "%~dp0env_for_icons.bat" %*
803-
"%WINPYDIR%\\scripts\\{exe}" %*""")
804-
805-
806-
self.create_python_launcher_batch(
807-
"register_python.bat",
808-
r'"%WINPYDIR%\Lib\site-packages\winpython\register_python.py"',
809-
working_dir=r'"%WINPYDIR%\Scripts"',
810-
)
811-
812-
self.create_python_launcher_batch(
813-
"unregister_python.bat",
814-
r'"%WINPYDIR%\Lib\site-packages\winpython\unregister_python.py"',
815-
working_dir=r'"%WINPYDIR%\Scripts"',
816-
)
817-
818-
for register_all_script in [
819-
("register_python_for_all.bat", "register_python.bat"),
820-
("unregister_python_for_all.bat", "unregister_python.bat"),
821-
]:
822-
name, base_script = register_all_script
823-
self.create_batch_script(name, f"""@echo off
824-
call "%~dp0env.bat"
825-
call "%~dp0{base_script}" --all""")
826-
827-
828-
self.create_batch_script("wpcp.bat", r"""@echo off
829-
call "%~dp0env_for_icons.bat" %*
830-
cmd.exe /k "echo wppm & wppm" """, replacements=batch_replacements)
831-
832-
self.create_batch_script(
833-
"upgrade_pip.bat",
834-
r"""@echo off
835-
call "%~dp0env.bat"
836-
echo this will upgrade pip with latest version, then patch it for WinPython portability ok ?
837-
pause
838-
"%WINPYDIR%\python.exe" -m pip install --upgrade pip
839-
"%WINPYDIR%\python.exe" -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True)
840-
pause""",
841-
replacements=batch_replacements
842-
)
843-
844-
self.create_batch_script("activate.bat", r"""@echo off
845-
call "%~dp0env.bat" %*""", replacements=batch_replacements)
846-
847-
848-
vscode_bat_content = r"""@echo off
849-
call "%~dp0env_for_icons.bat"
850-
if exist "%WINPYDIR%\..\t\vscode\code.exe" (
851-
"%WINPYDIR%\..\t\vscode\code.exe" %*
852-
) else (
853-
if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe" (
854-
"%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe" %*
855-
) else (
856-
"code.exe" %*
857-
))"""
858-
self.create_batch_script("winvscode.bat", vscode_bat_content)
859-
860718
self._print_action_done()
861719

862720

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
3+
exit

portable/scripts/activate.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
call "%~dp0env.bat" %*

portable/scripts/cmd.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
call "%~dp0env_for_icons.bat" %*
3+
cmd.exe /k

portable/scripts/cmd_ps.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
call "%~dp0env_for_icons.bat"
3+
Powershell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -noexit -File ""%~dp0WinPython_PS_Prompt.ps1""'}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
call "%~dp0env.bat"
3+
echo patch pip and current launchers for non-move
4+
5+
"%WINPYDIR%\python.exe" -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=False)"
6+
pause
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
call "%~dp0env.bat"
3+
echo patch pip and current launchers for move
4+
5+
"%WINPYDIR%\python.exe" -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True)"
6+
pause

portable/scripts/python.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
call "%~dp0env_for_icons.bat" %*
3+
"%WINPYDIR%\python.exe" %*
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
call "%~dp0env_for_icons.bat"
3+
cd /D "%WINPYDIR%\Scripts"
4+
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\winpython\register_python.py" %*
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
call "%~dp0env.bat"
3+
call "%~dp0register_python.bat" --all

0 commit comments

Comments
 (0)