From 79711a39e1ab1098d75996601f7c6e8348b82d06 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 21 Jan 2026 22:04:54 +0000 Subject: [PATCH 1/3] Add configuration setting to disable entrypoint generation. Fixes #255 --- src/manage/aliasutils.py | 3 +++ src/manage/commands.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/manage/aliasutils.py b/src/manage/aliasutils.py index e76e777..cdf9d7c 100644 --- a/src/manage/aliasutils.py +++ b/src/manage/aliasutils.py @@ -289,6 +289,9 @@ def calculate_aliases(cmd, install, *, _scan=_scan): if default_alias_w: yield default_alias_w.replace(name="pythonw", windowed=1) + if not cmd.enable_entrypoints: + return + site_dirs = DEFAULT_SITE_DIRS for s in install.get("shortcuts", ()): if s.get("kind") == "site-dirs": diff --git a/src/manage/commands.py b/src/manage/commands.py index 1179fa7..b0cda96 100644 --- a/src/manage/commands.py +++ b/src/manage/commands.py @@ -257,6 +257,7 @@ def execute(self): "disable_shortcut_kinds": (str, config_split_append), "default_install_tag": (str, None), "preserve_site_on_upgrade": (config_bool, None), + "enable_entrypoints": (config_bool, None), }, "first_run": { @@ -821,6 +822,7 @@ class InstallCommand(BaseCommand): disable_shortcut_kinds = None default_install_tag = None preserve_site_on_upgrade = True + enable_entrypoints = True def __init__(self, args, root=None): super().__init__(args, root) From a3d5f8cf3960e89845d2d45a05b108f207601079 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 21 Jan 2026 22:35:25 +0000 Subject: [PATCH 2/3] Add new setting to tests that need it --- tests/test_alias.py | 1 + tests/test_install_command.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/test_alias.py b/tests/test_alias.py index 27da874..9366d3f 100644 --- a/tests/test_alias.py +++ b/tests/test_alias.py @@ -240,6 +240,7 @@ def test_parse_entrypoint_line(): def test_scan_entrypoints(fake_config, tmp_path): + fake_config.enable_entrypoints = True root = tmp_path / "test_install" site = root / "site-packages" A = site / "A.dist-info" diff --git a/tests/test_install_command.py b/tests/test_install_command.py index 7cc64d9..1415c81 100644 --- a/tests/test_install_command.py +++ b/tests/test_install_command.py @@ -173,6 +173,7 @@ class Cmd: launcher_exe = None scratch = {} enable_shortcut_kinds = disable_shortcut_kinds = None + enable_entrypoints = True def get_installs(self): return [ { From 89f07587a626e0bdca56fbf6ccbeb4fcf920a594 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 22 Jan 2026 13:54:46 +0000 Subject: [PATCH 3/3] Add test for when entrypoints are disabled --- tests/test_alias.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_alias.py b/tests/test_alias.py index 9366d3f..ce46f9b 100644 --- a/tests/test_alias.py +++ b/tests/test_alias.py @@ -269,6 +269,36 @@ def test_scan_entrypoints(fake_config, tmp_path): assert [None, None, None, "main", "main"] == [a.func for a in actual] +def test_scan_entrypoints_disabled(fake_config, tmp_path): + fake_config.enable_entrypoints = False + root = tmp_path / "test_install" + site = root / "site-packages" + A = site / "A.dist-info" + A.mkdir(parents=True, exist_ok=True) + (root / "target.exe").write_bytes(b"") + (A / "entry_points.txt").write_text("""[console_scripts] +a = a:main + +[gui_scripts] +aw = a:main +""") + + install = dict( + prefix=root, + id="test", + default=1, + alias=[dict(name="target", target="target.exe")], + shortcuts=[dict(kind="site-dirs", dirs=["site-packages"])], + ) + + actual = list(AU.calculate_aliases(fake_config, install)) + + assert ["target", "python", "pythonw"] == [a.name for a in actual] + assert [0, 0, 1] == [a.windowed for a in actual] + assert [None, None, None] == [a.mod for a in actual] + assert [None, None, None] == [a.func for a in actual] + + def test_create_aliases(fake_config, tmp_path): target = tmp_path / "target.exe" target.write_bytes(b"")