cengal.system.versions.v_0.system

  1#!/usr/bin/env python
  2# coding=utf-8
  3
  4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
  5# 
  6# Licensed under the Apache License, Version 2.0 (the "License");
  7# you may not use this file except in compliance with the License.
  8# You may obtain a copy of the License at
  9# 
 10#     http://www.apache.org/licenses/LICENSE-2.0
 11# 
 12# Unless required by applicable law or agreed to in writing, software
 13# distributed under the License is distributed on an "AS IS" BASIS,
 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15# See the License for the specific language governing permissions and
 16# limitations under the License.
 17
 18
 19__all__ = [
 20            'PLATFORM_NAME', 'PYTHON_IMPLEMENTATION', 'PYTHON_VERSION', 'PYTHON_VERSION_STR', 
 21            'PYTHON_VERSION_INT', 'IS_RUNNING_IN_PYCHARM', 'RAW_OS_PLATFORM', 'OS_API_TYPE', 
 22            'OS_TYPE', 'KIVY_PLATFORM', 'KIVY_TARGET_PLATFORM', 'IS_RUNNING_IN_EMSCRIPTEN', 'IS_RUNNING_IN_PYODIDE', 'IS_BUILDING_FOR_PYODIDE', 
 23            'CENGAL_IS_IN_BUILD_MODE', 'TEMPLATE_MODULE_NAME', 'cengal_module_rel_path', 
 24            'cengal_module_import_str', 'current_cengal_module_rel_path', 'current_cengal_module_import_str',
 25            'CENGAL_UNITTESTS_DISCOVER_IS_RUNNING', 'IS_INSIDE_OR_FOR_WEB_BROWSER', 'IS_RUNNING_IN_WASI', 
 26            'CENGAL_VERSION_STR', 'CENGAL_VERSION_MAJOR_STR', 'CENGAL_VERSION_MINOR_STR', 
 27            'CENGAL_VERSION_MICRO_STR', 'CENGAL_VERSION', 'CENGAL_VERSION_MAJOR', 'CENGAL_VERSION_MINOR', 
 28            'CENGAL_VERSION_MICRO',
 29           ]
 30
 31
 32import platform
 33import sys
 34import os
 35from typing import Tuple, Optional
 36
 37
 38"""
 39Module Docstring
 40Docstrings: http://www.python.org/dev/peps/pep-0257/
 41"""
 42
 43__author__ = "ButenkoMS <gtalk@butenkoms.space>"
 44__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
 45__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
 46__license__ = "Apache License, Version 2.0"
 47__version__ = "4.4.1"
 48__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
 49__email__ = "gtalk@butenkoms.space"
 50# __status__ = "Prototype"
 51__status__ = "Development"
 52# __status__ = "Production"
 53
 54
 55PLATFORM_NAME: str = platform.python_implementation()  # TODO: deprecated. Can be 'CPython', 'PyPy', 'IronPython', 'Jython'.
 56PYTHON_IMPLEMENTATION: str = platform.python_implementation()  # can be 'CPython', 'PyPy', 'IronPython', 'Jython'.
 57PYTHON_VERSION: Tuple[str, str, str] = platform.python_version_tuple()  # tuple() of str(); for example: ('3', '5', '1')
 58PYTHON_VERSION_STR: str = '.'.join(PYTHON_VERSION)
 59PYTHON_VERSION_INT: Tuple[int, int, int, str, int] = sys.version_info  # named typle sys.version_info(major=3, minor=7, micro=9, releaselevel='final', serial=0)
 60#   Usage: 
 61#       sys.version_info[0] == 3
 62#       (3,) > sys.version_info  # Is Python 2
 63#       (3, 6) <= sys.version_info  # Is Python 3.6+
 64
 65IS_RUNNING_IN_PYCHARM: bool = "PYCHARM_HOSTED" in os.environ
 66
 67RAW_OS_PLATFORM: str = sys.platform  # 'emscripten', 'wasi', 'darwin', 'win32', 'cygwin', 'linux', 'linux2', 'linux3', 'darwin', 'freebsd8', 'aix', aix5', 'aix7', ...
 68OS_API_TYPE: str = os.name  # The following names have currently been registered: 'posix', 'nt', 'java'. Android and iOS will return 'posix'.
 69OS_TYPE: str = platform.system()  # 'Linux', 'Windows', 'Darwin', 'Java'
 70try:
 71    from kivy.utils import platform as kivy_platform
 72    KIVY_PLATFORM: str = kivy_platform  # 'win', 'linux', 'android', 'macosx', 'ios', 'unknown'
 73except ImportError:
 74    KIVY_PLATFORM = 'unknown'  # 'win', 'linux', 'android', 'macosx', 'ios', 'unknown'
 75
 76KIVY_TARGET_PLATFORM: str = os.environ.get('KIVY_TARGET_PLATFORM', default='unknown')  # It is required for the developer to manually set the 'KIVY_TARGET_PLATFORM' environment variable prior to the build process to ensure accurate platform detection.
 77
 78IS_RUNNING_IN_EMSCRIPTEN: bool = 'emscripten' == sys.platform
 79IS_RUNNING_IN_WASI: bool = 'wasi' == sys.platform
 80IS_RUNNING_IN_PYODIDE: bool = "pyodide" in sys.modules
 81IS_BUILDING_FOR_PYODIDE: bool = "PYODIDE" in os.environ  # for setup.py execution time
 82IS_INSIDE_OR_FOR_WEB_BROWSER: bool = IS_RUNNING_IN_EMSCRIPTEN or IS_RUNNING_IN_WASI or IS_BUILDING_FOR_PYODIDE or IS_RUNNING_IN_PYODIDE
 83
 84CENGAL_IS_IN_BUILD_MODE: bool = ('CENGAL_IS_IN_BUILD_MODE' in os.environ) and ('true' == os.environ['CENGAL_IS_IN_BUILD_MODE'].casefold())
 85
 86TEMPLATE_MODULE_NAME: str = '_template_module'
 87
 88CENGAL_UNITTESTS_DISCOVER_IS_RUNNING: bool = ('CENGAL_UNITTESTS_DISCOVER_IS_RUNNING' in os.environ) and ('true' == os.environ['CENGAL_UNITTESTS_DISCOVER_IS_RUNNING'].casefold())
 89
 90CENGAL_VERSION_STR = __version__
 91CENGAL_VERSION = tuple([int(part) for part in CENGAL_VERSION_STR.split('.')])
 92CENGAL_VERSION_MAJOR = CENGAL_VERSION[0]
 93CENGAL_VERSION_MINOR = CENGAL_VERSION[1]
 94CENGAL_VERSION_MICRO = CENGAL_VERSION[2]
 95CENGAL_VERSION_MAJOR_STR = str(CENGAL_VERSION_MAJOR)
 96CENGAL_VERSION_MINOR_STR = str(CENGAL_VERSION_MINOR)
 97CENGAL_VERSION_MICRO_STR = str(CENGAL_VERSION_MICRO)
 98
 99def cengal_module_rel_path(cengal_module) -> str:
100    from cengal.modules_management.module_rel_path import module_rel_path
101    import cengal
102    return module_rel_path(cengal, cengal_module)
103
104
105def cengal_module_import_str(cengal_module) -> str:
106    from cengal.modules_management.module_rel_path import module_import_str
107    import cengal
108    return module_import_str(cengal, cengal_module)
109
110
111def current_cengal_module_rel_path(depth: Optional[int] = 1) -> str:
112    from cengal.modules_management.module_rel_path import current_module_rel_path
113    import cengal
114    return current_module_rel_path(cengal, depth + 1)
115
116
117def current_cengal_module_import_str(depth: Optional[int] = 1) -> str:
118    from cengal.modules_management.module_rel_path import current_module_import_str
119    import cengal
120    return current_module_import_str(cengal, depth + 1)
PLATFORM_NAME: str = 'CPython'
PYTHON_IMPLEMENTATION: str = 'CPython'
PYTHON_VERSION: Tuple[str, str, str] = ('3', '8', '10')
PYTHON_VERSION_STR: str = '3.8.10'
PYTHON_VERSION_INT: Tuple[int, int, int, str, int] = sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)
IS_RUNNING_IN_PYCHARM: bool = False
RAW_OS_PLATFORM: str = 'linux'
OS_API_TYPE: str = 'posix'
OS_TYPE: str = 'Linux'
KIVY_PLATFORM = 'unknown'
KIVY_TARGET_PLATFORM: str = 'unknown'
IS_RUNNING_IN_EMSCRIPTEN: bool = False
IS_RUNNING_IN_PYODIDE: bool = False
IS_BUILDING_FOR_PYODIDE: bool = False
CENGAL_IS_IN_BUILD_MODE: bool = False
TEMPLATE_MODULE_NAME: str = '_template_module'
def cengal_module_rel_path(cengal_module) -> str:
100def cengal_module_rel_path(cengal_module) -> str:
101    from cengal.modules_management.module_rel_path import module_rel_path
102    import cengal
103    return module_rel_path(cengal, cengal_module)
def cengal_module_import_str(cengal_module) -> str:
106def cengal_module_import_str(cengal_module) -> str:
107    from cengal.modules_management.module_rel_path import module_import_str
108    import cengal
109    return module_import_str(cengal, cengal_module)
def current_cengal_module_rel_path(depth: typing.Union[int, NoneType] = 1) -> str:
112def current_cengal_module_rel_path(depth: Optional[int] = 1) -> str:
113    from cengal.modules_management.module_rel_path import current_module_rel_path
114    import cengal
115    return current_module_rel_path(cengal, depth + 1)
def current_cengal_module_import_str(depth: typing.Union[int, NoneType] = 1) -> str:
118def current_cengal_module_import_str(depth: Optional[int] = 1) -> str:
119    from cengal.modules_management.module_rel_path import current_module_import_str
120    import cengal
121    return current_module_import_str(cengal, depth + 1)
CENGAL_UNITTESTS_DISCOVER_IS_RUNNING: bool = False
IS_INSIDE_OR_FOR_WEB_BROWSER: bool = False
IS_RUNNING_IN_WASI: bool = False
CENGAL_VERSION_STR = '4.4.1'
CENGAL_VERSION_MAJOR_STR = '4'
CENGAL_VERSION_MINOR_STR = '4'
CENGAL_VERSION_MICRO_STR = '1'
CENGAL_VERSION = (4, 4, 1)
CENGAL_VERSION_MAJOR = 4
CENGAL_VERSION_MINOR = 4
CENGAL_VERSION_MICRO = 1