Пример #1
0
 def cmd_out(self, cmd, check=True):
     if check:
         self.check_repository()
     p = subprocess.Popen([config.get("cm", "vcs_path")] + cmd,
                          stdout=subprocess.PIPE,
                          cwd=self.repo)
     d = p.stdout.read()
     return d
Пример #2
0
def get_seconds(section, option):
    v = config.get(section, option)
    m = 1
    if v.endswith("h"):
        v = v[:-1]
        m = 3600
    elif v.endswith("d"):
        v = v[:-1]
        m = 24 * 3600
    elif v.endswith("w"):
        v = v[:-1]
        m = 7 * 24 * 3600
    elif v.endswith("m"):
        v = v[:-1]
        m = 30 * 24 * 3600
    elif v.endswith("y"):
        v = v[:-1]
        m = 365 * 24 * 3600
    try:
        v = int(v)
    except ValueError:
        raise "Invalid expiration option in %s:%s" % (section, option)
    return v * m
Пример #3
0
 def cmd(self, cmd, check=True):
     if check:
         self.check_repository()
     subprocess.check_call([config.get("cm", "vcs_path")] + cmd,
                           cwd=self.repo)
Пример #4
0
 def repo(self):
     return os.path.join(config.get("cm", "repo"), self.repo_name)