예제 #1
0
def do_remove(app_name):
    """Uninstall the given app. Returns True/False."""
    # TODO(bc)  Does not detect dependency. The app to be uninstalled could be a
    #           pre-req for other apps, as defined in various setup.py files.
    LOG.info("=== Uninstalling %s" % (app_name, ))
    reg = registry.AppRegistry()
    try:
        app = reg.unregister(app_name)
    except KeyError:
        LOG.error("%s is not installed" % (app_name, ))
        return False

    app.uninstall_conf()
    reg.save()

    # Update the pth file
    try:
        pthfile = pth.PthFile()
        pthfile.remove(app)
        pthfile.save()
        return True
    except (OSError, SystemError) as ex:
        LOG.error(
            "Failed to update the .pth file. Please fix any problem and run "
            "`%s --sync'\n%s" % (PROG_NAME, ex))
        return False
예제 #2
0
def do_install(app_loc_list, relative_paths=False):
    """Install the apps. Returns True/False."""
    reg = registry.AppRegistry()
    for app_loc in app_loc_list:
        if not _do_install_one(reg, app_loc, relative_paths):
            return False
    reg.save()

    return do_sync(reg) and do_collectstatic()
예제 #3
0
파일: app_reg.py 프로젝트: wdmchaft/hue
def do_list():
  """List all apps. Returns True/False."""
  reg = registry.AppRegistry()
  apps = reg.get_all_apps()
  LOG.info("%-18s %-7s %-15s %s" % ('Name', 'Version', 'Author', 'Path'))
  LOG.info("%s %s %s %s" % ('-' * 18, '-' * 7, '-' * 15, '-' * 35))
  for app in sorted(apps):
    LOG.info("%-18s %-7s %-15s %s" % (app.name, app.version, app.author, app.path))
  return True
예제 #4
0
파일: app_reg.py 프로젝트: wdmchaft/hue
def do_install(app_loc_list):
  """Install the apps. Returns True/False."""
  reg = registry.AppRegistry()
  for app_loc in app_loc_list:
    if not _do_install_one(reg, app_loc):
      return False
  reg.save()

  return do_sync(reg)
예제 #5
0
파일: app_reg.py 프로젝트: wdmchaft/hue
def do_sync(reg=None):
  """Sync apps with virtualenv. Returns True/False."""
  if not reg:
    reg = registry.AppRegistry()

  apps = reg.get_all_apps()
  try:
    pthfile = pth.PthFile()
    pthfile.sync(apps)
    pthfile.save()

    build.make_syncdb()
    return True
  except (OSError, SystemError), ex:
    LOG.error("Failed to update the .pth file. Please fix any problem and run "
              "`%s --sync'\n%s" % (PROG_NAME, ex))
    return False