Reticulum/RNS/vendor/platformutils.py

52 lines
1.2 KiB
Python
Raw Permalink Normal View History

2021-12-01 05:39:06 -05:00
def get_platform():
from os import environ
2022-01-12 05:50:03 -05:00
if "ANDROID_ARGUMENT" in environ:
return "android"
elif "ANDROID_ROOT" in environ:
return "android"
2021-12-01 05:39:06 -05:00
else:
import sys
2022-01-12 04:07:44 -05:00
return sys.platform
2022-10-12 10:07:53 -04:00
def is_linux():
if get_platform() == "linux":
return True
else:
return False
2022-01-12 05:50:03 -05:00
def is_darwin():
if get_platform() == "darwin":
return True
else:
return False
def is_android():
if get_platform() == "android":
return True
else:
return False
2022-01-12 05:18:24 -05:00
def is_windows():
if str(get_platform()).startswith("win"):
return True
else:
return False
2022-01-12 04:07:44 -05:00
def platform_checks():
2022-01-12 05:18:24 -05:00
if is_windows():
2022-01-12 04:16:59 -05:00
import sys
2022-01-12 04:07:44 -05:00
if sys.version_info.major >= 3 and sys.version_info.minor >= 8:
pass
else:
2022-01-12 04:16:59 -05:00
import RNS
RNS.log("On Windows, Reticulum requires Python 3.8 or higher.", RNS.LOG_ERROR)
RNS.log("Please update Python to run Reticulum.", RNS.LOG_ERROR)
2022-01-12 05:18:24 -05:00
RNS.panic()
def cryptography_old_api():
import cryptography
if cryptography.__version__ == "2.8":
return True
else:
2022-10-21 19:38:38 -04:00
return False