Skip to content
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

Update templated content after initial call to create #472

Open
johnoscott opened this issue Aug 17, 2020 · 5 comments
Open

Update templated content after initial call to create #472

johnoscott opened this issue Aug 17, 2020 · 5 comments
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior. enhancement New features, or improvements to existing features. iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support. windows The issue relates to Microsoft Windows support.

Comments

@johnoscott
Copy link

johnoscott commented Aug 17, 2020

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
  1. 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:

  • Operating System: Windows 10 Pro, Version 2004

  • Python version: Python 3.7.7

  • Software versions:

    • Briefcase: 0.3.3
    • Toga: 0.3.0.dev22

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
Copy link
Member

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
Copy link
Member

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

@freakboy3742 freakboy3742 transferred this issue from beeware/beeware Aug 17, 2020
@freakboy3742 freakboy3742 added android The issue relates to Android mobile support. bug A crash or error in behavior. iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support. up-for-grabs windows The issue relates to Microsoft Windows support. labels Aug 17, 2020
@freakboy3742
Copy link
Member

One approach that might work:

  • On update, regenerate the app template into a temporary directory
  • In the briefcase.toml file associated with app templates, include a list of files that will be overwritten on update
  • Copy the list of paths described in briefcase.toml into the app being updated.

@freakboy3742 freakboy3742 changed the title 2 instances of app showing in Windows 10 after bumping app version Update templated content after initial call to create Dec 21, 2022
@freakboy3742 freakboy3742 added the enhancement New features, or improvements to existing features. label Dec 21, 2022
@freakboy3742
Copy link
Member

freakboy3742 commented Dec 21, 2022

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior. enhancement New features, or improvements to existing features. iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support. windows The issue relates to Microsoft Windows support.
Projects
None yet
Development

No branches or pull requests

2 participants