Age | Commit message (Collapse) | Author | Files | Lines |
|
Trying to generate enums.h with python3 results in
Traceback (most recent call last):
File "./spice_codegen.py", line 217, in <module>
write_enums(writer, options.generate_dissector)
File "./spice_codegen.py", line 99, in write_enums
write_channel_enums(writer, c, False, False)
File "./spice_codegen.py", line 17, in write_channel_enums
if len(messages) == 0:
TypeError: object of type 'filter' has no len()
filter() returns an enumerator object in python3 while it used to return
a list in python2. Using list(filter()) instead fixes that error.
I've checked that the generated enums.h is identical with python2 and
python3.
|
|
Older versions of python-six (at least 1.3.0) defined six.PY3 but not
six.PY2. six.PY2 is only used twice in straightforward tests so it's
easy to use six.PY3 instead.
|
|
This is a new version of my previous patch that does not include six.py.
It's still kind of big, but at least it's all spice-common changes now.
There are also a few other fixes that Christophe brought to my attention.
Note that six now needs to be installed on the system (python-six on
Fedora and Debian, six on PyPI).
This *should* be enough to make spice_codegen.py work on both Python 2
and Python 3. The major changes are as follows:
* cStringIO.StringIO -> io.StringIO
* str vs. unicode updates (io.StringIO doesn't like str)
* integer division
* foo.has_key(bar) -> bar in foo
* import internal_thing -> from . import internal_thing
* removed from __future__ import with_statement
(might break Python 2.5?)
* changed some lambdas to list comprehensions (done by 2to3)
* cast some_dict.keys() to list where needed (e.g. for sorting)
* use normal type names with isinstance instead of types.WhateverType
Signed-off-by: Alexander Wauck <awauck@codeweavers.com>
|
|
Since the (de)marshallers are now generated in $builddir and not in
$srcdir, when these generated files include a file located in
$srcdir/common, the compiler will find them thanks to a -I directive, so it
makes more sense to use <> rather than "" when including them.
|
|
Use same license as spice-gtk and spice modules (LGPL 2.1) since those licenses
applied to the spice-common submodule in the past. This makes it more clear
that if you use spice-common separately, the license is still LGPL. Also
mention license and copyright in generated files.
|
|
The wireshark protocol dissector is a bit out-of-date. Several new channel types
and enums have been added. It would be nice if these values (and the
translation between the value and the name) could be automatically generated so
that updating the dissector was a slightly less manual process. This patch adds
a commandline switch which generates both the enums and value-name lists in the
format that wireshark expects.
|
|
|
|
This solves the issue of struct_marshallers being included within the
current ifdef/endif body, although they are independant functions.
|
|
7e30572ab adds a #include <config.h> to the beginning of generated
files. It also does this for generated headers and enums files,
which is not wanted, especially if it's an installed file. This
commit only adds this include for the non-header non-enum case
(hopefully, enums are only generated for use in a .h file).
|
|
|
|
|
|
Modify the python (de)marshaller generator to add #include
<config.h> at the beginning of the C files it generates
|
|
|
|
This is require when we add a new spice.proto for the old (major 1)
protocol description.
|
|
This is needed if we want to switch marshallers depending on what
major version the remote side has.
|
|
|
|
|
|
|