An error occurred while loading the file. Please try again.
-
Julien Veyssier authored
Signed-off-by:
Julien Veyssier <eneiluj@posteo.net>
Unverifiedcc569865
import platform
import os
def isWindows():
plat = platform.system()
return (plat == 'Windows')
def isMac():
plat = platform.system()
return (plat == 'Darwin')
# check if a binary is available in the PATH
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = 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
def split_list(alist, wanted_parts=1):
length = len(alist)
return [ alist[i*length // wanted_parts: (i+1)*length // wanted_parts]
for i in range(wanted_parts) ]