From: Hasan Wan Date: Mon, 27 May 2013 06:37:30 +0000 (+0800) Subject: fix an error when find files X-Git-Tag: 0.14~168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ae7ab6aaa70518c637bf3dae9e07081d5183375;p=services%2Fjenkins-scripts.git fix an error when find files Change-Id: If5ea13ff2b6c1303fb6925c55c4681c4f125b689 Signed-off-by: Hasan Wan --- diff --git a/common/repomaker.py b/common/repomaker.py index 7979e5d..1769caf 100644 --- a/common/repomaker.py +++ b/common/repomaker.py @@ -32,13 +32,10 @@ class RepoMakerError(Exception): # Helper functions def find_files(topdir, prefix='', suffix='.rpm'): """Find files in the tree.""" - for item in os.listdir(topdir): - path = os.path.join(topdir, item) - if os.path.isdir(path): - for fpath in find(path): - yield fpath - elif item.startswith(prefix) and item.endswith(suffix): - yield path + for root, dirs, files in os.walk(topdir): + for item in files: + if item.startswith(prefix) and item.endswith(suffix): + yield os.path.join(root, item) def collect(in_dir): """Collect files, binary archs and destinations.""" @@ -246,4 +243,3 @@ class RepoMaker(object): """Add image configurations.""" for name, content in images: self.images.append((name, content)) -