コード例 #1
0
ファイル: eagle.py プロジェクト: JianxiangWang/BaiduIntern
        raise PythonVersionException("upload needs python with version 2.7 as it's runtime :(")


if __name__ == "__main__":
    http_service = HttpService()
    upload_manager = UploadManager(http_service)
    try:
        upload_manager.check_py_version()
        if not upload_manager.has_cached_module(VERSION_FILE):
            print "initializing ... :~"
            upload_manager.update(MODULE_ROOT_PATH, UPDATE_HTTP_HOST)
        else:
            try:
                need_update, change_list = upload_manager.need_update(VERSION_FILE,
                                                                      VERSION_HTTP_HOST)
            except CheckVersionException as _:
                need_update = False
            if need_update:
                print "updating ... :~"
                upload_manager.update(MODULE_ROOT_PATH, UPDATE_HTTP_HOST)
                print "eagle has following updates:"
                for index, change in enumerate(change_list):
                    print "%d.%s" % (index + 1, change)
        upload_manager.import_module(MODULE_ROOT_PATH)
        from client import main as MAIN
        MAIN.main()
    except KeyboardInterrupt:
        sys.exit(-1)
    except Exception as ex:
        print str(ex)
コード例 #2
0
ファイル: upload.py プロジェクト: checkking/restfulFramework
            "upload needs python with version 2.7 as it's runtime :(")


if __name__ == "__main__":
    http_service = HttpService()
    upload_manager = UploadManager(http_service)
    try:
        upload_manager.check_py_version()
        if not upload_manager.has_cached_module(VERSION_FILE):
            print "initializing ... :~"
            upload_manager.update(MODULE_ROOT_PATH, UPDATE_HTTP_HOST)
        else:
            try:
                need_update, change_list = upload_manager.need_update(
                    VERSION_FILE, VERSION_HTTP_HOST)
            except CheckVersionException as _:
                need_update = False
            if need_update:
                print "updating ... :~"
                upload_manager.update(MODULE_ROOT_PATH, UPDATE_HTTP_HOST)
                print "upload has following updates:"
                for index, change in enumerate(change_list):
                    print "%d.%s" % (index + 1, change)
        upload_manager.import_module(MODULE_ROOT_PATH)
        from client import main as MAIN
        MAIN.main()
    except KeyboardInterrupt:
        sys.exit(-1)
    except Exception as ex:
        print str(ex)
コード例 #3
0
from client.main import main

main()
コード例 #4
0
from client import main

main.main(True)
コード例 #5
0
ファイル: launch.py プロジェクト: Xevion/tcp-chat
import sys

from faker import Faker

if __name__ == "__main__":
    arg_count = len(sys.argv) - 1
    if arg_count < 1:
        print(
            'Please provide one argument besides the file describing whether to launch the client or server.'
        )
        print(
            'Client/C/1 to launch the client. Server/S/2 to launch the server.'
        )
    else:
        if str(sys.argv[1]).lower() in ['client', 'c', '1']:
            nick = None
            if arg_count >= 2:
                if sys.argv[2] == 'random':
                    fake = Faker()
                    nick = fake.user_name()
                else:
                    nick = sys.argv[2]

            from client.main import main
            main(nick)
        elif str(sys.argv[1]).lower() in ['server', 's', '2']:
            from server import main
            main.receive()
コード例 #6
0
from client import main

main.main()