[virt-tools-list] [virtinst: PATCH] setup.py: Build _config.py if missing

Cole Robinson crobinso at redhat.com
Mon Aug 1 18:15:41 UTC 2011


On 08/01/2011 11:01 AM, Michal Privoznik wrote:
> Commit c81dd1c081a55fa13a54494094f801682191e948 introduced regression.
> When _config.py does not exists, we end up trying to read non-existing
> file and hence exception.
> ---
> I am not signed into list, so please keep me CC'ed.
> 
>  AUTHORS  |    1 +
>  setup.py |    9 ++++++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/AUTHORS b/AUTHORS
> index 3eff259..63dfa3c 100644
> --- a/AUTHORS
> +++ b/AUTHORS
> @@ -51,6 +51,7 @@ Patches also received from
>      Roopa Prabhu <roprabhu-at-cisco-dot-com>
>      Andres Rodriguez <andreserl-at-ubuntu-dot-com>
>      Hajime Taira <htaira-at-redhat-dot-com>
> +    Michal Prívozník <mprivozn-at-redhat-dot-com>
>  
>      ...send patches and get your name here...
>  
> diff --git a/setup.py b/setup.py
> index a690219..5c80b85 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -330,9 +330,12 @@ class mybuild(build):
>          print "RHEL6 defaults       : %s" % bool(self.rhel6defaults)
>  
>          for f in config_files:
> -            origconfig = file(f).read()
> -            if origconfig == config_data:
> -                continue
> +            try:
> +                origconfig = file(f).read()
> +                if origconfig == config_data:
> +                    continue
> +            except IOError:
> +                pass
>  
>              print "Generating %s" % f
>              fd = open(f, "w")

Thanks for the patch. I adjusted it to just use os.path.exists rather than
catch an exception, and pushed upstream:

http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=7a84d5d4efce6bb90a8697c5484c90cebb165a8a

Thanks,
Cole




More information about the virt-tools-list mailing list