Skip to content

Conversation

@lrandersson
Copy link
Contributor

@lrandersson lrandersson commented Dec 17, 2025

Description

This does not fully resolve #1103 but is a start.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Dec 17, 2025
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Dec 17, 2025
@lrandersson lrandersson force-pushed the briefcase-installer-options branch from 7ae9015 to 532ff27 Compare December 17, 2025 16:07
@lrandersson lrandersson marked this pull request as ready for review December 17, 2025 16:08
@lrandersson lrandersson requested a review from a team as a code owner December 17, 2025 16:08
)
initialize_conda = info.get("initialize_conda", "classic")
if initialize_conda:
# TODO: How would we distinguish between True/classic in the UI? Same for NSIS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True and classic are synonyms. You would have to distinguish between classic and condabin. You can currently just take what's in the NSIS template and add that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 326be7f

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about these lines:

# Account for the conda mode
${If} "${INIT_CONDA_MODE}" == "condabin"
${NSD_CreateLabel} 5% "$5u" 90% 20u \
"Adds condabin/, which only contains the 'conda' executables, to PATH. \
Does not require special shortcuts but activation needs \
to be performed manually."
${Else}
${NSD_CreateLabel} 5% "$5u" 90% 20u \
"NOT recommended. This can lead to conflicts with other applications. \
Instead, use the Commmand Prompt and Powershell menus added \
to the Windows Start Menu."
${EndIf}

You can then add the condabin UI text if info.get("initialize_conda", "classic") == "condabin", and the other text if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, updated a642278

{
"name": "register_python",
"title": "Register Python as System Default",
"description": "TODO: Register Python description",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, you can just copy the description in NSIS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 326be7f

@lrandersson lrandersson force-pushed the briefcase-installer-options branch from a642278 to 575b454 Compare January 16, 2026 13:17
@lrandersson
Copy link
Contributor Author

@marcoesters I've now rebased this branch, even though this does not connect the UI installer options right now to any sort of "activity" in post_install.bat, I think it can be good to merge it to get some of the UI updates in place.

Copy link
Contributor

@marcoesters marcoesters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a few options are missing:

Var mui_AnaCustomOptions.AddToPath
Var mui_AnaCustomOptions.PostInstall
Var mui_AnaCustomOptions.PreInstall
Var mui_AnaCustomOptions.ClearPkgCache
Var mui_AnaCustomOptions.CreateShortcuts

options = []
register_python = info.get("register_python", True)
if register_python:
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be the Python version of the Python binary used to call constructor. This is not necessarily the same as the one bundled in the installer - in fact, python may not even be in the installer at all. You will have to use _dists in the info dictionary to get the Python version bundled in the installer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking into info["dists"], I found this seemingly old code in winexe.py:

    make_nsi(
        {
            "name": "Maxi",
            "version": "1.2",
            "_platform": "win-64",
            "_outpath": "dummy.exe",
            "_download_dir": "dummy",
            "_dists": ["python-2.7.9-0.tar.bz2", "vs2008_runtime-1.0-1.tar.bz2"],
        },
        ".",
    )

Is it safe to assume that if an installer bundles python, the package is formatted as above? I.e. python-x.y.z-<build number>.tar.bz2?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, package names are formatted as <package name>-<version>-<build string>.<extension>. <build string> is not necessarily a number and <package name> may contain dashes. <extension> is either .tar.bz2 or .conda, but that may change in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 6087f5e

@lrandersson
Copy link
Contributor Author

@marcoesters I've added the remaining options in 6087f5e, I compared it to OptionsDialog.nsh as much as possible and hopefully got it as close to as we have today.

Copy link
Contributor

@marcoesters marcoesters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small comments

Comment on lines +135 to +146
if has_python:
register_python = info.get("register_python", True)
if register_python:
options.append(
{
"name": "register_python",
"title": f"Register {info['name']} as my default Python {python_version}.",
"description": "Allows other programs, such as VSCode, PyCharm, etc. to automatically "
f"detect {info['name']} as the primary Python {python_version} on the system.",
"default": info.get("register_python_default", False),
}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if has_python:
register_python = info.get("register_python", True)
if register_python:
options.append(
{
"name": "register_python",
"title": f"Register {info['name']} as my default Python {python_version}.",
"description": "Allows other programs, such as VSCode, PyCharm, etc. to automatically "
f"detect {info['name']} as the primary Python {python_version} on the system.",
"default": info.get("register_python_default", False),
}
)
if has_python and info.get("register_python", True)
options.append(
{
"name": "register_python",
"title": f"Register {info['name']} as my default Python {python_version}.",
"description": "Allows other programs, such as VSCode, PyCharm, etc. to automatically "
f"detect {info['name']} as the primary Python {python_version} on the system.",
"default": info.get("register_python_default", False),
}
)

script_description = info.get(f"{script_type}_install_desc", "")
script = info.get(f"{script_type}_install", "")
if script_description and not script:
raise ValueError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError(
raise KeyError(

Technically since it is a key in construct.yaml?

raise FileNotFoundError(
f"Specified {script_type}-install script '{script}' does not exist."
)
if not is_bat_file(script_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just check for the suffix here. The only thing is_bat_file does additionally is checking whether the file exists - which you do immediately before this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

3 participants