tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

check-externs.py (675B)


      1 #!/usr/bin/env python3
      2 
      3 import os
      4 import re
      5 import sys
      6 
      7 srcdir = sys.argv[1]
      8 base_srcdir = sys.argv[2]
      9 builddir = sys.argv[3]
     10 
     11 os.chdir(srcdir)
     12 
     13 HBHEADERS = [os.path.basename(x) for x in os.getenv("HBHEADERS", "").split()] or [
     14    x for x in os.listdir(".") if x.startswith("hb") and x.endswith(".h")
     15 ]
     16 
     17 stat = 0
     18 
     19 print("Checking that all public symbols are exported with HB_EXTERN")
     20 for x in HBHEADERS:
     21    print(f"Checking {x}")
     22    with open(x, "r", encoding="utf-8") as f:
     23        content = f.read()
     24    for s in re.findall(r"\n.+\nhb_.+\n", content):
     25        if not s.startswith("\nHB_EXTERN "):
     26            print("failure on:", s)
     27            stat = 1
     28 
     29 sys.exit(stat)