예제 #1
0
def main():
    print(VERSION)
    data_dir = None
    config = client_config.ClientConfig()
    if getattr(config, 'USE_CUSTOM_DIR', False):
        if (sys.platform == 'darwin' and os.path.dirname(sys.executable
                                                         ).endswith('MacOS')):
            data_dir = os.path.join(get_mac_dot_app_dir(os.path.dirname(
                sys.executable)), '.update')
        else:
            data_dir = os.path.join(os.path.dirname(os.path.dirname(
                sys.executable)), '.update')
    client = Client(config,
                    refresh=True, progress_hooks=[cb],
                    data_dir=data_dir)
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        success = update.download()
        print('')
        if success is True:
            print('Update download successful')
            print('Extracting & overwriting')
            update.extract_overwrite()
        else:
            print('Failed to download update')
    return VERSION
예제 #2
0
def main():
    print(VERSION)
    data_dir = None
    config = client_config.ClientConfig()
    if getattr(config, "USE_CUSTOM_DIR", False):
        if sys.platform == "darwin" and os.path.dirname(
                sys.executable).endswith("MacOS"):
            data_dir = os.path.join(
                get_mac_dot_app_dir(os.path.dirname(sys.executable)),
                ".update")
        else:
            data_dir = os.path.join(
                os.path.dirname(os.path.dirname(sys.executable)), ".update")
    client = Client(config,
                    refresh=True,
                    progress_hooks=[cb],
                    data_dir=data_dir)
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        success = update.download()
        print("")
        if success is True:
            print("Update download successful")
            print("Extracting & overwriting")
            update.extract_overwrite()
        else:
            print("Failed to download update")
    return VERSION
예제 #3
0
def main():
    print(VERSION)
    data_dir = None
    config = client_config.ClientConfig()
    if getattr(config, 'USE_CUSTOM_DIR', False):
        print("Using custom directory")
        if (sys.platform == 'darwin' and os.path.dirname(sys.executable
                                                         ).endswith('MacOS')):
            data_dir = os.path.join(get_mac_dot_app_dir(os.path.dirname(
                sys.executable)), '.update')
        else:
            data_dir = os.path.join(os.path.dirname(sys.executable), '.update')
    client = Client(config, refresh=True,
                    progress_hooks=[cb], data_dir=data_dir)
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        print("We have an update")
        retry_count = 0
        while retry_count < 5:
            success = update.download()
            if success is True:
                break
            print("Retry Download. Count {}".format(retry_count + 1))
            retry_count += 1

        if success:
            print('Update download successful')
            print('Restarting')
            update.extract_restart()
        else:
            print('Failed to download update')

    print("Leaving main()")
예제 #4
0
파일: app2.py 프로젝트: vvarp/PyUpdater
def main():
    print(VERSION)
    client = Client(client_config.ClientConfig(), refresh=True)
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        update.download()
        update.extract_overwrite()

    return VERSION
예제 #5
0
def main():
    print(VERSION)
    client = Client(client_config.ClientConfig(),
                    refresh=True, progress_hooks=[cb])
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        success = update.download()
        if success is True:
            print('Update download successful')
            print('Restarting')
            update.extract_overwrite()
        else:
            print('Failed to download update')
    return VERSION
예제 #6
0
def main():
    print(VERSION)
    data_dir = None
    config = client_config.ClientConfig()
    if getattr(config, 'USE_CUSTOM_DIR', False):
        data_dir = os.path.join(os.path.dirname(sys.executable), '.update')
    client = Client(config,
                    refresh=True,
                    progress_hooks=[cb],
                    data_dir=data_dir)
    update = client.update_check(APPNAME, VERSION)
    if update is not None:
        success = update.download()
        if success is True:
            print('Update download successful')
            print('Restarting')
            update.extract_overwrite()
        else:
            print('Failed to download update')
    return VERSION