Ejemplo n.º 1
0
def command_list():
    """Show the names of installed packages."""
    metadir = os.path.join(get_joltdir(), "meta")
    if not os.path.isdir(metadir):
        return
    for f in os.listdir(metadir):
        info = get_record(f)
        if info:
            print "%s: %s" % (f, info["version"])
Ejemplo n.º 2
0
def command_update():
    """Update all packages installed."""
    metadir = os.path.join(get_joltdir(), "meta")
    if not os.path.isdir(metadir):
        return
    for f in os.listdir(metadir):
        print "updating %s ..." % f
        info = get_record(f)
        if info:
            command_install(info)
        else:
            command_install(f)
Ejemplo n.º 3
0
def command_uninstall(name):
    """Delete files writen in meta-info."""
    info = get_record(name)
    if not info:
        print >>sys.stderr, "%s is not installed" % name
        return
    home = get_vimhome()
    for f in info["files"]:
        f = os.path.join(home, f)
        if os.path.exists(f):
            os.remove(f)
            remove_empty_dir(os.path.dirname(f))
    delete_record(name)
Ejemplo n.º 4
0
def command_metainfo(name):
    """Show meta-info of installed package."""
    info = get_record(name)
    if not info:
        print >>sys.stderr, "%s is not installed" % name
        return
    if 'name' in info:
        print 'Name: %s' % info['name']
    if 'version' in info:
        print 'Version: %s' % info['version']
    if 'description' in info:
        print 'Description: %s' % info['description']
    if 'url' in info:
        print 'URL: %s' % info['url']
    if 'packer' in info:
        print 'Packer: %s' % info['packer']
    if 'requires' in info:
        print 'Requires:'
        for r in info['requires']:
            print '  %s' % r
    if 'files' in info:
        print 'Files:'
        for f in info['files']:
            print '  %s' % f