-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added update test * added debug mode * fix update opensuse * minor refactoring
- Loading branch information
Showing
7 changed files
with
121 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
import platform | ||
from distro import name, version, id | ||
|
||
from frameworks.decorators import singleton | ||
import distro | ||
|
||
@singleton | ||
class Unix: | ||
def __init__(self): | ||
self._name = distro.name() | ||
self._version = distro.version() | ||
self._id = distro.id() | ||
self._pretty_name = distro.name(pretty=True) | ||
self._name = None | ||
self._version = None | ||
self._id = None | ||
self._pretty_name = None | ||
|
||
@property | ||
def pretty_name(self): | ||
def pretty_name(self) -> str: | ||
if self._pretty_name is None: | ||
self._pretty_name = name(pretty=True) | ||
return self._pretty_name | ||
|
||
@pretty_name.setter | ||
def pretty_name(self, value): | ||
if value: | ||
self._pretty_name = value | ||
else: | ||
raise print(f"[bold red]|ERROR| Can't get pretty name") | ||
|
||
@property | ||
def id(self): | ||
def id(self) -> str: | ||
if self._id is None: | ||
self._id = id() | ||
return self._id | ||
|
||
@id.setter | ||
def id(self, value): | ||
if value: | ||
self._id = value | ||
else: | ||
raise print(f"[bold red]|ERROR| Can't get distribution id") | ||
|
||
@property | ||
def name(self) -> str: | ||
if self._name is None: | ||
self._name = name() | ||
return self._name | ||
|
||
@property | ||
def version(self) -> str: | ||
if self._version is None: | ||
self._version = version() | ||
return self._version | ||
|
||
@version.setter | ||
def version(self, value: str): | ||
if value: | ||
self._version = value | ||
else: | ||
raise print(f"[bold red]|ERROR| Can't get distribution version") | ||
|
||
@name.setter | ||
def name(self, value: str): | ||
if value: | ||
self._name = value | ||
else: | ||
raise print(f"[bold red]|ERROR| Can't get distribution name") | ||
|
||
@staticmethod | ||
def get_distro_info() -> dict: | ||
return platform.freedesktop_os_release() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.