From 0beaaaf4b107cf9b6560a338fcce5756307fb579 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 30 Nov 2025 23:25:54 -0600 Subject: [PATCH] Add cx_setup.py for building the ReticulumMeshChatX application - Introduced a new setup script using cx_Freeze to facilitate building the application. - Updated version.py to maintain consistency in version string formatting. - Modified build-backend.js to use poetry for executing the build process. --- cx_setup.py | 48 ++++++++++++++++++++++++++++++++++++++++ meshchatx/src/version.py | 5 +++-- scripts/build-backend.js | 10 +-------- 3 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 cx_setup.py diff --git a/cx_setup.py b/cx_setup.py new file mode 100644 index 0000000..de85be7 --- /dev/null +++ b/cx_setup.py @@ -0,0 +1,48 @@ +from pathlib import Path + +from cx_Freeze import Executable, setup + +from meshchatx.src.version import __version__ + +ROOT = Path(__file__).resolve().parent +PUBLIC_DIR = ROOT / "meshchatx" / "public" + +include_files = [ + (str(PUBLIC_DIR), "public"), + ("logo", "logo"), +] + +setup( + name="ReticulumMeshChatX", + version=__version__, + description="A simple mesh network communications app powered by the Reticulum Network Stack", + executables=[ + Executable( + script="meshchatx/meshchat.py", + base=None, + target_name="ReticulumMeshChatX", + shortcut_name="ReticulumMeshChatX", + shortcut_dir="ProgramMenuFolder", + icon="logo/icon.ico", + ), + ], + options={ + "build_exe": { + "packages": [ + "RNS", + "RNS.Interfaces", + "LXMF", + ], + "include_files": include_files, + "excludes": [ + "PIL", + ], + "optimize": 2, + "build_exe": "build/exe", + "replace_paths": [ + ("*", ""), + ], + }, + }, +) + diff --git a/meshchatx/src/version.py b/meshchatx/src/version.py index 300e9ad..b63d68e 100644 --- a/meshchatx/src/version.py +++ b/meshchatx/src/version.py @@ -1,5 +1,6 @@ -"""Auto-generated helper so Python tooling and the Electron build +""" +Auto-generated helper so Python tooling and the Electron build share the same version string. """ -__version__ = "2.41.0" +__version__ = '2.41.0' diff --git a/scripts/build-backend.js b/scripts/build-backend.js index c4a28bd..b2a448d 100755 --- a/scripts/build-backend.js +++ b/scripts/build-backend.js @@ -1,16 +1,8 @@ #!/usr/bin/env node const { execSync } = require('child_process'); -const path = require('path'); -const os = require('os'); - -const platform = os.platform(); -const venvPython = platform === 'win32' - ? path.join('venv', 'Scripts', 'python.exe') - : path.join('venv', 'bin', 'python'); - try { - execSync(`${venvPython} setup.py build`, { stdio: 'inherit' }); + execSync(`poetry run python cx_setup.py build`, { stdio: 'inherit' }); } catch (error) { console.error('Build failed:', error.message); process.exit(1);