This repository has been archived on 2024-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-21/src/bitmessagekivy/get_platform.py

32 lines
816 B
Python
Raw Normal View History

2022-02-18 15:04:49 +01:00
# pylint: disable=no-else-return, too-many-return-statements
"""To check the platform"""
from sys import platform as _sys_platform
from os import environ
def _get_platform():
kivy_build = environ.get("KIVY_BUILD", "")
if kivy_build in {"android", "ios"}:
return kivy_build
elif "P4A_BOOTSTRAP" in environ:
return "android"
elif "ANDROID_ARGUMENT" in environ:
return "android"
elif _sys_platform in ("win32", "cygwin"):
return "win"
elif _sys_platform == "darwin":
return "macosx"
elif _sys_platform.startswith("linux"):
return "linux"
elif _sys_platform.startswith("freebsd"):
return "linux"
return "unknown"
platform = _get_platform()
if platform not in ("android", "unknown"):
environ["KIVY_CAMERA"] = "opencv"