Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 657766
Collapse All | Expand All

(-)a/Makefile (-4 / +2 lines)
Lines 20-27 ifneq ($(wildcard config-host.mak),) Link Here
20
all:
20
all:
21
include config-host.mak
21
include config-host.mak
22
22
23
PYTHON_UTF8 = LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON)
24
25
git-submodule-update:
23
git-submodule-update:
26
24
27
.PHONY: git-submodule-update
25
.PHONY: git-submodule-update
Lines 576-582 qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \ Link Here
576
qga/qapi-generated/qga-qapi-doc.texi: \
574
qga/qapi-generated/qga-qapi-doc.texi: \
577
qga/qapi-generated/qapi-gen-timestamp ;
575
qga/qapi-generated/qapi-gen-timestamp ;
578
qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
576
qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
579
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
577
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
580
		-o qga/qapi-generated -p "qga-" $<, \
578
		-o qga/qapi-generated -p "qga-" $<, \
581
		"GEN","$(@:%-timestamp=%)")
579
		"GEN","$(@:%-timestamp=%)")
582
	@>$@
580
	@>$@
Lines 676-682 qapi/qapi-introspect.h qapi/qapi-introspect.c \ Link Here
676
qapi/qapi-doc.texi: \
674
qapi/qapi-doc.texi: \
677
qapi-gen-timestamp ;
675
qapi-gen-timestamp ;
678
qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
676
qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
679
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
677
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
680
		-o "qapi" -b $<, \
678
		-o "qapi" -b $<, \
681
		"GEN","$(@:%-timestamp=%)")
679
		"GEN","$(@:%-timestamp=%)")
682
	@>$@
680
	@>$@
(-)a/scripts/qapi/common.py (-6 / +6 lines)
Lines 261-267 class QAPISchemaParser(object): Link Here
261
        self.fname = fp.name
261
        self.fname = fp.name
262
        previously_included.append(os.path.abspath(fp.name))
262
        previously_included.append(os.path.abspath(fp.name))
263
        self.incl_info = incl_info
263
        self.incl_info = incl_info
264
        self.src = fp.read()
264
        self.src = fp.read().decode("UTF-8")
265
        if self.src == '' or self.src[-1] != '\n':
265
        if self.src == '' or self.src[-1] != '\n':
266
            self.src += '\n'
266
            self.src += '\n'
267
        self.cursor = 0
267
        self.cursor = 0
Lines 343-349 class QAPISchemaParser(object): Link Here
343
            return None
343
            return None
344
344
345
        try:
345
        try:
346
            fobj = open(incl_fname, 'r')
346
            fobj = open(incl_fname, 'rb')
347
        except IOError as e:
347
        except IOError as e:
348
            raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
348
            raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
349
        return QAPISchemaParser(fobj, previously_included, info)
349
        return QAPISchemaParser(fobj, previously_included, info)
Lines 1495-1501 class QAPISchemaEvent(QAPISchemaEntity): Link Here
1495
class QAPISchema(object):
1495
class QAPISchema(object):
1496
    def __init__(self, fname):
1496
    def __init__(self, fname):
1497
        self._fname = fname
1497
        self._fname = fname
1498
        parser = QAPISchemaParser(open(fname, 'r'))
1498
        parser = QAPISchemaParser(open(fname, 'rb'))
1499
        exprs = check_exprs(parser.exprs)
1499
        exprs = check_exprs(parser.exprs)
1500
        self.docs = parser.docs
1500
        self.docs = parser.docs
1501
        self._entity_list = []
1501
        self._entity_list = []
Lines 2009-2022 class QAPIGen(object): Link Here
2009
                if e.errno != errno.EEXIST:
2009
                if e.errno != errno.EEXIST:
2010
                    raise
2010
                    raise
2011
        fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666)
2011
        fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666)
2012
        f = os.fdopen(fd, 'r+')
2012
        f = os.fdopen(fd, 'r+b')
2013
        text = (self._top(fname) + self._preamble + self._body
2013
        text = (self._top(fname) + self._preamble + self._body
2014
                + self._bottom(fname))
2014
                + self._bottom(fname))
2015
        oldtext = f.read(len(text) + 1)
2015
        oldtext = f.read(len(text) + 1).decode("UTF-8")
2016
        if text != oldtext:
2016
        if text != oldtext:
2017
            f.seek(0)
2017
            f.seek(0)
2018
            f.truncate(0)
2018
            f.truncate(0)
2019
            f.write(text)
2019
            f.write(text.encode("UTF-8"))
2020
        f.close()
2020
        f.close()
2021
2021
2022
2022
(-)a/tests/Makefile.include (-3 / +3 lines)
Lines 675-687 tests/test-qapi-events.c tests/test-qapi-events.h \ Link Here
675
tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
675
tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
676
tests/test-qapi-gen-timestamp ;
676
tests/test-qapi-gen-timestamp ;
677
tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
677
tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
678
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
678
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
679
		-o tests -p "test-" $<, \
679
		-o tests -p "test-" $<, \
680
		"GEN","$(@:%-timestamp=%)")
680
		"GEN","$(@:%-timestamp=%)")
681
	@>$@
681
	@>$@
682
682
683
tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
683
tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
684
	$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
684
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
685
		-o tests/qapi-schema -p "doc-good-" $<, \
685
		-o tests/qapi-schema -p "doc-good-" $<, \
686
		"GEN","$@")
686
		"GEN","$@")
687
	@mv tests/qapi-schema/doc-good-qapi-doc.texi $@
687
	@mv tests/qapi-schema/doc-good-qapi-doc.texi $@
Lines 939-945 check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) Link Here
939
.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
939
.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
940
$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
940
$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
941
	$(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \
941
	$(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \
942
		$(PYTHON_UTF8) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \
942
		$(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \
943
		$^ >$*.test.out 2>$*.test.err; \
943
		$^ >$*.test.out 2>$*.test.err; \
944
		echo $$? >$*.test.exit, \
944
		echo $$? >$*.test.exit, \
945
		"TEST","$*.out")
945
		"TEST","$*.out")

Return to bug 657766