-
Notifications
You must be signed in to change notification settings - Fork 175
Initial MSI implementation, based on Briefcase #1084
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
base: briefcase-integration
Are you sure you want to change the base?
Conversation
|
We require contributors to sign our Contributor License Agreement and we don't have one on file for @mhsmith. In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#1222), and ping the bot to refresh the PR. |
|
@conda-bot check |
constructor/briefcase.py
Outdated
| msi_paths = list(dist_dir.glob("*.msi")) | ||
| if len(msi_paths) != 1: | ||
| raise RuntimeError(f"Found {len(msi_paths)} MSI files in {dist_dir}") | ||
| shutil.copy(msi_paths[0], info["_outpath"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a move command instead? In heavy installers and reduced disk storage availability, it might be the difference between success and error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| "enum": [ | ||
| "all", | ||
| "exe", | ||
| "msi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should be applied in _schema.py and then propagated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have an integration test in test_examples.py once the dependencies are ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most integration tests have installer_type: all, which will break if features are missing. I suggest replacing them with installer_type: {{ 'exe' if sys.platform == 'win32' else 'all' for those that fail because of missing features. That will also give us a good idea about when we have feature parity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhsmith just for completeness, I've added (and working on finalizing it) the integration tests in test_examples.py in this branch: https://github.com/lrandersson/constructor/tree/briefcase
I branched from the branch that's in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing instructionsCheck out the following repositories:
Run these commands: The MSI will be generated in the working directory. |
Remaining features required for production use[Moved to #967] |
marcoesters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My biggest change request is to get the dependencies right. Specifically, briefcase is missing from the list. I'm also a little concerned about how tightly this is bound to Python conventions.
| name = info["name"] | ||
| if not name: | ||
| raise ValueError("Name is empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name = info["name"] | |
| if not name: | |
| raise ValueError("Name is empty") | |
| if not (name := info.get("name")): | |
| raise ValueError("Name is empty") |
If we are concerned about empty values, we should use get, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it in mhsmith#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most integration tests have installer_type: all, which will break if features are missing. I suggest replacing them with installer_type: {{ 'exe' if sys.platform == 'win32' else 'all' for those that fail because of missing features. That will also give us a good idea about when we have feature parity.
| if not name: | ||
| raise ValueError("Name is empty") | ||
|
|
||
| # Briefcase requires version numbers to be in the canonical Python format, and some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python is not fully compatible with SemVer, so that could be a pretty significant limitation.
It will at least require a few version changes in our integration test examples:
| version: X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed temporarily in mhsmith#1
| strip_chars = " .-_" | ||
| before = info["version"][:start].strip(strip_chars) | ||
| after = info["version"][end:].strip(strip_chars) | ||
| name = " ".join(s for s in [name, before, after] if s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, for something like Miniconda3-py310_25.9.1-3-Windows-x86_64.msi, we have the following?
name = Miniconda3 py310
version = 25.9.1.3
| # different versions of a product. | ||
| def get_bundle_app_name(info, name): | ||
| # If reverse_domain_identifier is provided, use it as-is, but verify that the last | ||
| # component is a valid Python package name, as Briefcase requires. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since constructor doesn't require Python-based packages, will we run into issues with non-Python namespaces?
| briefcase = Path(sysconfig.get_path("scripts")) / "briefcase.exe" | ||
| logger.info("Building installer") | ||
| run( | ||
| [briefcase, "package"] + (["-v"] if verbose else []), | ||
| cwd=tmp_dir, | ||
| check=True, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two questions here:
- Is it possible to use
briefcaseas an API rather than a CLI? - This looks like Windows - do we need any guards here?
Either way, we should make sure that briefcase.exe exists before calling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added 2) in mhsmith#1, the check for briefcase.exe is also there
| @@ -0,0 +1,9 @@ | |||
| _conda constructor --prefix . --extract-conda-pkgs | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use absolute paths instead of relative paths.
| "jinja2", | ||
| "jsonschema >=4" | ||
| "jsonschema >=4", | ||
| "tomli-w >=1.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only needed for MSI installers, this should probably only be added for Windows - same in the recipe.
This is also missing briefcase as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In mhsmith#1
Description
Initial work towards:
Requires Briefcase to be installed in the environment, including the following updates:
As discussed, this PR is sufficient to build a simple MSI installer (with no install-time options) from the miniconda3 recipe. After the Briefcase updates are merged, I'll post a comment here with instructions on how to do that.
@freakboy3742: FYI
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?