Skip to content

Commit fff0310

Browse files
authored
Separate default install tag from default launch tag. (#146)
This 'fixes' issues people have where they want the prerelease installer but not prerelease Python. At 3.14's release, we'll remove the default config setting that installs 3-dev. Fixes #122
1 parent e5f1f87 commit fff0310

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

src/manage/commands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# or check out the docs for administrative controls:
2323
# https://docs.python.org/using/windows
2424
DEFAULT_SOURCE_URL = "https://www.python.org/ftp/python/index-windows.json"
25-
DEFAULT_TAG = "3.14"
25+
DEFAULT_TAG = "3"
2626

2727

2828
# TODO: Remove the /dev/ for stable release
@@ -253,6 +253,7 @@ def execute(self):
253253
"fallback_source": (str, None, "env", "path", "uri"),
254254
"enable_shortcut_kinds": (str, config_split_append),
255255
"disable_shortcut_kinds": (str, config_split_append),
256+
"default_install_tag": (str, None),
256257
},
257258

258259
"first_run": {
@@ -792,12 +793,15 @@ class InstallCommand(BaseCommand):
792793
from_script = None
793794
enable_shortcut_kinds = None
794795
disable_shortcut_kinds = None
796+
default_install_tag = None
795797

796798
def __init__(self, args, root=None):
797799
super().__init__(args, root)
798800

799801
if not self.source:
800802
self.source = DEFAULT_SOURCE_URL
803+
if not self.default_install_tag:
804+
self.default_install_tag = self.default_tag
801805
if "://" not in str(self.source):
802806
try:
803807
self.source = Path(self.source).absolute().as_uri()

src/manage/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def resolve_config(cfg, source, relative_to, key_so_far="", schema=None, error_u
208208

209209
def merge_config(into_cfg, from_cfg, schema, *, source="<unknown>", overwrite=False):
210210
for k, v in from_cfg.items():
211+
if k.startswith("#"):
212+
continue
211213
try:
212214
into = into_cfg[k]
213215
except LookupError:

src/manage/install_command.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,16 @@ def execute(cmd):
621621
if not cmd.by_id:
622622
for arg in cmd.args:
623623
if arg.casefold() == "default".casefold():
624-
LOGGER.debug("Replacing 'default' with '%s'", cmd.default_tag)
625-
cmd.tags.append(tag_or_range(cmd.default_tag))
624+
LOGGER.debug("Replacing 'default' with '%s'", cmd.default_install_tag)
625+
cmd.tags.append(tag_or_range(cmd.default_install_tag))
626626
else:
627627
try:
628628
cmd.tags.append(tag_or_range(arg))
629629
except ValueError as ex:
630630
LOGGER.warn("%s", ex)
631631

632632
if not cmd.tags and cmd.automatic:
633-
cmd.tags = [tag_or_range(cmd.default_tag)]
633+
cmd.tags = [tag_or_range(cmd.default_install_tag)]
634634
else:
635635
if cmd.from_script:
636636
raise ArgumentError("Cannot use --by-id and --from-script together")
@@ -646,9 +646,9 @@ def execute(cmd):
646646
try:
647647
tag = cmd.tags[0]
648648
except IndexError:
649-
if cmd.default_tag:
650-
LOGGER.debug("No tags provided, installing default tag %s", cmd.default_tag)
651-
tag = cmd.default_tag
649+
if cmd.default_install_tag:
650+
LOGGER.debug("No tags provided, installing default tag %s", cmd.default_install_tag)
651+
tag = cmd.default_install_tag
652652
else:
653653
LOGGER.debug("No tags provided, installing first runtime in feed")
654654
tag = None
@@ -688,7 +688,7 @@ def execute(cmd):
688688
if spec:
689689
cmd.tags.append(tag_or_range(spec))
690690
else:
691-
cmd.tags.append(tag_or_range(cmd.default_tag))
691+
cmd.tags.append(tag_or_range(cmd.default_install_tag))
692692

693693
installed = list(cmd.get_installs())
694694

src/pymanager.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"install": {
33
"source": "%PYTHON_MANAGER_SOURCE_URL%",
4-
"fallback_source": "./bundled/fallback-index.json"
4+
"fallback_source": "./bundled/fallback-index.json",
5+
6+
"#": "Install 3.14 (prerelease) by default during prerelease PyManager",
7+
"default_install_tag": "3-dev"
58
},
69
"list": {
710
"format": "%PYTHON_MANAGER_LIST_FORMAT%"

0 commit comments

Comments
 (0)