[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
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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__',

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 = "\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', ''))

View File

@ -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.""")

View File

@ -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.""")

View File

@ -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.""")

View File

@ -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

View File

@ -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

View File

@ -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'