changeset 992:86e48d591c7e

use find for locate_files()
author hanwen <hanwen@xs4all.nl>
date Fri, 13 Jan 2006 15:38:50 +0100
parents 141b614913d9
children 674a5f90aada
files specs/context.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/specs/context.py	Fri Jan 13 09:11:53 2006 +0100
+++ b/specs/context.py	Fri Jan 13 15:38:50 2006 +0100
@@ -231,10 +231,9 @@
 		return self.os_interface.dump (self.expand (str, env),
 			     self.expand (name, env), mode=mode)
 	
-	def locate_files (self, name):
-		return [l
-			for l in self.read_pipe ('locate %s' % name).split ('\n')
-			if re.match ("^/usr", l)]
+	def locate_files (self, directory, pattern):
+		command = "cd %(directory)s && find -name '%(pattern)s'" % locals()
+		return self.read_pipe (command).split ('\n')
 
 if __name__=='__main__':
 	class TestBase(Context):