Exemplo n.º 1
0
    (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:
            update_db = client.checkOutDB()
            if update_db[0]:
                print ' - Trying to update local db from: %s' % client.remote_db, client.checkOutDB()[1]
            else:
Exemplo n.º 2
0
    (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:
            update_db = client.checkOutDB()
            if update_db[0]:
                print ' - Trying to update local db from: %s' % client.remote_db, client.checkOutDB()[1]
            else:
Exemplo n.º 3
0
# 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
    print ' - Trying to update package "yali" score:'
    print '   ', server.updatePackageScore('yali', 5)[1]
    print
    print ' - Trying to get score for package "yali":'
    print '   ', client.getPackageScore('yali')
Exemplo n.º 4
0
# 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
    print ' - Trying to update package "yali" score:'
    print '   ', server.updatePackageScore('yali', 5)[1]
    print
    print ' - Trying to get score for package "yali":'
    print '   ', client.getPackageScore('yali')