Commit bc2943d6 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging



Python queue, 2018-02-05

# gpg: Signature made Mon 05 Feb 2018 23:07:57 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request: (21 commits)
  docker: change Fedora images to run with python3
  travis: improve python version test coverage
  ui: update keycodemapdb to get py3 fixes
  input: add missing JIS keys to virtio input
  qemu.py: don't launch again before shutdown()
  qemu.py: cleanup redundant calls in launch()
  qemu.py: use poll() instead of 'returncode'
  qemu.py: always cleanup on shutdown()
  qemu.py: refactor launch()
  qemu.py: better control of created files
  qemu.py: remove unused import
  configure: allow use of python 3
  scripts: ensure signrom treats data as bytes
  qapi: force a UTF-8 locale for running Python
  qapi: ensure stable sort ordering when checking QAPI entities
  qapi: remove '-q' arg to diff when comparing QAPI output
  qapi: Adapt to moved location of 'maketrans' function in py3
  qapi: adapt to moved location of StringIO module in py3
  qapi: Use OrderedDict from standard library if available
  qapi: use items()/values() intead of iteritems()/itervalues()
  ...

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 20e0d439 356dc290
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
sudo: false
language: c
python:
  - "2.4"
  - "2.6"
compiler:
  - gcc
cache: ccache
@@ -115,15 +115,17 @@ matrix:
        - sudo apt-get build-dep -qq qemu
        - wget -O - http://people.linaro.org/~alex.bennee/qemu-submodule-git-seed.tar.xz | tar -xvJ
        - git submodule update --init --recursive
    # Trusty System build with latest stable clang
    # Trusty System build with latest stable clang & python 3.0
    - sudo: required
      addons:
      dist: trusty
      language: generic
      compiler: none
      python:
        - "3.0"
      env:
        - COMPILER_NAME=clang CXX=clang++-3.9 CC=clang-3.9
        - CONFIG="--disable-linux-user --cc=clang-3.9 --cxx=clang++-3.9"
        - CONFIG="--disable-linux-user --cc=clang-3.9 --cxx=clang++-3.9 --python=/usr/bin/python3"
      before_install:
        - wget -nv -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
        - sudo apt-add-repository -y 'deb http://llvm.org/apt/trusty llvm-toolchain-trusty-3.9 main'
@@ -134,15 +136,17 @@ matrix:
        - git submodule update --init --recursive
      before_script:
        - ./configure ${CONFIG} || cat config.log
    # Trusty Linux User build with latest stable clang
    # Trusty Linux User build with latest stable clang & python 3.6
    - sudo: required
      addons:
      dist: trusty
      language: generic
      compiler: none
      python:
        - "3.6"
      env:
        - COMPILER_NAME=clang CXX=clang++-3.9 CC=clang-3.9
        - CONFIG="--disable-system --cc=clang-3.9 --cxx=clang++-3.9"
        - CONFIG="--disable-system --cc=clang-3.9 --cxx=clang++-3.9 --python=/usr/bin/python3"
      before_install:
        - wget -nv -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
        - sudo apt-add-repository -y 'deb http://llvm.org/apt/trusty llvm-toolchain-trusty-3.9 main'
+12 −10
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ ifneq ($(wildcard config-host.mak),)
all:
include config-host.mak

PYTHON_UTF8 = LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON)

git-submodule-update:

.PHONY: git-submodule-update
@@ -487,17 +489,17 @@ qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py

qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
		"GEN","$@")
qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
		"GEN","$@")
qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-commands.py \
		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
		"GEN","$@")

@@ -518,27 +520,27 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \

qapi-types.c qapi-types.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-types.py \
		$(gen-out-type) -o "." -b $<, \
		"GEN","$@")
qapi-visit.c qapi-visit.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-visit.py \
		$(gen-out-type) -o "." -b $<, \
		"GEN","$@")
qapi-event.c qapi-event.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-event.py \
		$(gen-out-type) -o "." $<, \
		"GEN","$@")
qmp-commands.h qmp-marshal.c :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-commands.py \
		$(gen-out-type) -o "." $<, \
		"GEN","$@")
qmp-introspect.h qmp-introspect.c :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-introspect.py \
		$(gen-out-type) -o "." $<, \
		"GEN","$@")

@@ -811,10 +813,10 @@ qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
docs/interop/qemu-qmp-qapi.texi docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)

docs/interop/qemu-qmp-qapi.texi: $(qapi-modules)
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")

docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")

qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
qemu.1: qemu-option-trace.texi
+2 −3
Original line number Diff line number Diff line
@@ -1604,9 +1604,8 @@ fi

# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
  error_exit "Cannot use '$python', Python 2.6 or later is required." \
      "Note that Python 3 or later is not yet supported." \
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
  error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
      "Use --python=/path/to/python to specify a supported Python."
fi

+4 −1
Original line number Diff line number Diff line
@@ -748,6 +748,9 @@
# @ac_bookmarks: since 2.10
# altgr, altgr_r: dropped in 2.10
#
# @muhenkan: since 2.12
# @katakanahiragana: since 2.12
#
# 'sysrq' was mistakenly added to hack around the fact that
# the ps2 driver was not generating correct scancodes sequences
# when 'alt+print' was pressed. This flaw is now fixed and the
@@ -775,7 +778,7 @@
            'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
            'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
            'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
            'ro', 'hiragana', 'henkan', 'yen',
            'ro', 'hiragana', 'henkan', 'yen', 'muhenkan', 'katakanahiragana',
            'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
            'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
            'volumeup', 'volumedown', 'mediaselect',
+26 −17
Original line number Diff line number Diff line
@@ -11,13 +11,21 @@
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.

from __future__ import print_function
import errno
import getopt
import os
import re
import string
import sys
try:
    from collections import OrderedDict
except:
    from ordereddict import OrderedDict
try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

builtin_types = {
    'null':     'QTYPE_QNULL',
@@ -244,7 +252,7 @@ class QAPIDoc(object):
                               "'Returns:' is only valid for commands")

    def check(self):
        bogus = [name for name, section in self.args.iteritems()
        bogus = [name for name, section in self.args.items()
                 if not section.member]
        if bogus:
            raise QAPISemError(
@@ -299,7 +307,7 @@ class QAPISchemaParser(object):
                if not isinstance(pragma, dict):
                    raise QAPISemError(
                        info, "Value of 'pragma' must be a dictionary")
                for name, value in pragma.iteritems():
                for name, value in pragma.items():
                    self._pragma(name, value, info)
            else:
                expr_elem = {'expr': expr,
@@ -1467,7 +1475,7 @@ class QAPISchema(object):
            self._def_exprs()
            self.check()
        except QAPIError as err:
            print >>sys.stderr, err
            print(err, file=sys.stderr)
            exit(1)

    def _def_entity(self, ent):
@@ -1565,7 +1573,7 @@ class QAPISchema(object):

    def _make_members(self, data, info):
        return [self._make_member(key, value, info)
                for (key, value) in data.iteritems()]
                for (key, value) in data.items()]

    def _def_struct_type(self, expr, info, doc):
        name = expr['struct']
@@ -1597,11 +1605,11 @@ class QAPISchema(object):
                name, info, doc, 'base', self._make_members(base, info)))
        if tag_name:
            variants = [self._make_variant(key, value)
                        for (key, value) in data.iteritems()]
                        for (key, value) in data.items()]
            members = []
        else:
            variants = [self._make_simple_variant(key, value, info)
                        for (key, value) in data.iteritems()]
                        for (key, value) in data.items()]
            typ = self._make_implicit_enum_type(name, info,
                                                [v.name for v in variants])
            tag_member = QAPISchemaObjectTypeMember('type', typ, False)
@@ -1616,7 +1624,7 @@ class QAPISchema(object):
        name = expr['alternate']
        data = expr['data']
        variants = [self._make_variant(key, value)
                    for (key, value) in data.iteritems()]
                    for (key, value) in data.items()]
        tag_member = QAPISchemaObjectTypeMember('type', 'QType', False)
        self._def_entity(
            QAPISchemaAlternateType(name, info, doc,
@@ -1670,7 +1678,7 @@ class QAPISchema(object):
                assert False

    def check(self):
        for ent in self._entity_dict.values():
        for (name, ent) in sorted(self._entity_dict.items()):
            ent.check(self)

    def visit(self, visitor):
@@ -1726,6 +1734,9 @@ def c_enum_const(type_name, const_name, prefix=None):
        type_name = prefix
    return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()

if hasattr(str, 'maketrans'):
    c_name_trans = str.maketrans('.-', '__')
else:
    c_name_trans = string.maketrans('.-', '__')


@@ -1931,7 +1942,7 @@ def parse_command_line(extra_options='', extra_long_options=[]):
                                       ['source', 'header', 'prefix=',
                                        'output-dir='] + extra_long_options)
    except getopt.GetoptError as err:
        print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
        print("%s: %s" % (sys.argv[0], str(err)), file=sys.stderr)
        sys.exit(1)

    output_dir = ''
@@ -1945,9 +1956,8 @@ def parse_command_line(extra_options='', extra_long_options=[]):
        if o in ('-p', '--prefix'):
            match = re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', a)
            if match.end() != len(a):
                print >>sys.stderr, \
                    "%s: 'funny character '%s' in argument of --prefix" \
                    % (sys.argv[0], a[match.end()])
                print("%s: 'funny character '%s' in argument of --prefix" \
                      % (sys.argv[0], a[match.end()]), file=sys.stderr)
                sys.exit(1)
            prefix = a
        elif o in ('-o', '--output-dir'):
@@ -1964,7 +1974,7 @@ def parse_command_line(extra_options='', extra_long_options=[]):
        do_h = True

    if len(args) != 1:
        print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0]
        print("%s: need exactly one argument" % sys.argv[0], file=sys.stderr)
        sys.exit(1)
    fname = args[0]

@@ -1992,8 +2002,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file,
        if really:
            return open(name, opt)
        else:
            import StringIO
            return StringIO.StringIO()
            return StringIO()

    fdef = maybe_open(do_c, c_file, 'w')
    fdecl = maybe_open(do_h, h_file, 'w')
Loading