diff --git a/.env.example b/.env.example index 418a2f1..aa50578 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Application APP_NAME=WebDrop Bridge -APP_VERSION=0.1.0 +APP_VERSION=0.5.0 # Web App WEBAPP_URL=file:///./webapp/index.html diff --git a/build/scripts/build_windows.py b/build/scripts/build_windows.py index 53d56ee..6186032 100644 --- a/build/scripts/build_windows.py +++ b/build/scripts/build_windows.py @@ -28,14 +28,13 @@ from pathlib import Path from datetime import datetime # Import shared version utilities -from version_utils import get_current_version +from sync_version import get_current_version, sync_version -# Fix Unicode output on Windows +# Fix Unicode output on Windows (removed TextIOWrapper due to subprocess conflicts) +# TextIOWrapper causes issues when subprocess tries to write to file descriptors if sys.platform == "win32": - import io - - sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8") - sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8") + import os + os.environ["PYTHONIOENCODING"] = "utf-8" class WindowsBuilder: @@ -116,8 +115,7 @@ class WindowsBuilder: result = subprocess.run( cmd, cwd=str(self.project_root), - encoding="utf-8", - errors="replace", + text=True, env=env ) @@ -205,8 +203,7 @@ class WindowsBuilder: print(f" Compiling WiX source...") result = subprocess.run( candle_cmd, - encoding="utf-8", - errors="replace" + text=True ) if result.returncode != 0: print("❌ WiX compilation failed") @@ -223,8 +220,7 @@ class WindowsBuilder: print(f" Linking MSI installer...") result = subprocess.run( light_cmd, - encoding="utf-8", - errors="replace" + text=True ) if result.returncode != 0: print("❌ MSI linking failed") @@ -330,8 +326,7 @@ class WindowsBuilder: result = subprocess.run( cmd, - encoding="utf-8", - errors="replace" + text=True ) if result.returncode != 0: print("❌ Code signing failed") diff --git a/build/scripts/create_release.ps1 b/build/scripts/create_release.ps1 index 2cec0ab..72cb075 100644 --- a/build/scripts/create_release.ps1 +++ b/build/scripts/create_release.ps1 @@ -25,10 +25,17 @@ param( $ErrorActionPreference = "Stop" +# Get project root (PSScriptRoot is build/scripts, go up to project root with ..\..) +$projectRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") + +# Resolve file paths relative to project root +$ExePath = Join-Path $projectRoot $ExePath +$ChecksumPath = Join-Path $projectRoot $ChecksumPath +$MsiPath = Join-Path $projectRoot $MsiPath + # Function to read version from .env or .env.example function Get-VersionFromEnv { - # PSScriptRoot is build/scripts, go up to project root with ../../ - $projectRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") + # Use already resolved project root # Try .env first (runtime config), then .env.example (template) $envFile = Join-Path $projectRoot ".env" diff --git a/scripts/sync_version.py b/build/scripts/sync_version.py similarity index 96% rename from scripts/sync_version.py rename to build/scripts/sync_version.py index c9c7056..0500497 100644 --- a/scripts/sync_version.py +++ b/build/scripts/sync_version.py @@ -23,9 +23,8 @@ from pathlib import Path # Enable UTF-8 output on Windows if sys.platform == "win32": - import io - sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8") - sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8") + import os + os.environ["PYTHONIOENCODING"] = "utf-8" # Import shared version utilities sys.path.insert(0, str(Path(__file__).parent.parent / "build" / "scripts")) @@ -131,7 +130,7 @@ def update_changelog(version: str) -> None: print(f"✓ Added version header to CHANGELOG.md for {version}") -def main() -> int: +def sync_version() -> int: """Sync version across project. Updates __init__.py (source of truth) and changelog. @@ -176,4 +175,4 @@ def main() -> int: if __name__ == "__main__": - sys.exit(main()) + sys.exit(sync_version())