From 34b0e17e951f2e4ae3ec19e52c11d1e7379830bd Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Thu, 7 May 2015 12:28:32 -0300 Subject: [PATCH] Add screenshots to ignored dirs in bundlebuilder After add the directory to the IGNORE_DIRS array, we need make the standard procedure to get the list off files for the bundle, get_files_in_git honor the configured ignored files and dirs. That was not a problem until now, because that files was already not added to git, but in the case of the screenshots, are included in git, but we don't want include them in our bundles. --- src/sugar3/activity/bundlebuilder.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/sugar3/activity/bundlebuilder.py b/src/sugar3/activity/bundlebuilder.py index bfea84e0..98d92199 100644 --- a/src/sugar3/activity/bundlebuilder.py +++ b/src/sugar3/activity/bundlebuilder.py @@ -37,7 +37,7 @@ from sugar3 import env from sugar3.bundle.activitybundle import ActivityBundle -IGNORE_DIRS = ['dist', '.git'] +IGNORE_DIRS = ['dist', '.git', 'screenshots'] IGNORE_FILES = ['.gitignore', 'MANIFEST', '*.pyc', '*~', '*.bak', 'pseudo.po'] @@ -188,7 +188,22 @@ class Packager(object): IGNORE_DIRS, IGNORE_FILES) if stdout: # pylint: disable=E1103 - return [path.strip() for path in stdout.strip('\n').split('\n')] + git_output = [path.strip() for path in + stdout.strip('\n').split('\n')] + files = [] + for line in git_output: + ignore = False + for directory in IGNORE_DIRS: + if line.startswith(directory + '/'): + ignore = True + break + if not ignore: + files.append(line) + + for pattern in IGNORE_FILES: + files = [f for f in files if not fnmatch(f, pattern)] + + return files else: return list_files(self.config.source_dir, IGNORE_DIRS, IGNORE_FILES)