mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
[check-*.py] Remove autotoolism
Instead of passing source dir and build dir to as envvars, pass them directly as script arguments. The scripts also were supposed to be able to run outsize of the build scripts, but this was broken since the fallback when the envvars were not set was wrong. The HBSOURCES and HBHEADERS are still passed as envvars since they are long lists and might hit command line length limitation on some systems.
This commit is contained in:
1 parent
a5d4e7ba0d
commit
77c24e8a0e
8 files changed
+42
-20
No files matched your search
@@ -3,8 +3,9 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
srcdir = os.getenv("srcdir", os.path.dirname(__file__))
|
||||
base_srcdir = os.getenv("base_srcdir", srcdir)
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
os.chdir(srcdir)
|
||||
|
||||
@@ -24,6 +25,7 @@ HBSOURCES = [removeprefix(x) for x in os.getenv("HBSOURCES", "").split()] or [
|
||||
stat = 0
|
||||
|
||||
for x in HBHEADERS:
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
if ("HB_BEGIN_DECLS" not in content) or ("HB_END_DECLS" not in content):
|
||||
@@ -34,6 +36,7 @@ for x in HBHEADERS:
|
||||
stat = 1
|
||||
|
||||
for x in HBSOURCES:
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
if ("HB_BEGIN_DECLS" in content) or ("HB_END_DECLS" in content):
|
||||
|
||||
@@ -4,7 +4,11 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
os.chdir(os.getenv("srcdir", os.path.dirname(__file__)))
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
os.chdir(srcdir)
|
||||
|
||||
HBHEADERS = [os.path.basename(x) for x in os.getenv("HBHEADERS", "").split()] or [
|
||||
x for x in os.listdir(".") if x.startswith("hb") and x.endswith(".h")
|
||||
@@ -14,6 +18,7 @@ stat = 0
|
||||
|
||||
print("Checking that all public symbols are exported with HB_EXTERN")
|
||||
for x in HBHEADERS:
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
for s in re.findall(r"\n.+\nhb_.+\n", content):
|
||||
|
||||
@@ -4,8 +4,9 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
srcdir = os.getenv("srcdir", os.path.dirname(__file__))
|
||||
base_srcdir = os.getenv("base_srcdir", srcdir)
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
os.chdir(srcdir)
|
||||
|
||||
@@ -28,6 +29,7 @@ stat = 0
|
||||
for x in HBHEADERS + HBSOURCES:
|
||||
if not x.endswith("h") or x == "hb-gobject-structs.h":
|
||||
continue
|
||||
print(f"Checking {x}")
|
||||
tag = (
|
||||
x.upper()
|
||||
.replace(".", "_")
|
||||
|
||||
@@ -4,8 +4,9 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
srcdir = os.getenv("srcdir", os.path.dirname(__file__))
|
||||
base_srcdir = os.getenv("base_srcdir", srcdir)
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
os.chdir(srcdir)
|
||||
|
||||
@@ -32,6 +33,7 @@ print(
|
||||
for x in HBHEADERS:
|
||||
if x == "hb.h" or x == "hb-common.h":
|
||||
continue
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
first = re.findall(r"#.*include.*", content)[0]
|
||||
@@ -41,6 +43,7 @@ for x in HBHEADERS:
|
||||
|
||||
print("Checking that source files #include a private header first (or none)")
|
||||
for x in HBSOURCES:
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
includes = re.findall(r"#.*include.*", content)
|
||||
@@ -51,6 +54,7 @@ for x in HBSOURCES:
|
||||
|
||||
print("Checking that there is no #include <hb-*.h>")
|
||||
for x in HBHEADERS + HBSOURCES:
|
||||
print(f"Checking {x}")
|
||||
with open(x, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
if re.findall("#.*include.*<.*hb", content):
|
||||
|
||||
@@ -5,9 +5,11 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
os.chdir(os.getenv("srcdir", os.path.dirname(__file__)))
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
libs = os.getenv("libs", ".libs")
|
||||
os.chdir(srcdir)
|
||||
|
||||
ldd = os.getenv("LDD", shutil.which("ldd"))
|
||||
if not ldd:
|
||||
@@ -24,7 +26,7 @@ tested = False
|
||||
# harfbuzz-icu links to libstdc++ because icu does.
|
||||
for soname in ["harfbuzz", "harfbuzz-subset", "harfbuzz-gobject", "harfbuzz-cairo"]:
|
||||
for suffix in ["so", "dylib"]:
|
||||
so = os.path.join(libs, "lib%s.%s" % (soname, suffix))
|
||||
so = os.path.join(builddir, "lib%s.%s" % (soname, suffix))
|
||||
if not os.path.exists(so):
|
||||
continue
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
builddir = os.getenv("builddir", os.path.dirname(__file__))
|
||||
libs = os.getenv("libs", ".libs")
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
objdump = os.getenv("OBJDUMP", shutil.which("objdump"))
|
||||
if not objdump:
|
||||
@@ -19,7 +20,7 @@ if sys.version_info < (3, 5):
|
||||
print("check-static-inits.py: needs python 3.5 for recursive support in glob")
|
||||
sys.exit(77)
|
||||
|
||||
OBJS = glob.glob(os.path.join(builddir, libs, "**", "*hb*.o"), recursive=True)
|
||||
OBJS = glob.glob(os.path.join(builddir, "**", "*hb*.o"), recursive=True)
|
||||
if not OBJS:
|
||||
print("check-static-inits.py: object files not found; skipping test")
|
||||
sys.exit(77)
|
||||
@@ -27,6 +28,9 @@ if not OBJS:
|
||||
stat = 0
|
||||
tested = False
|
||||
|
||||
print("Checking that the following object files has no static initializers/finalizers")
|
||||
print("\n".join(OBJS))
|
||||
|
||||
result = subprocess.run(
|
||||
objdump.split() + ["-t"] + OBJS, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
@@ -9,8 +9,9 @@ import sys
|
||||
|
||||
os.environ["LC_ALL"] = "C" # otherwise 'nm' prints in wrong order
|
||||
|
||||
builddir = os.getenv("builddir", os.path.dirname(__file__))
|
||||
libs = os.getenv("libs", ".libs")
|
||||
srcdir = sys.argv[1]
|
||||
base_srcdir = sys.argv[2]
|
||||
builddir = sys.argv[3]
|
||||
|
||||
IGNORED_SYMBOLS = [
|
||||
"_fini",
|
||||
@@ -61,7 +62,7 @@ for soname in [
|
||||
"harfbuzz-cairo",
|
||||
]:
|
||||
for suffix in ["so", "dylib"]:
|
||||
so = os.path.join(builddir, libs, "lib%s.%s" % (soname, suffix))
|
||||
so = os.path.join(builddir, "lib%s.%s" % (soname, suffix))
|
||||
if not os.path.exists(so):
|
||||
continue
|
||||
|
||||
|
||||
+5
-4
@@ -1038,10 +1038,6 @@ if get_option('tests').enabled()
|
||||
]
|
||||
|
||||
env = environment()
|
||||
env.set('srcdir', meson.current_source_dir())
|
||||
env.set('base_srcdir', meson.project_source_root())
|
||||
env.set('builddir', meson.current_build_dir())
|
||||
env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal
|
||||
HBSOURCES = []
|
||||
foreach f : hb_sources
|
||||
if meson.version().version_compare('>=1.4.0')
|
||||
@@ -1069,6 +1065,11 @@ if get_option('tests').enabled()
|
||||
foreach name : dist_check_script
|
||||
test(name, find_program(name + '.py'),
|
||||
env: env,
|
||||
args: [
|
||||
meson.current_source_dir(),
|
||||
meson.project_source_root(),
|
||||
meson.current_build_dir(),
|
||||
],
|
||||
depends: name == 'check-symbols' ? defs_list : [],
|
||||
suite: ['src'],
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user