summaryrefslogtreecommitdiff
path: root/portato/backend/flags.py
diff options
context:
space:
mode:
authornecoro <>2007-04-25 23:33:07 +0000
committernecoro <>2007-04-25 23:33:07 +0000
commit08ce2332b85234bcedb9f5ba1d49c4987bea7db3 (patch)
tree283033823aad54488a3037fd5cf41ed2dbf8e84f /portato/backend/flags.py
parenteb2d5a7590bbbe91abe5d8f8a79624d6f756daba (diff)
downloadportato-08ce2332b85234bcedb9f5ba1d49c4987bea7db3.tar.gz
portato-08ce2332b85234bcedb9f5ba1d49c4987bea7db3.tar.bz2
portato-08ce2332b85234bcedb9f5ba1d49c4987bea7db3.zip
now considering non-existing files in /etc/portage
Diffstat (limited to 'portato/backend/flags.py')
-rw-r--r--portato/backend/flags.py7
1 files changed, 5 insertions, 2 deletions
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).