Skip to content

remove useless complexity: "working_directory" program generator #1503

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
Mar 13, 2025
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
24 changes: 0 additions & 24 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
def find_7zip_executable() -> str:
"""
Locates the 7-Zip executable (7z.exe) in common installation directories.

Raises:
RuntimeError: If 7-Zip executable is not found.

Returns:
str: Path to the 7-Zip executable.
"""
program_files_dirs = [
Path(r"C:\Program Files"),
Expand Down Expand Up @@ -116,11 +110,6 @@ def build_installer_7zip(
def _copy_items(source_dirs: list[Path], target_dir: Path, verbose: bool = False):
"""
Copies items from source directories to the target directory.

Args:
source_dirs: List of source directories to copy items from.
target_dir: Target directory to copy items to.
verbose: Enable verbose output.
"""
target_dir.mkdir(parents=True, exist_ok=True)
for source_dir in source_dirs:
Expand Down Expand Up @@ -538,19 +527,6 @@ def _create_standard_batch_scripts(self):
if self.distribution and (Path(self.distribution.target) / r"lib-python\3\idlelib").is_dir():
batch_replacements.append((r"\Lib\idlelib", r"\lib-python\3\idlelib"))

for ini_patch_script in [
("make_working_directory_be_not_winpython.bat", "[active_environment", "[inactive_environment", "[inactive_environment_per_user]", "[active_environment_per_user]"),
("make_working_directory_be_winpython.bat", "[active_environment", "[inactive_environment"),
("make_working_directory_and_userprofile_be_winpython.bat", "[active_environment", "[inactive_environment", "[inactive_environment_common]", "[active_environment_common]")
]:
name, patch1_start, patch1_end, *patch2 = ini_patch_script
content = f"""call "%~dp0env_for_icons.bat"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\\settings\winpython.ini', '{patch1_start}', '{patch1_end}' )"
"""
if patch2:
content += f""""%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\\settings\winpython.ini', '{patch2[0]}', '{patch2[1]}' )" """
self.create_batch_script(name, content)

self._print_action_done()


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
call "%~dp0env_for_icons.bat"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\settings\winpython.ini', '[active_environment', '[inactive_environment' )"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\settings\winpython.ini', '[inactive_environment_common]', '[active_environment_common]' )"
3 changes: 3 additions & 0 deletions portable/scripts/make_working_directory_be_not_winpython.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
call "%~dp0env_for_icons.bat"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\settings\winpython.ini', '[active_environment', '[inactive_environment' )"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\settings\winpython.ini', '[inactive_environment_per_user]', '[active_environment_per_user]' )"
2 changes: 2 additions & 0 deletions portable/scripts/make_working_directory_be_winpython.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
call "%~dp0env_for_icons.bat"
"%PYTHON%" -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%~dp0..\settings\winpython.ini', '[active_environment', '[inactive_environment' )"