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


Python System.package_manager方法代码示例

本文整理汇总了Python中tracer.resources.system.System.package_manager方法的典型用法代码示例。如果您正苦于以下问题:Python System.package_manager方法的具体用法?Python System.package_manager怎么用?Python System.package_manager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tracer.resources.system.System的用法示例。


在下文中一共展示了System.package_manager方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_helper

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [as 别名]
	def print_helper(self, app, args):
		if app.instances:
			manager = System.package_manager()
			package = manager.provided_by(app)
			if package:
				package.load_info(System.package_manager())

			tr = Tracer(System.package_manager(), Rules, Applications)
			tr.now = self.args.now
			if self.packages:
				tr.specified_packages = self.packages

			try: affected_by = tr.trace_application(app)
			except AccessDenied: affected_by = _("You don't have enough permissions")
			affects = self._affects(app, affected_by)

			view = HelperView()
			view.assign("args", args)
			view.assign("processes", app.instances)
			view.assign("application", app)
			view.assign("package", package)
			view.assign("affected_by", affected_by)
			view.assign("affects", affects)
			view.render()
		else:
			print(_("Application called {0} is not running").format(app.name))
开发者ID:FrostyX,项目名称:tracer,代码行数:28,代码来源:helper.py

示例2: render_packages

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [as 别名]
	def render_packages(self):
		timestamp = self.args.timestamp[0] if self.args.timestamp[0] else System.boot_time()
		manager = System.package_manager()
		packages = manager.packages_newer_than(timestamp)

		view = PackagesView()
		view.assign('packages', packages)
		view.assign('boot_time', System.boot_time())
		view.render()
开发者ID:Conan-Kudo,项目名称:tracer,代码行数:11,代码来源:resource.py

示例3: __init__

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [as 别名]
	def __init__(self, args, packages):
		self.args = args
		self.tracer = Tracer(
			System.package_manager(erased=args.erased),
			Rules,
			Applications,
			memory=dump_memory,
			hooks_observer=HooksObserver(),
			erased=args.erased
		)
		self.tracer.now = args.now
		self.tracer.timestamp = args.timestamp[0]
		if packages:
			self.tracer.specified_packages = packages

		self.applications = self.tracer.trace_affected(self._user(args.user))
		if self.args.daemons_only:
			self.applications = self.applications.filter_types([Applications.TYPES["DAEMON"]])
开发者ID:FrostyX,项目名称:tracer,代码行数:20,代码来源:default.py

示例4: __init__

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [as 别名]
	def __init__(self, args, call_helper=None):
		#TODO filter blacklisted packages from restart

		tracer = Tracer(
			System.package_manager(erased=args.erased),
			Rules,
			Applications,
			memory=dump_memory,
			erased=args.erased
		)

		daemons = tracer.trace_affected(user="root").filter_types([Applications.TYPES["DAEMON"]])

		if call_helper is None:
			call_helper = RestartController._call_helper
		else:
			call_helper = call_helper
		self.restarted_daemons = RestartController.restart_daemons(daemons, call_helper)
开发者ID:tsujamin,项目名称:tracer,代码行数:20,代码来源:restart.py

示例5: render_system

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [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

示例6: __init__

# 需要导入模块: from tracer.resources.system import System [as 别名]
# 或者: from tracer.resources.system.System import package_manager [as 别名]
	def __init__(self, tracer=Tracer):
		self._tracer = tracer(System.package_manager(), Rules, Applications, dump_memory)
开发者ID:opoplawski,项目名称:tracer,代码行数:4,代码来源:query.py


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