in dcrpm/util.py [0:0]
def which(cmd):
# type: (str) -> str
try:
import shutil
path = shutil.which(cmd)
if not path:
raise DcRPMException("failed to find '{}'".format(cmd))
return path
except AttributeError:
for path in os.environ["PATH"].split(os.pathsep):
p = os.path.join(path, cmd)
if os.access(p, os.X_OK):
return p
raise DcRPMException("could not find '{}' in $PATH".format(cmd))