specs: Port cxx2api script back to Python 2.
Unfortunately pygccxml seems abandoned and was never ported to Python3.
Change-Id: I62bdb49aaace0e003d5b9b840a084ecf630c7020
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/apitrace/+/2224547
Reviewed-by: Po-Hsien Wang <pwang@chromium.org>
Commit-Queue: Robert Tarasov <tutankhamen@chromium.org>
Tested-by: Robert Tarasov <tutankhamen@chromium.org>
diff --git a/specs/scripts/cxx2api.py b/specs/scripts/cxx2api.py
index 8056de4..8fc195c 100755
--- a/specs/scripts/cxx2api.py
+++ b/specs/scripts/cxx2api.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python2
@@ -35,9 +35,9 @@
#
# Usage:
#
-# sudo apt-get install castxml mingw-w64-i686-dev
-# pip install 'pygccxml==1.9.1'
-# python specs/scripts/cxx2api.py -Idxsdk/Include -DD2D_USE_C_DEFINITIONS dcomp.h dcomptypes.h dcompanimation.h
+# sudo apt-get install python2 castxml mingw-w64-i686-dev
+# python2 -m pip install 'pygccxml==1.9.1'
+# python2 specs/scripts/cxx2api.py -Idxsdk/Include -DD2D_USE_C_DEFINITIONS dcomp.h dcomptypes.h dcompanimation.h
#
# See also:
# - http://pygccxml.readthedocs.org/en/develop/index.html
@@ -46,9 +46,10 @@
import os.path
import sys
-import io as StringIO
import subprocess
+from cStringIO import StringIO
+
from pygccxml import utils
from pygccxml import parser
from pygccxml import declarations
@@ -229,9 +230,9 @@
# The current declaration
self.decl = None
- self.interfaces = StringIO.StringIO()
- self.methods = StringIO.StringIO()
- self.functions = StringIO.StringIO()
+ self.interfaces = StringIO()
+ self.methods = StringIO()
+ self.functions = StringIO()
def start(self):
print(copyright.strip())
@@ -385,7 +386,8 @@
["x86_64-w64-mingw32-g++", "-x", "c++", "-E", "-Wp,-v", '-', '-fsyntax-only'],
stdin=open(os.devnull, 'rt'),
stdout=open(os.devnull, 'wt'),
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ universal_newlines=True)
includes.append('/usr/share/castxml/clang/include')
for line in p.stderr:
if line.startswith(' '):
@@ -426,6 +428,8 @@
cxxflags += [
#'-m32',
#'-target', 'x86_64-pc-mingw32',
+
+ '-Wno-pragma-pack',
]
sys.stderr.write('Include path:\n')
@@ -454,7 +458,6 @@
script_dir = os.path.dirname(__file__)
headers = [
- os.path.join(script_dir, '..', '..', 'compat', 'winsdk_compat.h'),
os.path.join(script_dir, 'cxx2api.h'),
]
main_header = args[0]