# -----------------------------------------------------------------------------
# Copyright (C) 2026 Iliyas Jorio.
# This file is part of GitFourchette, distributed under the GNU GPL v3.
# For full terms, see the included LICENSE file.
# -----------------------------------------------------------------------------

import sys as _sys
import os as _os


def _envBool(key: str) -> bool:
    return _os.environ.get(key, "") not in ["", "0"]


APP_VERSION = "1.9.1"
APP_SYSTEM_NAME = "gitfourchette"
APP_DISPLAY_NAME = "GitFourchette"
APP_URL_SCHEME = APP_SYSTEM_NAME
APP_IDENTIFIER = "org.gitfourchette.gitfourchette"

# -----------------------------------------------------------------------------
# BEGIN_FREEZE_CONSTS
####################################
# Do not commit these changes!
####################################

APP_FREEZE_COMMIT = "e3962f3608d09da8d5bf59819d91e00ad6a132eb"
APP_FREEZE_DATE = "2026-07-14 20:04"
APP_FREEZE_QT = "pyqt6"
# END_FREEZE_CONSTS
# -----------------------------------------------------------------------------

APP_TESTMODE = _envBool("APP_TESTMODE") or "pytest" in _sys.modules
"""
Unit testing mode (don't touch real user prefs, etc.).
Can be forced with environment variable APP_TESTMODE.
"""

APP_DEBUG = APP_TESTMODE or _envBool("APP_DEBUG")
"""
Enable expensive assertions and debugging features.
Can be forced with environment variable APP_DEBUG.
Implied by APP_TESTMODE.
"""

APP_NOTHREADS = APP_TESTMODE or _envBool("APP_NOTHREADS")
"""
Disable multithreading (run all tasks on UI thread).
Can be forced with environment variable APP_NOTHREADS.
Implied by APP_TESTMODE.
"""

APP_VERBOSEDEL = _envBool("APP_VERBOSEDEL")
"""
Verbose QObject Python destructors (__del__).
"""

if APP_TESTMODE:
    APP_SYSTEM_NAME += "testmode"
    APP_DISPLAY_NAME += "TestMode"
