[py] minor, replace os.environ.get with os.getenv

This commit is contained in:
Ebrahim Byagowi 2020-07-04 14:12:55 +04:30
parent 43e3ab019c
commit a07672d353
14 changed files with 40 additions and 40 deletions

View File

@ -2,11 +2,11 @@
import sys, os 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')] [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'))] [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))]
stat = 0 stat = 0

View File

@ -2,9 +2,9 @@
import sys, os, re 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')] [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')]
stat = 0 stat = 0

View File

@ -2,11 +2,11 @@
import sys, os, re 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')] [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'))] [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))]
stat = 0 stat = 0

View File

@ -2,11 +2,11 @@
import sys, os, re 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')] [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'))] [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))]
stat = 0 stat = 0

View File

@ -2,9 +2,9 @@
import sys, os, shutil, subprocess 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') ldd = shutil.which ('ldd')
if ldd: if ldd:

View File

@ -2,8 +2,8 @@
import sys, os, shutil, subprocess, glob, re import sys, os, shutil, subprocess, glob, re
builddir = os.environ.get ('builddir', os.path.dirname (__file__)) builddir = os.getenv ('builddir', os.path.dirname (__file__))
libs = os.environ.get ('libs', '.libs') libs = os.getenv ('libs', '.libs')
objdump = shutil.which ('objdump') objdump = shutil.which ('objdump')
if not objdump: if not objdump:

View File

@ -4,8 +4,8 @@ import sys, os, shutil, subprocess, re, difflib
os.environ['LC_ALL'] = 'C' # otherwise 'nm' prints in wrong order os.environ['LC_ALL'] = 'C' # otherwise 'nm' prints in wrong order
builddir = os.environ.get ('builddir', os.path.dirname (__file__)) builddir = os.getenv ('builddir', os.path.dirname (__file__))
libs = os.environ.get ('libs', '.libs') libs = os.getenv ('libs', '.libs')
IGNORED_SYMBOLS = '|'.join(['_fini', '_init', '_fdata', '_ftext', '_fbss', IGNORED_SYMBOLS = '|'.join(['_fini', '_init', '_fdata', '_ftext', '_fbss',
'__bss_start', '__bss_start__', '__bss_end__', '_edata', '_end', '_bss_end__', '__bss_start', '__bss_start__', '__bss_end__', '_edata', '_end', '_bss_end__',

View File

@ -41,7 +41,7 @@ hb_font_get_var_coords_design""".splitlines ()
symbols = [x for x in symbols if x not in experimental_symbols] symbols = [x for x in symbols if x not in experimental_symbols]
symbols = "\n".join (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 %s
LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', '')) LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', ''))

View File

@ -9,7 +9,7 @@ def cmd (command):
p = subprocess.Popen (command, stderr=tempf) p = subprocess.Popen (command, stderr=tempf)
try: 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) tempf.seek (0)
text = tempf.read () text = tempf.read ()
@ -21,9 +21,9 @@ def cmd (command):
return 'error: timeout, ' + ' '.join (command), 1 return 'error: timeout, ' + ' '.join (command), 1
srcdir = os.environ.get ("srcdir", ".") srcdir = os.getenv ("srcdir", ".")
EXEEXT = os.environ.get ("EXEEXT", "") EXEEXT = os.getenv ("EXEEXT", "")
top_builddir = os.environ.get ("top_builddir", ".") top_builddir = os.getenv ("top_builddir", ".")
hb_draw_fuzzer = os.path.join (top_builddir, "hb-draw-fuzzer" + EXEEXT) hb_draw_fuzzer = os.path.join (top_builddir, "hb-draw-fuzzer" + EXEEXT)
if not os.path.exists (hb_draw_fuzzer): 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) print ('hb_draw_fuzzer:', hb_draw_fuzzer)
fails = 0 fails = 0
libtool = os.environ.get ('LIBTOOL') libtool = os.getenv ('LIBTOOL')
valgrind = None valgrind = None
if os.environ.get ('RUN_VALGRIND', ''): if os.getenv ('RUN_VALGRIND', ''):
valgrind = shutil.which ('valgrind') valgrind = shutil.which ('valgrind')
if valgrind is None: if valgrind is None:
sys.exit ("""Valgrind requested but not found.""") sys.exit ("""Valgrind requested but not found.""")

View File

@ -9,7 +9,7 @@ def cmd (command):
p = subprocess.Popen (command, stderr=tempf) p = subprocess.Popen (command, stderr=tempf)
try: 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) tempf.seek (0)
text = tempf.read () text = tempf.read ()
@ -21,9 +21,9 @@ def cmd (command):
return 'error: timeout, ' + ' '.join (command), 1 return 'error: timeout, ' + ' '.join (command), 1
srcdir = os.environ.get ("srcdir", ".") srcdir = os.getenv ("srcdir", ".")
EXEEXT = os.environ.get ("EXEEXT", "") EXEEXT = os.getenv ("EXEEXT", "")
top_builddir = os.environ.get ("top_builddir", ".") top_builddir = os.getenv ("top_builddir", ".")
hb_shape_fuzzer = os.path.join (top_builddir, "hb-shape-fuzzer" + EXEEXT) hb_shape_fuzzer = os.path.join (top_builddir, "hb-shape-fuzzer" + EXEEXT)
if not os.path.exists (hb_shape_fuzzer): 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) print ('hb_shape_fuzzer:', hb_shape_fuzzer)
fails = 0 fails = 0
libtool = os.environ.get ('LIBTOOL') libtool = os.getenv ('LIBTOOL')
valgrind = None valgrind = None
if os.environ.get ('RUN_VALGRIND', ''): if os.getenv ('RUN_VALGRIND', ''):
valgrind = shutil.which ('valgrind') valgrind = shutil.which ('valgrind')
if valgrind is None: if valgrind is None:
sys.exit ("""Valgrind requested but not found.""") sys.exit ("""Valgrind requested but not found.""")

View File

@ -9,7 +9,7 @@ def cmd (command):
p = subprocess.Popen (command, stderr=tempf) p = subprocess.Popen (command, stderr=tempf)
try: 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) tempf.seek (0)
text = tempf.read () text = tempf.read ()
@ -21,9 +21,9 @@ def cmd (command):
return 'error: timeout, ' + ' '.join (command), 1 return 'error: timeout, ' + ' '.join (command), 1
srcdir = os.environ.get ("srcdir", ".") srcdir = os.getenv ("srcdir", ".")
EXEEXT = os.environ.get ("EXEEXT", "") EXEEXT = os.getenv ("EXEEXT", "")
top_builddir = os.environ.get ("top_builddir", ".") top_builddir = os.getenv ("top_builddir", ".")
hb_subset_fuzzer = os.path.join (top_builddir, "hb-subset-fuzzer" + EXEEXT) hb_subset_fuzzer = os.path.join (top_builddir, "hb-subset-fuzzer" + EXEEXT)
if not os.path.exists (hb_subset_fuzzer): 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) print ('hb_subset_fuzzer:', hb_subset_fuzzer)
fails = 0 fails = 0
libtool = os.environ.get('LIBTOOL') libtool = os.getenv ('LIBTOOL')
valgrind = None valgrind = None
if os.environ.get('RUN_VALGRIND', ''): if os.getenv ('RUN_VALGRIND', ''):
valgrind = shutil.which ('valgrind') valgrind = shutil.which ('valgrind')
if valgrind is None: if valgrind is None:
sys.exit ("""Valgrind requested but not found.""") sys.exit ("""Valgrind requested but not found.""")

View File

@ -2,7 +2,7 @@
import sys, os, subprocess, shutil 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 git = shutil.which ('git'); assert git
make = shutil.which ('make'); assert make make = shutil.which ('make'); assert make

View File

@ -63,7 +63,7 @@ def extract_tests (input):
assert found assert found
return '\n'.join (result) + '\n' 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') git = shutil.which ('git')
assert git assert git