Example #1
0
def main():
    if len(sys.argv) != 2:
        usage()

    local = False
    remote = False

    if sys.argv[1] in ('-r', '--remote'):
        remote = True

    elif sys.argv[1] in ('-l', '--local'):
        local  = True

    elif sys.argv[1] in ('-a', '--all'):
        remote = True
        local  = True
    else:
        usage()

    chanko = Chanko()
    if remote:
        chanko.remote_cache.refresh()

    if local:
        chanko.local_cache.refresh()
Example #2
0
            nodeps = True

    if len(args) == 0:
        usage()

    if force and pretend:
        usage("conflicting options: --force, --pretend")

    packages = set()
    for arg in args:
        if os.path.exists(arg):
            packages.update(parse_inputfile(arg))
        else:
            packages.add(arg)

    chanko = Chanko()
    candidates = chanko.get_package_candidates(packages, nodeps)

    if len(candidates) == 0:
        print "Nothing to get..."
        return

    bytes = 0
    for candidate in candidates:
        bytes += candidate.bytes
        print candidate.filename

    print "Amount of packages: %i" % len(candidates)
    print "Need to get %s of archives" % format_bytes(bytes)

    if pretend:
Example #3
0
            print "aborted by user"
            return False

    print "Deleting..."
    for candidate in candidates:
        os.remove(candidate)

    return True


def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], ":f", ['force'])
    except getopt.GetoptError, e:
        usage(e)

    force = False
    for opt, val in opts:
        if opt in ('-f', '--force'):
            force = True

    chanko = Chanko()
    purged = purge(chanko.archives, force)

    if purged:
        chanko.local_cache.refresh()


if __name__ == "__main__":
    main()