Indeed a wildcard exception (ie, a mere  `except:`) seems more future proof.


Jose


________________________________
From: Eric Engestrom <eric.engest...@imgtec.com>
Sent: Wednesday, August 2, 2017 14:46
To: Tobias Klausmann
Cc: mesa-dev@lists.freedesktop.org; Emil Velikov; Jose Fonseca
Subject: Re: [Mesa-dev] [PATCH] build: Don't bail on OSError in git_sha1_gen.py

On Wednesday, 2017-08-02 03:05:42 +0200, Tobias Klausmann wrote:
> When building sandboxed, we may encounter additional errors. Ignore the 
> errors,
> as we are in a constrained environment.
>
> This can be observed when building latest git with OBS.
>
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de>

R-b and pushed, thanks.

As I mentioned on IRC, I think we should make this a catch-all `except:`,
as I don't expect there will be any exception where we'll do something
other than `pass` (and we can always special-case it if/when this changes).

Emil, Jose, thoughts?

> ---
>  bin/git_sha1_gen.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
> index 6d13db1e16..fe30084a4f 100755
> --- a/bin/git_sha1_gen.py
> +++ b/bin/git_sha1_gen.py
> @@ -16,5 +16,8 @@ try:
>  except subprocess.CalledProcessError as e:
>      # don't print anything if git fails
>      pass
> +except OSError as eos:
> +    # don't fail on inaccessible files when sandboxed
> +    pass
>  else:
>      sys.stdout.write('#define MESA_GIT_SHA1 "git-%s"\n' % git_sha1.rstrip())
> --
> 2.13.3
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to