diff options
author | Michael Roth <mdroth@linux.vnet.ibm.com> | 2011-11-29 16:47:48 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-11-30 09:28:32 -0600 |
commit | d8e1f214a0046b85f5297b0396f3678531b8982d (patch) | |
tree | 4a93d88fdfd9693e45cd177ed09418933e1b631d /scripts/qapi.py | |
parent | 85e83264b2acaaeaf737386d693373c39c30cb0d (diff) | |
download | qemu-d8e1f214a0046b85f5297b0396f3678531b8982d.tar.gz qemu-d8e1f214a0046b85f5297b0396f3678531b8982d.tar.bz2 qemu-d8e1f214a0046b85f5297b0396f3678531b8982d.zip |
qapi: fix guardname generation
Fix a bug in handling dotted paths, and exclude directory prefixes
from generated guardnames to avoid odd/pseudo-random guardnames in
generated headers.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r-- | scripts/qapi.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index 52999763ee..6e05469e6d 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -200,6 +200,7 @@ def basename(filename): return filename.split("/")[-1] def guardname(filename): - if filename.startswith('./'): - filename = filename[2:] - return filename.replace("/", "_").replace("-", "_").split(".")[0].upper() + '_H' + guard = basename(filename).rsplit(".", 1)[0] + for substr in [".", " ", "-"]: + guard = guard.replace(substr, "_") + return guard.upper() + '_H' |