# -*- coding: utf-8 -*- # # watcher.impl.growlnotify # # growlnotify implementation of the Notifier interface (Mac OS X) # # Authors: Konrad Markus <*****@*****.**> # import logging import subprocess from shell.cmd import exec_cmd, exec_cmd_out # try to locate the growlnotify command line tool, or raise ImportError GROWLNOTIFY = exec_cmd_out("which growlnotify").strip() if GROWLNOTIFY == "": raise ImportError() NORMAL_LEVEL_IMPL = 0 ERROR_LEVEL_IMPL = 1 class NotifierImpl(object): def __init__(self, title, disable_after_n_errors=-1): self.title = title self.disable_after_n_errors = disable_after_n_errors self._consecutive_errors = 0 logging.info("Using Notifier: %s" % GROWLNOTIFY) def notify(self, message, level=NORMAL_LEVEL_IMPL): if message == "":
# # Wrapper around the git command # # Authors: Konrad Markus <*****@*****.**> # import logging import os.path import shutil import time import subprocess from shell.cmd import exec_cmd, exec_cmd_out from vcs import OK, NOT_OK # try to locate the git command line tool, or raise ImportError GIT = exec_cmd_out("which git").strip() if GIT == '': raise ImportError() class VCSImpl(object): def __init__(self, repo_directory): self.repo_directory = repo_directory self.ignore_path = os.path.join(repo_directory, '.git') logging.info("Using VCS: git") def status(self): cmd = "%s status --porcelain -uall" % GIT stdout,stderr = exec_cmd(cmd, self.repo_directory) return self._parse_status(stdout, stderr)
# -*- coding: utf-8 -*- # # watcher.impl.notifysend # # notify-send implementation of the Notifier interface (Linux) # # Authors: Konrad Markus <*****@*****.**> # import logging import subprocess from shell.cmd import exec_cmd, exec_cmd_out # try to locate the notify-send command line tool, or raise ImportError NOTIFY_SEND = exec_cmd_out("which notify-send").strip() if NOTIFY_SEND == '': raise ImportError() NORMAL_LEVEL_IMPL = 0 ERROR_LEVEL_IMPL = 1 class NotifierImpl(object): def __init__(self, title, disable_after_n_errors=-1): self.title = title self.disable_after_n_errors = disable_after_n_errors self._consecutive_errors = 0 logging.info("Using Notifier: %s" % NOTIFY_SEND) def notify(self, message, level=NORMAL_LEVEL_IMPL): if message == "": return