beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.58k stars 364 forks source link

Update templated content after initial call to create #472

Open johnoscott opened 4 years ago

johnoscott commented 4 years ago

Describe the bug After following the Beeware Tutorial, I decided to build a 2nd MSI Installer for Windows with a bump to the app version to 0.0.2. This created a file : Hello World-0.0.2.msi which I ran (I had already installed the previous Hello World-0.0.1.msi. When I look in the Control Panel\Programs**Programs and Features** I see two instances of the app and both show version 0.0.1

To Reproduce Steps to reproduce the behavior:

  1. On a Windows PC, complete the Beeware Tutorial to the end of Tutorial 3. https://docs.beeware.org/en/latest/tutorial/tutorial-3.html

  2. Run the MSI created at the end of Tutorial 3 to install the application. Hello_World-0.0.1.msi

  3. Proceed with Tutorial 4 which updates the application code.

  4. Bump the project version to 0.0.2 in pyproject.toml

project_name = "Hello World"
bundle = "com.example"
version = "0.0.2"
  1. Build a new MSI installer by running these commands :

    briefcase update
    briefcase package
  2. Run the 2nd MSI created at install the application update. Hello_World-0.0.2.msi

Expected behavior I was expecting the 2nd MSI version to update the already installed version. While it does appear installed app code is updated (C:\Users\User\AppData\Local\Programs\Hello World\app\helloworld\app.py is the latest version), I don't think there should be multiple apps to uninstall in Programs and Features.

Screenshots Attached

Environment:

Screen Shot 2020-08-17 at 6 18 58 pm

Additional context

RKM 2022-12-22: Although this was originally reported as a specific bug with Windows, it's a manifestation of a more generic problem - any content generated from template is locked in stone. We need a generic ability to update templated content after the original template has been generated, without the need to delete and re-generate the project.

freakboy3742 commented 4 years ago

Thanks for the report - that's definitely odd, and definitely a bug.

My guess is that the WiX project template that is used to generate the installer hasn't been updated to reflect the new version number. I suspect that if you were to regenerate the app, rather than updating, you'd get the right version number, and the migration path would be what you expect.

If I'm right, a similar bug will probably exist on every platform, as there is metadata in the generated project files that is derived from pyproject.toml, but only populated when briefcase create is invoked. I'm guessing we'll need to add content to the briefcase.toml file that is associated with the template to declare values that need to be updated, and modify the updated command to populate those values.

freakboy3742 commented 4 years ago

This is also a bug in briefcase, rather than the beeware tutorial; migrating the issue to that repository.

freakboy3742 commented 2 years ago

One approach that might work:

freakboy3742 commented 1 year ago

This has come up again as #1015. As a result, I've renamed the ticket to reflect the generic problem, rather than the specific manifestation of the bug that was originally reported. I've also added the enhancement flag, as there is a generic "quality of life" improvement associated with this idea, in addition to the specific bug that was reported.

freakboy3742 commented 6 days ago

I've had my attention drawn to copier, which is a mostly drop-in replacement for cookiecutter, but one that has support for updating an existing generated project. I haven't done a detailed investigation yet, but this might provide a viable path forward for updating projects after they have been initially generated.