File: init.py

package info (click to toggle)
fs-uae-arcade 3.1.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 24,456 kB
  • sloc: python: 56,011; makefile: 170
file content (50 lines) | stat: -rw-r--r-- 1,188 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
import platform
import fsbc.debug
import fsbc.logging

# import fsbc.unicode
from fsbc.application import Application

init_called = False
unicode_patched = False
logging_enabled = False
exception_handler_enabled = False


def initialize_application(
    name=None,
    version=None,
    patch_unicode=True,
    enable_logging=True,
    enable_exception_handler=True,
):

    global init_called, unicode_patched, logging_enabled, exception_handler_enabled
    init_called = True

    if name and enable_logging:
        fsbc.logging.setup_logging(name + ".log.txt")
        logging_enabled = True

    if name is not None:
        Application.app_name = name
        # print(name)

    if version is not None:
        Application.app_version = version
        # print(version)

    if enable_exception_handler:
        fsbc.debug.enable_exception_handler()
        exception_handler_enabled = True

    if patch_unicode:
        # patch system libraries (and argv) to work better with
        # unicode-enabled programs
        # FIXME: removed for Python 3
        # fsbc.unicode.patch_all()
        unicode_patched = True

    # print(platform.uname())
    # print(sys.argv)