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.
This commit is contained in:
Gonzalo Odiard 2015-05-07 12:28:32 -03:00 committed by Sam Parkinson
parent 862176de38
commit 34b0e17e95

View File

@ -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)