예제 #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
파일: 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