Skip to content

Commit 49b0fd3

Browse files
authored
Merge pull request #48 from beeware/console-app
Modify stub handling to allow for console and GUI stubs
2 parents a0752e1 + e6b013c commit 49b0fd3

22 files changed

Lines changed: 51 additions & 29 deletions

.github/workflows/update-binary.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ jobs:
5353
# Generate the stub app
5454
cd stub
5555
briefcase build windows visualstudio
56-
echo "Move the binary into the final location"
57-
mv ./build/stub/windows/visualstudio/x64/Release/Stub.exe ./Stub-${{ env.PYTHON_TAG }}.exe
56+
echo "Move the binaries into the final location"
57+
mv ./build/console-stub/windows/visualstudio/x64/Release/console-stub.exe ./Console-Stub-${{ env.PYTHON_TAG }}.exe
58+
mv "./build/gui-stub/windows/visualstudio/x64/Release/GUI stub.exe" ./GUI-Stub-${{ env.PYTHON_TAG }}.exe
5859
5960
- name: Upload Stub Artefact
6061
uses: actions/[email protected]
6162
with:
6263
name: stub-${{ matrix.python-version }}
63-
path: stub/Stub-${{ env.PYTHON_TAG }}.exe
64+
path: stub/*-Stub-${{ env.PYTHON_TAG }}.exe
6465

6566
commit-stubs:
6667
name: Commit Stub Binaries
@@ -75,23 +76,15 @@ jobs:
7576
export BRIEFCASE_VERSION="${TAG%-*}"
7677
export BUILD_NUMBER="${TAG#*-}"
7778
78-
echo "TAG=${TAG}"
79-
echo "PYTHON_TAG=${PYTHON_TAG}"
80-
echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}"
81-
echo "BUILD_NUMBER=${BUILD_NUMBER}"
82-
83-
echo "TAG=${TAG}" >> $GITHUB_ENV
84-
echo "PYTHON_TAG=${PYTHON_TAG}" >> $GITHUB_ENV
85-
echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" >> $GITHUB_ENV
86-
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
79+
echo "TAG=${TAG}" | tee -a $GITHUB_ENV
80+
echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV
81+
echo "BUILD_NUMBER=${BUILD_NUMBER}" | tee -a $GITHUB_ENV
8782
8883
if [ "${BRIEFCASE_VERSION}" == "dev" ]; then
8984
# We're on the development template; push to main
90-
echo "TEMPLATE_BRANCH=main"
91-
echo "TEMPLATE_BRANCH=main" >> $GITHUB_ENV
85+
echo "TEMPLATE_BRANCH=main" | tee -a $GITHUB_ENV
9286
else
93-
echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}"
94-
echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" >> $GITHUB_ENV
87+
echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV
9588
fi
9689
9790
- name: Checkout Template
@@ -108,8 +101,8 @@ jobs:
108101
run: |
109102
git config user.email "[email protected]"
110103
git config user.name "Brutus (robot)"
111-
# Move the binary into it's final location
112-
mv stub/Stub-* "{{ cookiecutter.format }}/src"
104+
# Move the binaries into their final location
105+
mv stub/*-Stub-* "{{ cookiecutter.format }}/src"
113106
git add "{{ cookiecutter.format }}/src"
114107
git commit -m "AUTO: Update app binaries; build ${{ env.TAG }}"
115108
git push origin HEAD:${{ env.TEMPLATE_BRANCH }}

cookiecutter.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
"formal_name": "App Name",
44
"app_name": "{{ cookiecutter.formal_name|lower|replace(' ', '-') }}",
55
"module_name": "{{ cookiecutter.app_name|replace('-', '_') }}",
6+
"bundle": "com.example",
67
"version_triple": "0.0.1",
78
"author": "Example Corporation",
89
"author_email": "[email protected]",
910
"url": "http://example.com",
1011
"description": "Short description of app",
12+
"console_app": false,
1113
"guid": "1409c8f5-c276-4cf3-a2fd-defcbdfef9a2",
1214
"install_scope": "",
1315
"use_full_install_path": true,
1416
"python_version": "3.X.0",
1517
"_extensions": [
16-
"briefcase.integrations.cookiecutter.PythonVersionExtension"
18+
"briefcase.integrations.cookiecutter.PythonVersionExtension",
19+
"briefcase.integrations.cookiecutter.UUIDExtension"
1720
]
1821
}

hooks/post_gen_project.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
BIN_PATH = Path("src")
66

7-
# Move the stub for the Python version into the final location
8-
os.rename(BIN_PATH / 'Stub-{{ cookiecutter.python_version|py_tag }}.exe', BIN_PATH / '{{ cookiecutter.formal_name }}.exe')
7+
# Rename the stub binary we want
8+
STUB_PATH = (
9+
BIN_PATH / '{% if cookiecutter.console_app %}Console{% else %}GUI{% endif %}-Stub-{{ cookiecutter.python_version|py_tag }}.exe'
10+
)
11+
STUB_PATH.rename(BIN_PATH / "Stub.exe")
912

1013
# Delete all remaining stubs
11-
for stub in BIN_PATH.glob("Stub-*.exe"):
14+
for stub in BIN_PATH.glob("*-Stub-*.exe"):
1215
os.unlink(stub)

stub/pyproject.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
project_name = "Stub"
33
bundle = "org.beeware"
44
version = "1.0.0"
5+
license.file = "../LICENSE"
56

6-
[tool.briefcase.app.stub]
7-
formal_name = "Stub"
8-
description = "A stub binary that can be integrated into the Windows app template"
9-
sources = ['src/stub']
7+
[tool.briefcase.app.gui-stub]
8+
formal_name = "GUI Stub"
9+
description = "A stub binary for GUI apps that can be integrated into the Windows app template"
10+
sources = ['src/gui_stub']
11+
12+
[tool.briefcase.app.console-stub]
13+
formal_name = "Console Stub"
14+
description = "A stub binary for console apps that can be integrated into the Windows app template"
15+
sources = ['src/console_stub']
16+
console_app = true

stub/src/gui_stub/__init__.py

Whitespace-only changes.
126 KB
Binary file not shown.
126 KB
Binary file not shown.
127 KB
Binary file not shown.
126 KB
Binary file not shown.

0 commit comments

Comments
 (0)