summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2014-05-17 18:26:24 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2014-05-17 18:26:24 +0300
commit0e7855a2f2dd4cb62d706ef857d836a68691b8a6 (patch)
treeaad2b2f011e73b1249b4f3507e58d079b5395781
parentf54ffc762161b712252b6a0f3a59f92fb01b551b (diff)
api_coverage.py: Nicer output formatting
-rwxr-xr-xapi_coverage.py44
1 files changed, 34 insertions, 10 deletions
diff --git a/api_coverage.py b/api_coverage.py
index 235ad0c..9c713a9 100755
--- a/api_coverage.py
+++ b/api_coverage.py
@@ -90,7 +90,6 @@ if not args.python and not args.c:
90def pkg_config(require, min_vers=None): 90def pkg_config(require, min_vers=None):
91 name = require.capitalize() 91 name = require.capitalize()
92 try: 92 try:
93 sys.stdout.write("Checking for %s: " % (name))
94 ver = subprocess.check_output( 93 ver = subprocess.check_output(
95 ["pkg-config", "--modversion", require] 94 ["pkg-config", "--modversion", require]
96 ).decode("utf-8").strip() 95 ).decode("utf-8").strip()
@@ -101,7 +100,6 @@ def pkg_config(require, min_vers=None):
101 cflags = subprocess.check_output( 100 cflags = subprocess.check_output(
102 ["pkg-config", "--cflags-only-I", require] 101 ["pkg-config", "--cflags-only-I", require]
103 ).decode("utf-8").split() 102 ).decode("utf-8").split()
104 sys.stdout.write("OK, found " + ver + "\n")
105 return cflags 103 return cflags
106 except (OSError, subprocess.CalledProcessError): 104 except (OSError, subprocess.CalledProcessError):
107 raise SystemExit( 105 raise SystemExit(
@@ -196,6 +194,15 @@ def get_pyapis(pxd_path, header_name, prefix):
196 return pyapilns, pyapis 194 return pyapilns, pyapis
197 195
198 196
197rows, columns = os.popen('stty size', 'r').read().split()
198
199print(
200 "{0:=^{columns}}".format(
201 "Python-EFL API coverage report ", columns=columns
202 )
203 )
204print("")
205
199for lib in args.libs: 206for lib in args.libs:
200 207
201 inc_paths = pkg_config(lib, EFL_MIN_VERSION) 208 inc_paths = pkg_config(lib, EFL_MIN_VERSION)
@@ -217,30 +224,47 @@ for lib in args.libs:
217 pyapis = set(py_apis) 224 pyapis = set(py_apis)
218 differences = capis.union(pyapis) - capis.intersection(pyapis) 225 differences = capis.union(pyapis) - capis.intersection(pyapis)
219 226
220 for d in sorted(differences): 227 if args.python:
221 if args.python: 228 s = " %s API missing from Python-EFL " % (lib.capitalize())
229 print(
230 "{0:-^{columns}}".format(
231 s, columns=int(columns)
232 )
233 )
234 for d in sorted(differences):
222 try: 235 try:
223 i = c_apis.index(d) 236 i = c_apis.index(d)
224 line_f, line_n = c_api_line_ns[i] 237 line_f, line_n = c_api_line_ns[i]
225 except ValueError: 238 except ValueError:
226 pass 239 pass
227 else: 240 else:
228 print("{0} line {1}: {2} is missing from Python API".format( 241 print("{0:{third}}{1:5}: {2}".format(
229 line_f, line_n, d 242 line_f, line_n, d, third=int(columns)/3
230 )) 243 ))
231 if args.c: 244
245 print("{0:-<{columns}}".format("", columns=columns))
246 print("")
247
248 if args.c:
249 s = " %s API in Python-EFL but not in C " % (lib.capitalize())
250 print(
251 "{0:-^{columns}}".format(
252 s, columns=int(columns)
253 )
254 )
255 for d in sorted(differences):
232 try: 256 try:
233 i = py_apis.index(d) 257 i = py_apis.index(d)
234 line_f, line_n = py_api_line_ns[i] 258 line_f, line_n = py_api_line_ns[i]
235 except ValueError: 259 except ValueError:
236 pass 260 pass
237 else: 261 else:
238 print("{0} line {1}: {2} is missing from C API".format( 262 print("{0:20}{1:5}: {2}".format(
239 line_f, line_n, d 263 line_f, line_n, d
240 )) 264 ))
241 265
242 if args.python or args.c: 266 print("{0:-<{columns}}".format("", columns=columns))
243 print("\n---") 267 print("")
244 268
245 if args.python: 269 if args.python:
246 print( 270 print(