Add get_platform to kivy live
This commit is contained in:
parent
e778ee9231
commit
3b5c239c73
31
src/bitmessagekivy/get_platform.py
Normal file
31
src/bitmessagekivy/get_platform.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# 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"
|
Reference in New Issue
Block a user