From 29a700b34a8aa2814b8a29fff18921405078fce5 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 22 Sep 2011 16:16:12 +0200 Subject: [PATCH 1/2] bundlebuilder: add back build_locale functionality to XOPackager SL #3116 Due to the removal of the manifest support we lost as well the part of the code that does build the locale. This patch adds that functionality back. Signed-off-by: Simon Schampijer --- src/sugar/activity/bundlebuilder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index 82632398..e7641bb9 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -163,6 +163,7 @@ class XOPackager(Packager): Packager.__init__(self, builder.config) self.builder = builder + self.builder.build_locale() self.package_path = os.path.join(self.config.dist_dir, self.config.xo_name) From 37568a0a7e06146d1a013aceefd1a9d5264d4e83 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 19 Sep 2011 19:10:30 +0200 Subject: [PATCH 2/2] bundlebuilder: refactor get_files_git to Packager to avoid code duplication Follow up patch for b582736375218e8944b3ce3daac667c7910a7e73 Signed-off-by: Simon Schampijer Reviewed-by: Daniel Drake Acked-by: Sascha Silbe --- src/sugar/activity/bundlebuilder.py | 40 ++++++++++------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index e7641bb9..65105abe 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -156,6 +156,18 @@ class Packager(object): if not os.path.exists(self.config.dist_dir): os.mkdir(self.config.dist_dir) + def get_files_in_git(self): + git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE, + cwd=self.config.source_dir) + stdout, _ = git_ls.communicate() + if git_ls.returncode: + # Fall back to filtered list + return list_files(self.config.source_dir, + IGNORE_DIRS, IGNORE_FILES) + + # pylint: disable=E1103 + return [path.strip() for path in stdout.strip('\n').split('\n')] + class XOPackager(Packager): @@ -171,7 +183,7 @@ class XOPackager(Packager): bundle_zip = zipfile.ZipFile(self.package_path, 'w', zipfile.ZIP_DEFLATED) - for f in self._get_files_in_git(): + for f in self.get_files_in_git(): bundle_zip.write(os.path.join(self.config.source_dir, f), os.path.join(self.config.bundle_root_dir, f)) locale_dir = os.path.join(self.config.source_dir, 'locale') @@ -183,18 +195,6 @@ class XOPackager(Packager): bundle_zip.close() - def _get_files_in_git(self): - git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE, - cwd=self.config.source_dir) - stdout, _ = git_ls.communicate() - if git_ls.returncode: - # Fall back to filtered list - return list_files(self.config.source_dir, - IGNORE_DIRS, IGNORE_FILES) - - # pylint: disable=E1103 - return [path.strip() for path in stdout.strip('\n').split('\n')] - class SourcePackager(Packager): @@ -203,21 +203,9 @@ class SourcePackager(Packager): self.package_path = os.path.join(self.config.dist_dir, self.config.tar_name) - def get_files(self): - git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE, - cwd=self.config.source_dir) - stdout, _ = git_ls.communicate() - if git_ls.returncode: - # Fall back to filtered list - return list_files(self.config.source_dir, - IGNORE_DIRS, IGNORE_FILES) - - # pylint: disable=E1103 - return [path.strip() for path in stdout.strip('\n').split('\n')] - def package(self): tar = tarfile.open(self.package_path, 'w:bz2') - for f in self.get_files(): + for f in self.get_files_in_git(): tar.add(os.path.join(self.config.source_dir, f), os.path.join(self.config.tar_root_dir, f)) tar.close()