Add Raspberry Pi recognition to `utils.get_named_platform`. thx to @CakesTwix

pull/1/head
Hikari 2022-04-11 13:21:29 +00:00
parent eea3d2f3e5
commit e6336679d7
No known key found for this signature in database
GPG Key ID: 5FA52ACBB2AD964D
1 changed files with 6 additions and 0 deletions

View File

@ -490,7 +490,13 @@ def chunks(_list: Union[list, tuple, set], n: int, /) -> list:
def get_named_platform() -> str:
"""Returns formatted platform name"""
if os.path.isfile('/proc/device-tree/model'):
with open('/proc/device-tree/model') as f:
model = f.read()
return f"🍇 {model}" if model.startswith("Raspberry") else f"{model}"
is_termux = bool(os.popen('echo $PREFIX | grep -o "com.termux"').read())
is_okteto = "OKTETO" in os.environ
is_lavhost = "LAVHOST" in os.environ