Esempio n. 1
0
 def __init__(self, app=None):
     if not sarge.get_both('which git'):
         raise RuntimeError('git not available')
     self._repo = None
     self._name = None
     self._plugins_dir = None
     if app:
         self.init_app(app)
Esempio n. 2
0
 def __init__(self, app=None):
     if not sarge.get_both('which git'):
         raise RuntimeError('git not available')
     self._repo = None
     self._name = None
     self._plugins_dir = None
     if app:
         self.init_app(app)
Esempio n. 3
0
def get_vcgencmd_throttled_state(command):
    if __LOCAL_DEBUG:
        if _VCGENCMD_BROKEN:
            output = ""
            error = "VCHI initialization failed"
        else:
            output = "throttled={}".format(
                next(_VCGENCMD_OUTPUT))  # mock for local debugging
            error = ""
    else:
        output, error = sarge.get_both(command, close_fds=CLOSE_FDS)

    if "throttled=0x" not in output:
        raise ValueError('Cannot parse "{}" output: {}'.format(
            command, error if error else output))

    value = output[len("throttled="):].strip(" \t\r\n\0")
    value = int(value, 0)
    return ThrottleState.from_value(value)
Esempio n. 4
0
 def trust_cert(cert_chain):
     if cert_chain is not None:
         with open('{0}/ecscert.crt'.format(ssl_root), 'w') as fp:
             fp.write(str(cert_chain))
             stdout, stderr = get_both('update-ca-certificates')
         return stdout + stderr
Esempio n. 5
0
 def test_get_both(self):
     self.ensure_emitter()
     t = get_both('"%s" emitter.py' % sys.executable)
     self.assertEqual([s.strip() for s in t], ['foo', 'bar'])
Esempio n. 6
0
 def test_get_both(self):
     self.ensure_emitter()
     t = get_both('"%s" emitter.py' % sys.executable)
     self.assertEqual([s.strip() for s in t], ['foo', 'bar'])
Esempio n. 7
0
 def trust_cert(cert_chain):
     if cert_chain is not None:
         with open('{0}/ecscert.crt'.format(ssl_root), 'w') as fp:
             fp.write(str(cert_chain))
             stdout, stderr = get_both('update-ca-certificates')
         return stdout + stderr