[Sugar-devel] [PATCH sugar-toolkit] Bundlebuilder: don't fail to package if git is not installed, OLPC #11341
Simon Schampijer
simon at schampijer.de
Fri Oct 21 06:27:02 EDT 2011
We need to make sure that we do not fail if git is not
installed and use the same fallback code as if we are
in a directory where no git information is present.
Signed-off-by: Simon Schampijer <simon at laptop.org>
---
src/sugar/activity/bundlebuilder.py | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index e7641bb..96020b9 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -184,8 +184,14 @@ 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)
+ try:
+ git_ls = subprocess.Popen(['git', 'ls-files'],
+ stdout=subprocess.PIPE,
+ cwd=self.config.source_dir)
+ except OSError:
+ # Git not installed. Fall back to filtered list
+ return list_files(self.config.source_dir,
+ IGNORE_DIRS, IGNORE_FILES)
stdout, _ = git_ls.communicate()
if git_ls.returncode:
# Fall back to filtered list
@@ -204,8 +210,14 @@ class SourcePackager(Packager):
self.config.tar_name)
def get_files(self):
- git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE,
- cwd=self.config.source_dir)
+ try:
+ git_ls = subprocess.Popen(['git', 'ls-files'],
+ stdout=subprocess.PIPE,
+ cwd=self.config.source_dir)
+ except OSError:
+ # Git not installed. Fall back to filtered list
+ return list_files(self.config.source_dir,
+ IGNORE_DIRS, IGNORE_FILES)
stdout, _ = git_ls.communicate()
if git_ls.returncode:
# Fall back to filtered list
--
1.7.4.4
More information about the Sugar-devel
mailing list