def __catalina_home():
 locations = ['/usr/share/tomcat*', '/opt/tomcat']
 for location in locations:
  folders = glob.glob(location)
  if folders:
   for catalina_home in folders:
    if os.path.isdir((catalina_home + '/bin')):
     return catalina_home
 return False

def __catalina_home ( ) : locations = [ '/usr/share/tomcat*' , '/opt/tomcat' ] for location in locations : folders = glob . glob ( location ) if folders : for catalina_home in folders : if os . path . isdir ( ( catalina_home + '/bin' ) ) : return catalina_home return False
tomcat paths differ depending on packaging .