summaryrefslogtreecommitdiff
path: root/spice_codegen.py
AgeCommit message (Collapse)AuthorFilesLines
2015-07-23codegen: Fix enums.h generation with python3Christophe Fergeau1-2/+2
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.
2015-04-14codegen: Use six.PY3 rather than six.PY2Christophe Fergeau1-3/+3
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.
2015-04-01Make spice_codegen.py work on both Python 2 and 3Alexander Wauck1-3/+7
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>
2014-04-16marshaller: Use #include <> for headers in $srcdir/commonChristophe Fergeau1-2/+2
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.
2013-10-23Be explicit about spice-common licenseJonathon Jongsma1-2/+21
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.
2013-10-23codegen: Add a --generate-wireshark-dissector optionJonathon Jongsma1-32/+65
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.
2012-03-21codegen: include headers locallyMarc-André Lureau1-0/+1
2012-03-21codegen: struct marshallers are not current function helperMarc-André Lureau1-1/+1
This solves the issue of struct_marshallers being included within the current ifdef/endif body, although they are independant functions.
2012-03-20don't #include config.h in generated header filesChristophe Fergeau1-3/+4
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).
2012-03-20python: remove c-ism trailing ;Marc-André Lureau1-2/+2
2012-03-20add comment to beginning of autogenerated filesChristophe Fergeau1-0/+2
2012-03-20add config.h to autogenerated files tooChristophe Fergeau1-0/+4
Modify the python (de)marshaller generator to add #include <config.h> at the beginning of the C files it generates
2012-03-20Make pointers 32bit in new protocol formatAlexander Larsson1-0/+4
2012-03-20Support extra prefix in code generatorsAlexander Larsson1-0/+4
This is require when we add a new spice.proto for the old (major 1) protocol description.
2012-03-20Support creating marshallers that are called indirectlyAlexander Larsson1-2/+5
This is needed if we want to switch marshallers depending on what major version the remote side has.
2012-03-20Allow multiple --include argsAlexander Larsson1-3/+4
2012-03-20Add support for generating message and structure marshallersAlexander Larsson1-1/+35
2012-03-20Add python code to automake systemAlexander Larsson1-0/+165