diff --git a/.github/workflows/update-binary.yml b/.github/workflows/update-binary.yml index f8d39a6..413ed01 100644 --- a/.github/workflows/update-binary.yml +++ b/.github/workflows/update-binary.yml @@ -53,14 +53,15 @@ jobs: # Generate the stub app cd stub briefcase build windows visualstudio - echo "Move the binary into the final location" - mv ./build/stub/windows/visualstudio/x64/Release/Stub.exe ./Stub-${{ env.PYTHON_TAG }}.exe + echo "Move the binaries into the final location" + mv ./build/console-stub/windows/visualstudio/x64/Release/console-stub.exe ./Console-Stub-${{ env.PYTHON_TAG }}.exe + mv "./build/gui-stub/windows/visualstudio/x64/Release/GUI stub.exe" ./GUI-Stub-${{ env.PYTHON_TAG }}.exe - name: Upload Stub Artefact uses: actions/upload-artifact@v4.3.3 with: name: stub-${{ matrix.python-version }} - path: stub/Stub-${{ env.PYTHON_TAG }}.exe + path: stub/*-Stub-${{ env.PYTHON_TAG }}.exe commit-stubs: name: Commit Stub Binaries @@ -75,23 +76,15 @@ jobs: export BRIEFCASE_VERSION="${TAG%-*}" export BUILD_NUMBER="${TAG#*-}" - echo "TAG=${TAG}" - echo "PYTHON_TAG=${PYTHON_TAG}" - echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" - echo "BUILD_NUMBER=${BUILD_NUMBER}" - - echo "TAG=${TAG}" >> $GITHUB_ENV - echo "PYTHON_TAG=${PYTHON_TAG}" >> $GITHUB_ENV - echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" >> $GITHUB_ENV - echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV + echo "TAG=${TAG}" | tee -a $GITHUB_ENV + echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV + echo "BUILD_NUMBER=${BUILD_NUMBER}" | tee -a $GITHUB_ENV if [ "${BRIEFCASE_VERSION}" == "dev" ]; then # We're on the development template; push to main - echo "TEMPLATE_BRANCH=main" - echo "TEMPLATE_BRANCH=main" >> $GITHUB_ENV + echo "TEMPLATE_BRANCH=main" | tee -a $GITHUB_ENV else - echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" - echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" >> $GITHUB_ENV + echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV fi - name: Checkout Template @@ -108,8 +101,8 @@ jobs: run: | git config user.email "brutus@beeware.org" git config user.name "Brutus (robot)" - # Move the binary into it's final location - mv stub/Stub-* "{{ cookiecutter.format }}/src" + # Move the binaries into their final location + mv stub/*-Stub-* "{{ cookiecutter.format }}/src" git add "{{ cookiecutter.format }}/src" git commit -m "AUTO: Update app binaries; build ${{ env.TAG }}" git push origin HEAD:${{ env.TEMPLATE_BRANCH }} diff --git a/cookiecutter.json b/cookiecutter.json index 8ead337..97e93d8 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -8,6 +8,7 @@ "author_email": "contact@example.com", "url": "http://example.com", "description": "Short description of app", + "console_app": false, "guid": "1409c8f5-c276-4cf3-a2fd-defcbdfef9a2", "install_scope": "", "use_full_install_path": true, diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index a6154af..850c639 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -4,9 +4,12 @@ BIN_PATH = Path("src") -# Move the stub for the Python version into the final location -os.rename(BIN_PATH / 'Stub-{{ cookiecutter.python_version|py_tag }}.exe', BIN_PATH / '{{ cookiecutter.formal_name }}.exe') +# Rename the stub binary we want +STUB_PATH = ( + BIN_PATH / '{% if cookiecutter.console_app %}Console{% else %}GUI{% endif %}-Stub-{{ cookiecutter.python_version|py_tag }}.exe' +) +STUB_PATH.rename(BIN_PATH / "Stub.exe") # Delete all remaining stubs -for stub in BIN_PATH.glob("Stub-*.exe"): +for stub in BIN_PATH.glob("*-Stub-*.exe"): os.unlink(stub) diff --git a/stub/pyproject.toml b/stub/pyproject.toml index 93e4ec4..3c874ea 100644 --- a/stub/pyproject.toml +++ b/stub/pyproject.toml @@ -3,7 +3,15 @@ project_name = "Stub" bundle = "org.beeware" version = "1.0.0" -[tool.briefcase.app.stub] -formal_name = "Stub" -description = "A stub binary that can be integrated into the Windows app template" -sources = ['src/stub'] +template_branch = "console-app" + +[tool.briefcase.app.gui-stub] +formal_name = "GUI Stub" +description = "A stub binary for GUI apps that can be integrated into the Windows app template" +sources = ['src/gui_stub'] + +[tool.briefcase.app.console-stub] +formal_name = "Console Stub" +description = "A stub binary for console apps that can be integrated into the Windows app template" +sources = ['src/console_stub'] +console_app = true diff --git a/stub/src/stub/__init__.py b/stub/src/console_stub/__init__.py similarity index 100% rename from stub/src/stub/__init__.py rename to stub/src/console_stub/__init__.py diff --git a/stub/src/gui_stub/__init__.py b/stub/src/gui_stub/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/{{ cookiecutter.format }}/src/Stub-3.10.exe b/{{ cookiecutter.format }}/src/Stub-3.10.exe deleted file mode 100644 index ff4f650..0000000 Binary files a/{{ cookiecutter.format }}/src/Stub-3.10.exe and /dev/null differ diff --git a/{{ cookiecutter.format }}/src/Stub-3.11.exe b/{{ cookiecutter.format }}/src/Stub-3.11.exe deleted file mode 100644 index 93a1669..0000000 Binary files a/{{ cookiecutter.format }}/src/Stub-3.11.exe and /dev/null differ diff --git a/{{ cookiecutter.format }}/src/Stub-3.12.exe b/{{ cookiecutter.format }}/src/Stub-3.12.exe deleted file mode 100644 index bee5881..0000000 Binary files a/{{ cookiecutter.format }}/src/Stub-3.12.exe and /dev/null differ diff --git a/{{ cookiecutter.format }}/src/Stub-3.8.exe b/{{ cookiecutter.format }}/src/Stub-3.8.exe deleted file mode 100644 index 13e62c7..0000000 Binary files a/{{ cookiecutter.format }}/src/Stub-3.8.exe and /dev/null differ diff --git a/{{ cookiecutter.format }}/src/Stub-3.9.exe b/{{ cookiecutter.format }}/src/Stub-3.9.exe deleted file mode 100644 index 44b0749..0000000 Binary files a/{{ cookiecutter.format }}/src/Stub-3.9.exe and /dev/null differ