[Sugar-devel] [PATCH sugar-toolkit] Bundlebuilder: don't fail to package if git is not installed, OLPC #11341

Gonzalo Odiard gonzalo at laptop.org
Fri Oct 21 07:40:48 EDT 2011


I think we should fallback to use a manifest file if present.
In particluar, the wikipedia activity can be builded with different data
files,
but the same codebase, and is using a manifest file to select the included
files.
Anyway, is he only case. May be we can implement it in a custom setup.py in
the activity,
but imho would be better if the toolkit resolve it.

Gonzalo

On Fri, Oct 21, 2011 at 7:27 AM, Simon Schampijer <simon at schampijer.de>wrote:

> 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
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111021/5cb2ed30/attachment-0001.html>


More information about the Sugar-devel mailing list