From 79eaa96bc26064bab321c8cd83953f2f43a98d34 Mon Sep 17 00:00:00 2001 From: Xzenergy Date: Wed, 23 Oct 2024 11:38:07 -0700 Subject: [PATCH] Provide a more extensive default bootstrap #2006 --- pyproject.toml | 3 +++ src/briefcase/bootstraps/empty/__init__.py | 0 src/briefcase/bootstraps/empty/empty.toml | 22 ++++++++++++++++++++ src/briefcase/commands/convert.py | 24 ++++++++++++---------- src/briefcase/commands/new.py | 8 +++++++- 5 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 src/briefcase/bootstraps/empty/__init__.py create mode 100644 src/briefcase/bootstraps/empty/empty.toml diff --git a/pyproject.toml b/pyproject.toml index 002c86fdb..044d33c58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -230,6 +230,9 @@ filterwarnings = [ "error", ] +[tool.briefcase] +bootstraps = ["toga", "empty"] # Add "empty" to the list of bootstraps + # need to ensure build directories aren't excluded from recursion norecursedirs = [] diff --git a/src/briefcase/bootstraps/empty/__init__.py b/src/briefcase/bootstraps/empty/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/briefcase/bootstraps/empty/empty.toml b/src/briefcase/bootstraps/empty/empty.toml new file mode 100644 index 000000000..a95e4d43c --- /dev/null +++ b/src/briefcase/bootstraps/empty/empty.toml @@ -0,0 +1,22 @@ +# Configuration for an empty bootstrap + +# macOS configuration +[macOS] +# Delete the next line to support macOS +supported = false +requires = [ + # Python requirements for macOS +] + +# Linux configuration +[Linux] +system_requires = [ + # System packages needed to run the app on Linux +] +system_runtime_requires = [ + # System runtime packages needed to run the app on Linux +] + +# Windows configuration +[Windows] +# Add any platform-specific configuration here diff --git a/src/briefcase/commands/convert.py b/src/briefcase/commands/convert.py index 5d408a8af..4c80949c7 100644 --- a/src/briefcase/commands/convert.py +++ b/src/briefcase/commands/convert.py @@ -593,17 +593,19 @@ def build_app_context(self, project_overrides): "license": project_license, } - def build_gui_context( - self, - context: dict[str, str], - project_overrides: dict[str, str], - ) -> dict[str, str]: - # We must set the GUI-framework to None here since the convert-command uses the new-command - # template. This template includes dependencies for the GUI-frameworks. However, if a project - # already is set up for a GUI-framework, then those dependencies should already be listed. - # To prevent the same dependency being listed twice (once in the PEP621-section and once in the - # briefcase-section), possibly with different versions, we set the GUI-framework to None here. - return {"gui_framework": "None"} + def build_gui_context(self, app, platform, output_format): + if app.gui_framework == "empty": + #Handle the empty bootstrap option + context = { + "platform": platform, + "output_format": output_format, + #Add any context that is needed for the empty bootstrap + } + else: + #Existing logic for Toga or other frameworks + context = super().build_gui_context(app, platform, output_format) + + return context def merge_or_copy_pyproject(self, briefcase_config_file: Path) -> None: """Merge pyproject.toml file made by the cookiecutter with the one in the diff --git a/src/briefcase/commands/new.py b/src/briefcase/commands/new.py index 4f5ce70d1..d95b9f5e7 100644 --- a/src/briefcase/commands/new.py +++ b/src/briefcase/commands/new.py @@ -583,7 +583,13 @@ def build_app_context(self, project_overrides: dict[str, str]) -> dict[str, str] "url": url, "license": project_license, } - + #Added modify GUI choices + def _gui_bootstrap_choices(self): + return [ + ("toga", "Toga (Recommended)"), + ("empty", "Empty (Barebones configuration)"), # Add this line + ] + def build_gui_context( self, context: dict[str, str],