Ejemplo n.º 1
0
    parser.add_option("-s", "--setserver", dest="server", default="",
                      help="set remote appinfo server", action="store", type="string")
    parser.add_option("-u", "--update", default = False, dest="updatedb",
                      help="updates score db", action="store_true")
    (options, args) = parser.parse_args()

    if len(args) > 2:# or (not options.resetdb and len(args) < 2):
        parser.print_usage()
        sys.exit(0)

    clientonly = True
    client = AppInfoClient()

    if any([options.createdb, options.updatepkgdb, options.resetdb, len(args) > 1]):
        clientonly = False
        server = AppInfoServer()
        print ' - Trying to initialize Server DB:', server.initializeDB(options.filename)[1]

    if options.createdb:
        print ' - Trying to create db:' , server.createDB(options.filename or 'appinfo.db')[1]
    if options.updatepkgdb:
        print ' - Trying to update packagelist:', server.updatePackageList()[1]
    if options.resetdb:
        print ' - Trying to reset scores:', server.resetPackageScores()
    if not options.resetdb and len(args) > 1:
        print ' - Trying to update package "%s" score:' % args[0], server.updatePackageScore(args[0], float(args[1]))[1]

    if clientonly:
        if not options.server == '':
            client.setServer(options.server)
        if options.updatedb:
Ejemplo n.º 2
0
    parser.add_option("-s", "--setserver", dest="server", default="",
                      help="set remote appinfo server", action="store", type="string")
    parser.add_option("-u", "--update", default = False, dest="updatedb",
                      help="updates score db", action="store_true")
    (options, args) = parser.parse_args()

    if len(args) > 2:# or (not options.resetdb and len(args) < 2):
        parser.print_usage()
        sys.exit(0)

    clientonly = True
    client = AppInfoClient()

    if any([options.createdb, options.updatepkgdb, options.resetdb, len(args) > 1]):
        clientonly = False
        server = AppInfoServer()
        print ' - Trying to initialize Server DB:', server.initializeDB(options.filename)[1]

    if options.createdb:
        print ' - Trying to create db:' , server.createDB(options.filename or 'appinfo.db')[1]
    if options.updatepkgdb:
        print ' - Trying to update packagelist:', server.updatePackageList()[1]
    if options.resetdb:
        print ' - Trying to reset scores:', server.resetPackageScores()
    if not options.resetdb and len(args) > 1:
        print ' - Trying to update package "%s" score:' % args[0], server.updatePackageScore(args[0], float(args[1]))[1]

    if clientonly:
        if not options.server == '':
            client.setServer(options.server)
        if options.updatedb:
Ejemplo n.º 3
0
# Copyright (C) 2010, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

from appinfo.server import AppInfoServer
from appinfo.client import AppInfoClient

if __name__ == '__main__':

    server = AppInfoServer()
    client = AppInfoClient()

    print
    print ' - Trying to create db:'
    print '   ', server.createDB()[1]
    print
    print ' - Trying to update packagelist:'
    print '   ', server.updatePackageList()[1]
    print
    print ' - Trying to initialize Client DB:'
    print '   ', client.initializeDB()[1]
    print
    print ' - Trying to get score for package "yali":'
    print '   ', client.getPackageScore('yali')
    print
Ejemplo n.º 4
0
# Copyright (C) 2010, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

from appinfo.server import AppInfoServer
from appinfo.client import AppInfoClient

if __name__ == '__main__':

    server = AppInfoServer()
    client = AppInfoClient()

    print
    print ' - Trying to create db:'
    print '   ',server.createDB()[1]
    print
    print ' - Trying to update packagelist:'
    print '   ', server.updatePackageList()[1]
    print
    print ' - Trying to initialize Client DB:'
    print '   ', client.initializeDB()[1]
    print
    print ' - Trying to get score for package "yali":'
    print '   ', client.getPackageScore('yali')
    print