当前位置: 首页>>代码示例>>Python>>正文


Python System.distribution方法代码示例

本文整理汇总了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
开发者ID:FrostyX,项目名称:tracer,代码行数:12,代码来源:tracer.py

示例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
开发者ID:Conan-Kudo,项目名称:tracer,代码行数:16,代码来源:applications.py

示例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()
开发者ID:tsujamin,项目名称:tracer,代码行数:21,代码来源:resource.py

示例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()
开发者ID:FrostyX,项目名称:tracer,代码行数:13,代码来源:__meta__.py

示例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/'
开发者ID:tsujamin,项目名称:tracer,代码行数:32,代码来源:yum.py

示例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
开发者ID:FrostyX,项目名称:tracer,代码行数:33,代码来源:rpm.py

示例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):

		"""
开发者ID:FrostyX,项目名称:tracer,代码行数:33,代码来源:portage.py

示例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'
开发者ID:FrostyX,项目名称:tracer,代码行数:33,代码来源:dnf.py

示例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()
开发者ID:Conan-Kudo,项目名称:tracer,代码行数:32,代码来源:alpm.py

示例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
开发者ID:FrostyX,项目名称:tracer,代码行数:33,代码来源:dpkg.py

示例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()
开发者ID:opoplawski,项目名称:tracer,代码行数:32,代码来源:alpm.py


注:本文中的tracer.resources.system.System.distribution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。