[tools] Remove in-house 'which' now that we have py3

This commit is contained in:
Ebrahim Byagowi 2020-03-18 23:58:20 +03:30
parent a0c58be371
commit b5526a09ff
4 changed files with 9 additions and 79 deletions

View File

@ -1,24 +1,6 @@
#!/usr/bin/env python3
import sys, os, subprocess, tempfile, threading
def which (program):
# https://stackoverflow.com/a/377028
def is_exe (fpath):
return os.path.isfile (fpath) and os.access (fpath, os.X_OK)
fpath, _ = os.path.split (program)
if fpath:
if is_exe (program):
return program
else:
for path in os.environ["PATH"].split (os.pathsep):
exe_file = os.path.join (path, program)
if is_exe (exe_file):
return exe_file
return None
import sys, os, subprocess, tempfile, threading, shutil
def cmd (command):
@ -74,7 +56,7 @@ fails = 0
libtool = os.environ.get ('LIBTOOL')
valgrind = None
if os.environ.get ('RUN_VALGRIND', ''):
valgrind = which ('valgrind')
valgrind = shutil.which ('valgrind')
if valgrind is None:
print ("""Valgrind requested but not found.""")
sys.exit (1)

View File

@ -1,24 +1,6 @@
#!/usr/bin/env python3
import sys, os, subprocess, tempfile, threading
def which (program):
# https://stackoverflow.com/a/377028
def is_exe (fpath):
return os.path.isfile (fpath) and os.access (fpath, os.X_OK)
fpath, _ = os.path.split (program)
if fpath:
if is_exe (program):
return program
else:
for path in os.environ["PATH"].split (os.pathsep):
exe_file = os.path.join (path, program)
if is_exe (exe_file):
return exe_file
return None
import sys, os, subprocess, tempfile, threading, shutil
def cmd (command):
@ -74,7 +56,7 @@ fails = 0
libtool = os.environ.get ('LIBTOOL')
valgrind = None
if os.environ.get ('RUN_VALGRIND', ''):
valgrind = which ('valgrind')
valgrind = shutil.which ('valgrind')
if valgrind is None:
print ("""Valgrind requested but not found.""")
sys.exit (1)

View File

@ -1,24 +1,6 @@
#!/usr/bin/env python3
import sys, os, subprocess, tempfile, threading
def which(program):
# https://stackoverflow.com/a/377028
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, _ = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
import sys, os, subprocess, tempfile, threading, shutil
def cmd(command):
@ -74,7 +56,7 @@ fails = 0
libtool = os.environ.get('LIBTOOL')
valgrind = None
if os.environ.get('RUN_VALGRIND', ''):
valgrind = which ('valgrind')
valgrind = shutil.which ('valgrind')
if valgrind is None:
print ("""Valgrind requested but not found.""")
sys.exit (1)

View File

@ -10,28 +10,12 @@ import re
import subprocess
import sys
import tempfile
import shutil
from subset_test_suite import SubsetTestSuite
# https://stackoverflow.com/a/377028
def which (program):
def is_exe (fpath):
return os.path.isfile (fpath) and os.access (fpath, os.X_OK)
fpath, _ = os.path.split (program)
if fpath:
if is_exe (program):
return program
else:
for path in os.environ["PATH"].split (os.pathsep):
exe_file = os.path.join (path, program)
if is_exe (exe_file):
return exe_file
return None
fonttools = which ("fonttools")
ots_sanitize = which ("ots-sanitize")
fonttools = shutil.which ("fonttools")
ots_sanitize = shutil.which ("ots-sanitize")
if not fonttools:
print ("fonttools is not present, skipping test.")