diff --git a/src/check-c-linkage-decls.py b/src/check-c-linkage-decls.py index 6ae2579f7..b7532a7e9 100755 --- a/src/check-c-linkage-decls.py +++ b/src/check-c-linkage-decls.py @@ -2,11 +2,11 @@ import sys, os -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = [os.path.basename (x) for x in os.environ.get ('HBHEADERS', '').split ()] or \ +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 = [os.path.basename (x) for x in os.environ.get ('HBSOURCES', '').split ()] or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/src/check-externs.py b/src/check-externs.py index ea6d7f3ad..a64d2e5b4 100755 --- a/src/check-externs.py +++ b/src/check-externs.py @@ -2,9 +2,9 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = [os.path.basename (x) for x in os.environ.get ('HBHEADERS', '').split ()] or \ +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')] stat = 0 diff --git a/src/check-header-guards.py b/src/check-header-guards.py index 6bf6ad42f..0ad42cd84 100755 --- a/src/check-header-guards.py +++ b/src/check-header-guards.py @@ -2,11 +2,11 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = [os.path.basename (x) for x in os.environ.get ('HBHEADERS', '').split ()] or \ +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 = [os.path.basename (x) for x in os.environ.get ('HBSOURCES', '').split ()] or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/src/check-includes.py b/src/check-includes.py index d9219bf8b..88eaa2eaa 100755 --- a/src/check-includes.py +++ b/src/check-includes.py @@ -2,11 +2,11 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = [os.path.basename (x) for x in os.environ.get ('HBHEADERS', '').split ()] or \ +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 = [os.path.basename (x) for x in os.environ.get ('HBSOURCES', '').split ()] or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/src/check-libstdc++.py b/src/check-libstdc++.py index 142785c15..200c68374 100755 --- a/src/check-libstdc++.py +++ b/src/check-libstdc++.py @@ -2,9 +2,9 @@ import sys, os, shutil, subprocess -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -libs = os.environ.get ('libs', '.libs') +libs = os.getenv ('libs', '.libs') ldd = shutil.which ('ldd') if ldd: diff --git a/src/check-static-inits.py b/src/check-static-inits.py index 9e43b811b..1c88f22ca 100755 --- a/src/check-static-inits.py +++ b/src/check-static-inits.py @@ -2,8 +2,8 @@ import sys, os, shutil, subprocess, glob, re -builddir = os.environ.get ('builddir', os.path.dirname (__file__)) -libs = os.environ.get ('libs', '.libs') +builddir = os.getenv ('builddir', os.path.dirname (__file__)) +libs = os.getenv ('libs', '.libs') objdump = shutil.which ('objdump') if not objdump: diff --git a/src/check-symbols.py b/src/check-symbols.py index 92f44cd26..d36b6c45f 100755 --- a/src/check-symbols.py +++ b/src/check-symbols.py @@ -4,8 +4,8 @@ import sys, os, shutil, subprocess, re, difflib os.environ['LC_ALL'] = 'C' # otherwise 'nm' prints in wrong order -builddir = os.environ.get ('builddir', os.path.dirname (__file__)) -libs = os.environ.get ('libs', '.libs') +builddir = os.getenv ('builddir', os.path.dirname (__file__)) +libs = os.getenv ('libs', '.libs') IGNORED_SYMBOLS = '|'.join(['_fini', '_init', '_fdata', '_ftext', '_fbss', '__bss_start', '__bss_start__', '__bss_end__', '_edata', '_end', '_bss_end__', diff --git a/src/gen-def.py b/src/gen-def.py index 822a9448d..aa6dcd95f 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -41,7 +41,7 @@ hb_font_get_var_coords_design""".splitlines () symbols = [x for x in symbols if x not in experimental_symbols] symbols = "\n".join (symbols) -result = symbols if os.environ.get('PLAIN_LIST', '') else """EXPORTS +result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS %s LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', '')) diff --git a/test/fuzzing/run-draw-fuzzer-tests.py b/test/fuzzing/run-draw-fuzzer-tests.py index 7f40cf838..de52a8da5 100755 --- a/test/fuzzing/run-draw-fuzzer-tests.py +++ b/test/fuzzing/run-draw-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.environ.get ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) + p.wait (timeout=int (os.getenv ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) tempf.seek (0) text = tempf.read () @@ -21,9 +21,9 @@ def cmd (command): return 'error: timeout, ' + ' '.join (command), 1 -srcdir = os.environ.get ("srcdir", ".") -EXEEXT = os.environ.get ("EXEEXT", "") -top_builddir = os.environ.get ("top_builddir", ".") +srcdir = os.getenv ("srcdir", ".") +EXEEXT = os.getenv ("EXEEXT", "") +top_builddir = os.getenv ("top_builddir", ".") hb_draw_fuzzer = os.path.join (top_builddir, "hb-draw-fuzzer" + EXEEXT) if not os.path.exists (hb_draw_fuzzer): @@ -36,9 +36,9 @@ please provide it as the first argument to the tool""") print ('hb_draw_fuzzer:', hb_draw_fuzzer) fails = 0 -libtool = os.environ.get ('LIBTOOL') +libtool = os.getenv ('LIBTOOL') valgrind = None -if os.environ.get ('RUN_VALGRIND', ''): +if os.getenv ('RUN_VALGRIND', ''): valgrind = shutil.which ('valgrind') if valgrind is None: sys.exit ("""Valgrind requested but not found.""") diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index 7e2ef220f..7eb347fd0 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.environ.get ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) + p.wait (timeout=int (os.getenv ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) tempf.seek (0) text = tempf.read () @@ -21,9 +21,9 @@ def cmd (command): return 'error: timeout, ' + ' '.join (command), 1 -srcdir = os.environ.get ("srcdir", ".") -EXEEXT = os.environ.get ("EXEEXT", "") -top_builddir = os.environ.get ("top_builddir", ".") +srcdir = os.getenv ("srcdir", ".") +EXEEXT = os.getenv ("EXEEXT", "") +top_builddir = os.getenv ("top_builddir", ".") hb_shape_fuzzer = os.path.join (top_builddir, "hb-shape-fuzzer" + EXEEXT) if not os.path.exists (hb_shape_fuzzer): @@ -36,9 +36,9 @@ please provide it as the first argument to the tool""") print ('hb_shape_fuzzer:', hb_shape_fuzzer) fails = 0 -libtool = os.environ.get ('LIBTOOL') +libtool = os.getenv ('LIBTOOL') valgrind = None -if os.environ.get ('RUN_VALGRIND', ''): +if os.getenv ('RUN_VALGRIND', ''): valgrind = shutil.which ('valgrind') if valgrind is None: sys.exit ("""Valgrind requested but not found.""") diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index 5fd547d02..45b7964b5 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.environ.get ("HB_TEST_SUBSET_FUZZER_TIMEOUT", "12"))) + p.wait (timeout=int (os.getenv ("HB_TEST_SUBSET_FUZZER_TIMEOUT", "12"))) tempf.seek (0) text = tempf.read () @@ -21,9 +21,9 @@ def cmd (command): return 'error: timeout, ' + ' '.join (command), 1 -srcdir = os.environ.get ("srcdir", ".") -EXEEXT = os.environ.get ("EXEEXT", "") -top_builddir = os.environ.get ("top_builddir", ".") +srcdir = os.getenv ("srcdir", ".") +EXEEXT = os.getenv ("EXEEXT", "") +top_builddir = os.getenv ("top_builddir", ".") hb_subset_fuzzer = os.path.join (top_builddir, "hb-subset-fuzzer" + EXEEXT) if not os.path.exists (hb_subset_fuzzer): @@ -36,9 +36,9 @@ please provide it as the first argument to the tool""") print ('hb_subset_fuzzer:', hb_subset_fuzzer) fails = 0 -libtool = os.environ.get('LIBTOOL') +libtool = os.getenv ('LIBTOOL') valgrind = None -if os.environ.get('RUN_VALGRIND', ''): +if os.getenv ('RUN_VALGRIND', ''): valgrind = shutil.which ('valgrind') if valgrind is None: sys.exit ("""Valgrind requested but not found.""") diff --git a/test/shaping/data/aots/update.py b/test/shaping/data/aots/update.py index 8446df726..870c9d1f6 100755 --- a/test/shaping/data/aots/update.py +++ b/test/shaping/data/aots/update.py @@ -2,7 +2,7 @@ import sys, os, subprocess, shutil -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) git = shutil.which ('git'); assert git make = shutil.which ('make'); assert make diff --git a/test/shaping/data/text-rendering-tests/update.py b/test/shaping/data/text-rendering-tests/update.py index fe5db1636..cf119be0a 100755 --- a/test/shaping/data/text-rendering-tests/update.py +++ b/test/shaping/data/text-rendering-tests/update.py @@ -63,7 +63,7 @@ def extract_tests (input): assert found return '\n'.join (result) + '\n' -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) git = shutil.which ('git') assert git diff --git a/write-tarball-revision.py b/write-tarball-revision.py index 0b3ffee6d..ebf64262c 100755 --- a/write-tarball-revision.py +++ b/write-tarball-revision.py @@ -4,8 +4,8 @@ import os, subprocess from pathlib import Path outfile = Path( - os.getenv('MESON_DIST_ROOT') - or os.getenv('MESON_SOURCE_ROOT') + os.getenv ('MESON_DIST_ROOT') + or os.getenv ('MESON_SOURCE_ROOT') or Path(__file__).parent ) / '.tarball-revision'