本文整理汇总了Python中tracer.resources.system.System.distribution方法的典型用法代码示例。如果您正苦于以下问题:Python System.distribution方法的具体用法?Python System.distribution怎么用?Python System.distribution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracer.resources.system.System
的用法示例。
在下文中一共展示了System.distribution方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
def __init__(self, package_manager, rules, applications, memory=None, hooks_observer=None, erased=False):
if not package_manager:
raise UnsupportedDistribution(System.distribution())
self._PACKAGE_MANAGER = package_manager
self._rules = rules
self._applications = applications
self._memory = memory
self._hooks_observer = hooks_observer
self._erased = erased
示例2: _helper
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
def _helper(app):
if app.type == Applications.TYPES["DAEMON"]:
if System.init_system() == "systemd" and System.distribution() == "arch":
return "systemctl restart {0}".format(app.name)
else:
return "service {0} restart".format(app.name)
elif app.type == Applications.TYPES["STATIC"]:
return _("You will have to reboot your computer")
elif app.type == Applications.TYPES["SESSION"]:
return _("You will have to log out & log in again")
return None
示例3: render_system
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
def render_system(self):
uptime = datetime.now() - datetime.fromtimestamp(System.boot_time())
uptime = str(uptime).split('.')[0]
users = set([user.name for user in psutil.get_users()])
package_managers = System.package_manager().names()
view = SystemView()
view.assign('python', System.python_version())
view.assign('distribution', System.distribution())
view.assign('package_managers', package_managers)
view.assign('init', System.init_system())
view.assign('uptime', uptime)
view.assign('user', System.user())
view.assign('users', users)
view.assign('version', __version__)
view.assign('rules_count', len(Rules.all()))
view.assign('applications_count', len(Applications.all()))
view.render()
示例4: directory
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# Enable importing modules from parent directory (tracer's root directory)
import os
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)
import sys
import platform
import unittest
from tracer.resources.system import System
DISTRO = System.distribution()
示例5: Copyright
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
#-*- coding: utf-8 -*-
# yum.py
# Module to work with YUM package manager class
#
# Copyright (C) 2013 Jakub Kadlčík
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from tracer.resources.system import System
if System.distribution() in ["fedora", "centos"]:
from tracer.packageManagers.rpm import Rpm
class Yum(Rpm):
@property
def history_path(self): return '/var/lib/yum/history/'
示例6: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from tracer.resources.system import System
if System.distribution() in ["fedora", "rhel", "centos", "mageia", "ol"]:
from os import listdir
from .ipackageManager import IPackageManager
from tracer.resources.package import Package
from tracer.resources.collections import PackagesCollection
from tracer.resources.exceptions import LockedDatabase, DatabasePermissions
from tracer.resources.applications import Applications
import sqlite3
import rpm
import os
class Rpm(IPackageManager):
"""
Package manager class - RPM
示例7: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from __future__ import unicode_literals
from tracer.resources.system import System
if System.distribution() == "gentoo":
from .ipackageManager import IPackageManager
from tracer.resources.package import Package
from tracer.resources.collections import PackagesCollection
from gentoolkit.helpers import FileOwner
from tracer.resources.exceptions import DatabasePermissions
from tracer.resources.applications import Applications
import os
import portage
import subprocess
import time
class Portage(IPackageManager):
"""
示例8: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
import os.path
from tracer.resources.system import System
if System.distribution() in ["fedora", "mageia"]:
import subprocess
from tracer.packageManagers.rpm import Rpm
class Dnf(Rpm):
def __init__(self, **kwargs):
super(Dnf, self).__init__(**kwargs)
if os.path.exists('/var/lib/dnf/history.sqlite'):
self.opts['modern_swdb'] = True
@property
def history_path(self):
if self.opts.get('modern_swdb'):
return '/var/lib/dnf/history.sqlite'
示例9: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from tracer.resources.system import System
if System.distribution() in ["arch", "archarm"]:
import bisect
from .ipackageManager import IPackageManager
from tracer.resources.package import Package
from tracer.resources.collections import PackagesCollection
from tracer.resources.applications import Applications
import pyalpm
class Alpm(IPackageManager):
def __init__(self, *args, **kwargs):
self.opts = kwargs
self.handle = pyalpm.Handle('/', '/var/lib/pacman')
self.db = self.handle.get_localdb()
示例10: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from tracer.resources.system import System
if System.distribution() == "debian":
from .ipackageManager import IPackageManager
from tracer.resources.package import Package
from tracer.resources.collections import PackagesCollection
import subprocess
import time
import os
class Dpkg(IPackageManager):
"""
Package manager class - DPKG
"""
# noinspection PyMissingConstructor
示例11: or
# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import distribution [as 别名]
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from __future__ import absolute_import
from tracer.resources.system import System
if System.distribution() in ["arch"]:
import bisect
from .ipackageManager import IPackageManager
from tracer.resources.package import Package
from tracer.resources.collections import PackagesCollection
from tracer.resources.applications import Applications
import pyalpm
class Alpm(IPackageManager):
def __init__(self, *args, **kwargs):
self.opts = kwargs
self.handle = pyalpm.Handle('/', '/var/lib/pacman')
self.db = self.handle.get_localdb()