refactor: Enhance Unicode handling in build scripts and rename sync_version function
This commit is contained in:
parent
ff804790e6
commit
aad2e59c1c
2 changed files with 43 additions and 23 deletions
|
|
@ -20,21 +20,28 @@ Usage:
|
|||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
# Fix Unicode output on Windows BEFORE any other imports
|
||||
if sys.platform == "win32":
|
||||
os.environ["PYTHONIOENCODING"] = "utf-8"
|
||||
import io
|
||||
# Reconfigure stdout/stderr for UTF-8 output
|
||||
sys.stdout = io.TextIOWrapper(
|
||||
sys.stdout.buffer, encoding="utf-8", errors="replace"
|
||||
)
|
||||
sys.stderr = io.TextIOWrapper(
|
||||
sys.stderr.buffer, encoding="utf-8", errors="replace"
|
||||
)
|
||||
|
||||
import subprocess
|
||||
import shutil
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
# Import shared version utilities
|
||||
from sync_version import get_current_version, sync_version
|
||||
|
||||
# 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 os
|
||||
os.environ["PYTHONIOENCODING"] = "utf-8"
|
||||
from sync_version import get_current_version, do_sync_version
|
||||
|
||||
|
||||
class WindowsBuilder:
|
||||
|
|
@ -397,7 +404,7 @@ def main() -> int:
|
|||
args = parser.parse_args()
|
||||
|
||||
print("🔄 Syncing version...")
|
||||
sync_version()
|
||||
do_sync_version()
|
||||
|
||||
try:
|
||||
builder = WindowsBuilder(env_file=args.env_file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue