def find_hook(hook_name, hooks_dir='hooks'):
 logger.debug('hooks_dir is {}'.format(os.path.abspath(hooks_dir)))
 if (not os.path.isdir(hooks_dir)):
  logger.debug('No hooks/ dir in template_dir')
  return None
 for hook_file in os.listdir(hooks_dir):
  if valid_hook(hook_file, hook_name):
   return os.path.abspath(os.path.join(hooks_dir, hook_file))
 return None

def find_hook ( hook_name , hooks_dir = 'hooks' ) : logger . debug ( 'hooks_dir is {}' . format ( os . path . abspath ( hooks_dir ) ) ) if ( not os . path . isdir ( hooks_dir ) ) : logger . debug ( 'No hooks/ dir in template_dir' ) return None for hook_file in os . listdir ( hooks_dir ) : if valid_hook ( hook_file , hook_name ) : return os . path . abspath ( os . path . join ( hooks_dir , hook_file ) ) return None
return a dict of all hook scripts provided .