Esempio n. 1
0
def execute(argv):
    if is_verbose_mode():
        print ' '.join(argv)
    try:
        output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
        if is_verbose_mode():
            print output
        return output
    except subprocess.CalledProcessError as e:
        print e.output
        raise e
Esempio n. 2
0
def execute(argv, env=os.environ):
  if is_verbose_mode():
    print ' '.join(argv)
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT, env=env)
    if is_verbose_mode():
      print output
    return output
  except subprocess.CalledProcessError as e:
    print e.output
    raise e
Esempio n. 3
0
def execute(argv, env=os.environ, cwd=None):
  if is_verbose_mode():
    print ' '.join(argv)
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT, env=env, cwd=cwd)
    if is_verbose_mode():
      print output
    return output
  except subprocess.CalledProcessError as e:
    print e.output
    raise e
Esempio n. 4
0
def start():
    dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')

    DBusTestCase.start_system_bus()
    DBusTestCase.spawn_server_template('logind', None, dbusmock_log)

    DBusTestCase.start_session_bus()
    DBusTestCase.spawn_server_template('notification_daemon', None, dbusmock_log)
Esempio n. 5
0
def start():
    dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')

    DBusTestCase.start_system_bus()
    DBusTestCase.spawn_server_template('logind', None, dbusmock_log)

    DBusTestCase.start_session_bus()
    DBusTestCase.spawn_server_template('notification_daemon', None,
                                       dbusmock_log)
Esempio n. 6
0
def execute_stdout(argv, env=os.environ, cwd=None):
    if is_verbose_mode():
        print ' '.join(argv)
        try:
            subprocess.check_call(argv, env=env, cwd=cwd)
        except subprocess.CalledProcessError as e:
            print e.output
            raise e
    else:
        execute(argv, env)
Esempio n. 7
0
def execute_stdout(argv, env=os.environ):
  if is_verbose_mode():
    print ' '.join(argv)
    try:
      subprocess.check_call(argv, env=env)
    except subprocess.CalledProcessError as e:
      print e.output
      raise e
  else:
    execute(argv, env)
Esempio n. 8
0
def execute_stdout(argv):
    if is_verbose_mode():
        print ' '.join(argv)
        try:
            subprocess.check_call(argv)
        except subprocess.CalledProcessError as e:
            print e.output
            raise e
    else:
        execute(argv)
Esempio n. 9
0
def update_node_modules(dirname, env=None):
    if env is None:
        env = os.environ.copy()
    if PLATFORM == 'linux':
        # Use prebuilt clang for building native modules.
        set_clang_env(env)
        env['npm_config_clang'] = '1'
    with scoped_cwd(dirname):
        args = [NPM, 'install']
        if is_verbose_mode():
            args += ['--verbose']
        # Ignore npm install errors when running in CI.
        if os.environ.has_key('CI'):
            try:
                execute_stdout(args, env)
            except subprocess.CalledProcessError:
                pass
        else:
            execute_stdout(args, env)
Esempio n. 10
0
def update_node_modules(dirname, env=None):
  if env is None:
    env = os.environ.copy()
  if PLATFORM == 'linux':
    # Use prebuilt clang for building native modules.
    set_clang_env(env)
    env['npm_config_clang'] = '1'
  with scoped_cwd(dirname):
    args = [NPM, 'install']
    if is_verbose_mode():
      args += ['--verbose']
    # Ignore npm install errors when running in CI.
    if os.environ.has_key('CI'):
      try:
        execute_stdout(args, env)
      except subprocess.CalledProcessError:
        pass
    else:
      execute_stdout(args, env)
Esempio n. 11
0
from config import is_verbose_mode
from dbusmock import DBusTestCase

import atexit
import os
import sys


def cleanup():
    DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
    DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)


atexit.register(cleanup)

dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')

DBusTestCase.start_system_bus()
DBusTestCase.spawn_server_template('logind', None, dbusmock_log)

DBusTestCase.start_session_bus()
DBusTestCase.spawn_server_template('notification_daemon', None, dbusmock_log)