Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Update __init__.py #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 42 additions & 10 deletions ubuntutweak/system/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,60 @@
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'
elif codename in ['natty', 'katya']:
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
Expand All @@ -36,6 +64,7 @@ def get_desktop():
'''
return os.getenv('DESKTOP_SESSION')


def get_desktop_fullname():
desktop_dict = {'ubuntu': 'Unity',
'ubuntu-2d': 'Unity 2D',
Expand All @@ -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()
Expand All @@ -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__':
Expand Down