From 08ce2332b85234bcedb9f5ba1d49c4987bea7db3 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Wed, 25 Apr 2007 23:33:07 +0000 Subject: now considering non-existing files in /etc/portage --- portato/backend/flags.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'portato/backend/flags.py') diff --git a/portato/backend/flags.py b/portato/backend/flags.py index d43f567..9cd061a 100644 --- a/portato/backend/flags.py +++ b/portato/backend/flags.py @@ -95,8 +95,11 @@ def grep (pkg, path): if not isinstance(pkg, package.Package): pkg = system.new_package(pkg) # assume it is a cpv or a gentoolkit.Package - command = "egrep -x -n -r -H '^[<>!=~]{0,2}%s(-[0-9].*)?[[:space:]]?.*$' %s" # %s is replaced in the next line ;) - return Popen((command % (pkg.get_cp(), path)), shell = True, stdout = PIPE).communicate()[0].splitlines() + if os.path.exists(path): + command = "egrep -x -n -r -H '^[<>!=~]{0,2}%s(-[0-9].*)?[[:space:]]?.*$' %s" # %s is replaced in the next line ;) + return Popen((command % (pkg.get_cp(), path)), shell = True, stdout = PIPE).communicate()[0].splitlines() + else: + return [] def get_data(pkg, path): """This splits up the data of L{grep} and builds tuples in the format (file,line,criterion,list_of_flags). -- cgit v1.2.3-54-g00ecf