Skip to content

Commit 3b5c239

Browse files
committed
Add get_platform to kivy live
1 parent e778ee9 commit 3b5c239

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/bitmessagekivy/get_platform.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# pylint: disable=no-else-return, too-many-return-statements
2+
3+
"""To check the platform"""
4+
5+
from sys import platform as _sys_platform
6+
from os import environ
7+
8+
9+
def _get_platform():
10+
kivy_build = environ.get("KIVY_BUILD", "")
11+
if kivy_build in {"android", "ios"}:
12+
return kivy_build
13+
elif "P4A_BOOTSTRAP" in environ:
14+
return "android"
15+
elif "ANDROID_ARGUMENT" in environ:
16+
return "android"
17+
elif _sys_platform in ("win32", "cygwin"):
18+
return "win"
19+
elif _sys_platform == "darwin":
20+
return "macosx"
21+
elif _sys_platform.startswith("linux"):
22+
return "linux"
23+
elif _sys_platform.startswith("freebsd"):
24+
return "linux"
25+
return "unknown"
26+
27+
28+
platform = _get_platform()
29+
30+
if platform not in ("android", "unknown"):
31+
environ["KIVY_CAMERA"] = "opencv"

0 commit comments

Comments
 (0)