[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile


  • To: George Dunlap <George.Dunlap@xxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxx>
  • Date: Mon, 8 Jun 2020 12:16:36 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 08 Jun 2020 11:16:50 +0000
  • Ironport-sdr: 3MoO6lT8qK+E37b6AUehW/KVTtG5FjljyXCcTFex33Gnu1h6nGl2zJ7xwJjWJZN63PcJLbcd7Z sKorSWfwZ0iUVkwikJSb9NkSjROKzAi93SKEZYCgyFKWwUFXwAE3QrX9CpzwSlQFJc+zMc3wGL Goki9x1iudqrfB7NBZveo4wtk9sgrheIFUzm9hGwvrL6gnP3I1Qv8EqSjwratHUa8Bt7S8Xbzc khi8l2seYZJIf8geQmwFMjZj1NEo23tClI1sk5+vBlZ8BqfjZalqF5D+3cJE7F6H+OttywQlqo 9HE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

George Dunlap writes ("Re: [PATCH v2 1/5] libxl: Generate golang bindings in 
libxl Makefile"):
> So as written this turns out not to work correctly:  `gengotypes.py` spits 
> out syntactically valid but unformatted Go code, and then runs `go fmt` on it 
> to get the right style (including tabs, &c).  But the error code of `go fmt` 
> isn’t checked; so on a system without go installed, if the build system 
> decides it needs to re-run `gengotypes.py` for whatever reason, the build 
> succeeds but the tree ends up “dirtied” with an unformatted version fo the 
> generated text.

And `go fmt' overwrites its input file ?

The lost error is due to using `os.system' which does not raise an
exception.  The python 3 docs for `os.system' say
  | The subprocess module provides more powerful facilities for
  | spawning new processes and retrieving their results; using that
  | module is preferable to using this function. See the Replacing
  | Older Functions with the subprocess Module section in the
  | subprocess documentation for some helpful recipes.
And the recipe suggests
  | sts = os.system("mycmd" + " myarg")
  | # becomes
  | sts = call("mycmd" + " myarg", shell=True)
  | Notes:
  | * Calling the program through the shell is usually not required.
    
This is not particularly helpful advice because subprocess.call, like
os.system, does not raise an exception when things go wrong.  But it
does have a "more realistic example" immediately afterwards which does
actually check the error code.

You wanted subprocess.check_call.  IDK which Python versions have
subprocess.check_call.

Ian.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.