From ff083176def37d70f153209eb2939631e1887fcd Mon Sep 17 00:00:00 2001 From: Vitalij Date: Tue, 19 Sep 2017 20:56:13 +0300 Subject: [PATCH] Update __init__.py Added new versions of Ubuntu/Mint, added Cinnamon DE, codenames in lowercase (remoded duplicates such as Olivia/olivia). --- ubuntutweak/system/__init__.py | 52 +++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/ubuntutweak/system/__init__.py b/ubuntutweak/system/__init__.py index 96ee5bcc..ee9ef511 100644 --- a/ubuntutweak/system/__init__.py +++ b/ubuntutweak/system/__init__.py @@ -1,18 +1,23 @@ import os import platform +import string + +# string is added for lowercase in get_codename function // Rizado from ubuntutweak.common.consts import APP, PKG_VERSION + def get_distro(): '''It should be "Ubuntu 10.10 maverick"''' return ' '.join(platform.dist()) + def get_codename(): try: - codename = os.popen('lsb_release -cs').read().strip() - if codename in ['karmic', 'helena', 'Helena']: + codename = string.lowercase(os.popen('lsb_release -cs').read().strip()) + if codename in ['karmic', 'helena']: return 'karmic' - elif codename in ['lucid', 'isadora', 'Isadora']: + elif codename in ['lucid', 'isadora']: return 'lucid' elif codename in ['maverick', 'julia']: return 'maverick' @@ -20,13 +25,36 @@ def get_codename(): return 'natty' elif codename in ['oneiric', 'lisa']: return 'oneiric' - elif codename in ['precise', 'maya', 'Maya']: + elif codename in ['precise', 'maya']: return 'precise' + elif codename in ['quantal', 'nadia']: + return 'quantal' + elif codename in ['raring', 'olivia']: + return 'raring' + elif codename in ['saucy', 'petra']: + return 'saucy' + elif codename in ['trusty', 'qiana', 'rebecca', 'rafaela', 'rosa']: + return 'trusty' + elif codename in ['utopic']: + return 'utopic' + elif codename in ['vivid']: + return 'vivid' + elif codename in ['wily']: + return 'wily' + elif codename in ['xenial', 'sarah', 'serena', 'sonya', 'sylvia']: + return 'xenial' + elif codename in ['yakkery']: + return 'yakkery' + elif codename in ['zesty']: + return 'zesty' + elif codename in ['artful']: + return 'artful' return codename except: pass return '' + def get_desktop(): ''' ubuntu @@ -36,6 +64,7 @@ def get_desktop(): ''' return os.getenv('DESKTOP_SESSION') + def get_desktop_fullname(): desktop_dict = {'ubuntu': 'Unity', 'ubuntu-2d': 'Unity 2D', @@ -46,6 +75,7 @@ def get_desktop_fullname(): 'gnome-fallback-compiz': _('GNOME Fallback'), 'pantheon': 'elementary OS (Luna)', 'Lubutu': 'LXDE', + 'cinnamon': 'Cinnamon (Linux Mint)', } desktop = get_desktop() @@ -58,23 +88,25 @@ def get_desktop_fullname(): else: return _('Unknown') + def get_app(): '''Ubuntu Tweak 0.5.x''' return " ".join([APP, PKG_VERSION]) + DISTRO = get_distro() CODENAME = get_codename() DESKTOP = get_desktop() DESKTOP_FULLNAME = get_desktop_fullname() APP = get_app() -UBUNTU_CODENAMES = ('dapper', 'edgy', 'feisty', - 'gutsy', 'hardy', 'intrepid', - 'jaunty', 'karmic', 'lucid', - 'maverick', 'natty', 'oneiric', - 'precise', 'quantal', 'raring', 'saucy') +UBUNTU_CODENAMES = ('dapper', 'edgy', 'feisty', 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', + 'lucid', 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', + 'trusty', 'utopic', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful') + def is_supported(codename=CODENAME): - return codename in ('precise', 'quantal', 'raring', 'saucy', 'trusty') + return codename in ('precise', 'quantal', 'raring', 'saucy', 'trusty', 'utopic', 'vivid', 'wily', + 'xenial', 'yakkety', 'zesty', 'artful') if __name__ == '__main__':