On 02.05.19 16:42, Henning Schild wrote:
Am Thu, 2 May 2019 16:34:35 +0200
schrieb Ralf Ramsauer <[email protected]>:

On 5/2/19 4:14 PM, Henning Schild wrote:
Am Thu, 2 May 2019 12:19:10 +0200
schrieb Ralf Ramsauer <[email protected]>:

Hi,

On 5/2/19 10:31 AM, Henning Schild wrote:
Hi Ralf,

redefining the "Enum" seems not too elegant. Did you look into
ways to use the header from python?

Duplicating things is in deed not the most elegant way, but it's
the way how we handle other magic constants as well.

Didn't yet look at any alternatives.


The "defines" should be really easy to parse without even using a
special python library. The only real problem might be locating
the header, it would need to be installed when running
"installed" or relative when running "local".

We could create a pyjailhouse/pcicaps.py during compilation phase.
Make/sed magic could create the python file from a stub. This is
basically the same how we create generated C headers.

This would a) autocreate the "Enum" and make it easy to maintain
and b) solve the problem when being installed.

What do you think about this?

Not sure the extra make before the first use would be nice or
acceptable. The python code could be generated inside pip, in which
case you want to have a solution for non-pip users.

Maybe we're not talking about the same thing.

I'd simply use a small template for the skeleton of the python file,
use sed and friends to fill its content based on C headers and copy
it over to its final destination (e.g., pyjailhouse/pci_caps.py).

I see, have a generated copy in the tree instead of just shipping the
generator. Reminds me of autotools and make ;).


No, not, please. Do something like asm-defines for python consumption. There is
no issue with pip. Its execution can just depend on that output.

The benefit would be that this may also be used for structures, though the logic
for translating field elements into format strings might be more complex. If
automatic translation does not work, we could at least create a finger print
that the implementations in pyjailhouse need to reproduce in order to confirm
they accounted for an update. And that could be build-time checked.

Jan

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to