Fix check-* scripts when harfbuzz is a subproject

When harfbuzz is a subproject paths are in the form
"subprojects/harfbuzz/src/...". Instead of removing "src/" prefix, take
the absolute path and make it relative to current source dir.

This fix regression introduced in
https://github.com/harfbuzz/harfbuzz/pull/3394.
This commit is contained in:
Xavier Claessens 2022-06-03 12:06:56 -04:00 committed by Behdad Esfahbod
parent b5f621b08d
commit 4266f4e29a
5 changed files with 27 additions and 21 deletions

View File

@ -437,6 +437,7 @@ endif
TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \
base_srcdir="$(srcdir)" \
builddir="$(builddir)" \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \
HBSOURCES="$(HBSOURCES)" \

View File

@ -2,18 +2,20 @@
import sys, os
os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
srcdir = os.getenv ('srcdir', os.path.dirname (__file__))
base_srcdir = os.getenv ('base_srcdir', srcdir)
os.chdir (srcdir)
def removeprefix(s):
abs_path = os.path.join(base_srcdir, s)
return os.path.relpath(abs_path, srcdir)
def removeprefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
else:
return s[:]
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')]
HBSOURCES = [
removeprefix(x, 'src%s' % os.path.sep) for x in os.getenv ('HBSOURCES', '').split ()
removeprefix(x) for x in os.getenv ('HBSOURCES', '').split ()
] or [
x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))
]

View File

@ -2,19 +2,20 @@
import sys, os, re
os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
srcdir = os.getenv ('srcdir', os.path.dirname (__file__))
base_srcdir = os.getenv ('base_srcdir', srcdir)
def removeprefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
else:
return s[:]
os.chdir (srcdir)
def removeprefix(s):
abs_path = os.path.join(base_srcdir, s)
return os.path.relpath(abs_path, 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')]
HBSOURCES = [
removeprefix(x, 'src%s' % os.path.sep) for x in os.getenv ('HBSOURCES', '').split ()
removeprefix(x) for x in os.getenv ('HBSOURCES', '').split ()
] or [
x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))
]

View File

@ -2,19 +2,20 @@
import sys, os, re
os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
srcdir = os.getenv ('srcdir', os.path.dirname (__file__))
base_srcdir = os.getenv ('base_srcdir', srcdir)
def removeprefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
else:
return s[:]
os.chdir (srcdir)
def removeprefix(s):
abs_path = os.path.join(base_srcdir, s)
return os.path.relpath(abs_path, 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')]
HBSOURCES = [
removeprefix(x, 'src%s' % os.path.sep) for x in os.getenv ('HBSOURCES', '').split ()
removeprefix(x) for x in os.getenv ('HBSOURCES', '').split ()
] or [
x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))
]

View File

@ -718,6 +718,7 @@ if get_option('tests').enabled()
env = environment()
env.set('srcdir', meson.current_source_dir())
env.set('base_srcdir', meson.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 = []