[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH v2 07/17] qapi: qmp-gen.py, use basename of pat
From: |
Michael Roth |
Subject: |
[Qemu-devel] [RFC][PATCH v2 07/17] qapi: qmp-gen.py, use basename of path for guard/core prefix |
Date: |
Mon, 18 Apr 2011 10:02:23 -0500 |
To avoid errors when generating output to a seperate subdirectory, use
only the filename, minus any leading directories, when passing it into
functions to be used as a prefix for header guards, includes, etc.
Also, trim file extensions based on "." seperator instead of assuming a
single-char extension and trimming the last 2 chars
Signed-off-by: Michael Roth <address@hidden>
---
qmp-gen.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/qmp-gen.py b/qmp-gen.py
index 3667ec5..eeef58c 100644
--- a/qmp-gen.py
+++ b/qmp-gen.py
@@ -2047,10 +2047,11 @@ def generate(kind, output):
enum_types = []
event_types = {}
indent_level = 0
+ prefix = output.split("/")[-1].split(".")[0]
- guard = '%s_H' % c_var(output[:-2]).upper()
- core = '%s-core.h' % output[:-2]
- header = '%s.h' % output[:-2]
+ guard = '%s_H' % c_var(prefix).upper()
+ core = '%s-core.h' % prefix
+ header = '%s.h' % prefix
if kind.endswith('body') or kind.endswith('header'):
ret = mcgen('''
@@ -2387,7 +2388,7 @@ void qcfg_options_init(void)
return ret
def main(args):
- if len(args) != 2:
+ if len(args) < 2:
return 1
if not args[0].startswith('--'):
return 1
--
1.7.0.4
- [Qemu-devel] [RFC][PATCH v2 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent), Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 04/17] qapi: fix function name typo in qmp-gen.py, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 09/17] qmp proxy: core code for proxying qmp requests to guest, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 10/17] qmp proxy: add qmp_proxy chardev, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 06/17] qapi: fix memory leak for async marshalling code, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 07/17] qapi: qmp-gen.py, use basename of path for guard/core prefix,
Michael Roth <=
- [Qemu-devel] [RFC][PATCH v2 02/17] json-streamer: add handling for JSON_ERROR token/state, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 01/17] json-lexer: make lexer error-recovery more deterministic, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 05/17] qapi: fix handling for null-return async callbacks, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 03/17] json-parser: add handling for NULL token list, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 08/17] qapi: fix Error usage in qemu-sockets.c, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 12/17] guest agent: worker thread class, Michael Roth, 2011/04/18