summaryrefslogtreecommitdiffstats
path: root/pym/portage/sets/shell.py
blob: ec34eed75e6f3627918b77bd5fd6ac3898eb92c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

import subprocess, os

from portage.sets import PackageSet

class CommandOutputSet(PackageSet):
	_operations = ["merge", "unmerge"]

	def __init__(self, name, command):
		super(CommandOutputSet, self).__init__(name)
		self._command = command
	
	def load(self):
		pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True)
		if pipe.wait() == os.EX_OK:
			text = pipe.stdout.read()
			self._setNodes(text.split("\n"))