def test_distro(): "test to get the information about current distrobution." _info= info.get_distro() if _info[0] not in ('Debian', 'Ubuntu', 'SUSE LINUX', 'openSUSE'): assert 1==0,"the distrobution name\
def main(): uri = "http://download.opensuse.org/distribution/" distro, codename = info.get_distro() comps = ["oss", "non-oss"] for comps in comps: os.system("zypper -n rr lazyscripts-" + comps) os.system("zypper -n ar " + uri + codename + "/repo/" + comps + "/ lazyscripts-" + comps) os.system("zypper -n mr -p 10 lazyscripts-" + comps) os.system("zypper -n refresh")
def get_by_detect(cls, testmode=False): """ get SctipsList instance by detection automatically. @param boolean testmode @return obj ScriptsList """ scripts_repo = get_repo_for_distro(get_distro(), testmode) scripts_repo.rebase() if not scripts_repo: raise "can not get repositry automatically." blob = scripts_repo.get('scripts.list') if not blob: raise "script.list is not exists in %s" % \ scripts_repo.path return cls.from_blob(blob)
def ensure_network (): ''' test availibility of network connection ''' distro, codename = info.get_distro() if detect.test_network () == True: return True; dlg, other_btn = create_network_dialog () ret = dlg.run () use_other = other_btn.get_active () dlg.destroy () if ret != gtk.RESPONSE_OK: return False # update GUI while gtk.events_pending (): gtk.main_iteration () if use_other: os.system('/usr/bin/nm-connection-editor') return detect.test_network () # test again after settings
import locale import time import thread import pygtk pygtk.require('2.0') import gtk, gobject, vte import os, sys import xml.sax from lazyscripts.script import ScriptsList, ScriptSet, ScriptsRunner import lazyscripts.ui.utils from lazyscripts import info from lazyscripts.ui.gui import query_yes_no, show_error from lazyscripts.util import detect distro, codename = info.get_distro() from lazyscripts.util import package_repository from os import path as os_path try: locale.setlocale (locale.LC_ALL, "") except: locale.setlocale (locale.LC_ALL, "en_US.UTF-8") APP_NAME = "lazyscripts" APP_PATH = os.path.abspath (os_path.dirname (__file__) + '/../') LOCALE_DIR = os.path.join (APP_PATH, 'locale') gettext.textdomain(APP_NAME) gettext.bindtextdomain(APP_NAME, LOCALE_DIR)
def test_distro(): "test to get the information about current distrobution." _info= info.get_distro() assert _info == ('Ubuntu','intrepid'), _info
def test_get_repo_from_distro(): _repo = repo.get_repo_for_distro(get_distro(), True) assert 'Repo' == _repo.__class__.__name__, _repo