summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2014-04-29 12:19:14 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2014-04-29 12:19:14 +0300
commit69345c82d69a8b57026dacc6a71906fc4b56faa0 (patch)
treed149ff10fa3a9576959e39ea79cdd731aa327e3a
parent7d5c2082bb689dccd1dcb9802c7d1b0d8294ea7c (diff)
api_coverage.py: Only consider legacy header files for API comparison
-rwxr-xr-xapi_coverage.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/api_coverage.py b/api_coverage.py
index 4ab90e0..b0105b3 100755
--- a/api_coverage.py
+++ b/api_coverage.py
@@ -85,6 +85,8 @@ def get_capis(inc_path, prefix):
85 85
86 for path, dirs, files in os.walk(inc_path): 86 for path, dirs, files in os.walk(inc_path):
87 for f in files: 87 for f in files:
88 if not f.endswith("legacy.h"):
89 continue
88 open_args = (os.path.join(path, f),) 90 open_args = (os.path.join(path, f),)
89 open_kwargs = dict(mode="r") 91 open_kwargs = dict(mode="r")
90 if sys.version_info[0] > 2: open_kwargs["encoding"] = "UTF-8" 92 if sys.version_info[0] > 2: open_kwargs["encoding"] = "UTF-8"
@@ -106,20 +108,21 @@ def get_pyapis(pxd_path, header_name, prefix):
106 108
107 for path, dirs, files in os.walk(pxd_path): 109 for path, dirs, files in os.walk(pxd_path):
108 for f in files: 110 for f in files:
109 if f.endswith(".pxd"): 111 if not f.endswith(".pxd"):
110 open_args = (os.path.join(path, f),) 112 continue
111 open_kwargs = dict(mode="r") 113 open_args = (os.path.join(path, f),)
112 if sys.version_info[0] > 2: open_kwargs["encoding"] = "UTF-8" 114 open_kwargs = dict(mode="r")
113 115 if sys.version_info[0] > 2: open_kwargs["encoding"] = "UTF-8"
114 with open(*open_args, **open_kwargs) as pxd: 116
115 pyapi = pxd.read() 117 with open(*open_args, **open_kwargs) as pxd:
116 118 pyapi = pxd.read()
117 cdef = re.search(pyapi_pattern1, pyapi) 119
118 if cdef: 120 cdef = re.search(pyapi_pattern1, pyapi)
119 matches = re.finditer(pyapi_pattern2, cdef.group(2)) 121 if cdef:
120 for match in matches: 122 matches = re.finditer(pyapi_pattern2, cdef.group(2))
121 func = match.group(1) 123 for match in matches:
122 pyapis.append(func) 124 func = match.group(1)
125 pyapis.append(func)
123 126
124 return pyapis 127 return pyapis
125 128