Skip to main content

Auto-update an application on Python

Project description

cxupdater

The library for making updates package and the auto-update based on cx_Freeze.

Installation

Install the current version with PyPI:

pip install cxupdater

Or from Github:

pip install https://github.com/oleg-sung/cxupdater/archive/main.zip

Usage

  1. Create the update package using Executable from cx_Freeze and setup from cxupdater:
     from cxupdater import setup
     from cx_Freeze import Executable
     
     
     windows = Executable(
         'test.py',
         target_name='TestApp',
         icon='some_icon.ico'
     )
    
     setup(
         name='TestApp',
         version='1.0.1',
         options={
            'build_update': {
                "optimize": 2,
             }
         },
         executables=[windows]
         )
    
    Use build_update command with setup. The command build_update supports the same params build_exe from cx_Freeze.
    python setup.py build_update
    
    During the execution of the command, a zip archive will be created containing an intermediate executable file for launching the main application and Updater.exe to update the application automatically.
  2. Use the generate_toml -p path\to\folder\contains\update\packages -u https://example.com(your ftp update server) command or create a .toml with the same name as the application, for example TestApp.toml with the following contents:
    [cxupdater.package.x32] # or x64 
    
    name = "TestApp-1.0.0.win32"  
    version = "1.0.1"
    url = "https://example/TestApp-1.0.1.win32.zip"
    
    Where there are:
    • name: The name includes an app's name, version and arch prefix.
    • version: Version of the app
    • url: The url for downloading update package
  3. Move TestApp.toml and TestApp-1.0.0.win32.zip to https://example/ (your ftp server for publishing an updates)
  4. In the code application, create an instance of the update by providing the URL to the file.toml, the current version of the application, implements the delegate of the CxDelegateInterface interface.
    from cxupdater import CxUpdater, CxDelegateInterface
    
    
    class Delegate(CxDelegateInterface):
    
         def do_processing_update(self, message: dict) -> None:
             pass
    
         def do_not_found_update(self, message: dict) -> None:
             pass
    
         def do_error_update(self, message: dict) -> None:
             pass
    
         def do_exited_update(self, message: dict) -> None:
             pass
    
         def do_finished_update(self, message: dict) -> None:
             pass
    
         def do_start_update(self, message: dict) -> None:
             pass
    
    delegate = Delegate()
    updater = CxUpdater('https://example/TestApp.toml', '1.0.0', delegate)
    updater.do_auto_updater()
    
    the do_auto_updater() method starts the process of searching for updates. If an update has been found, run Updater.exe with a UAC request and the transmission of the url for downloading and installing the update package. After that, the Updater will inform us about the update progress using delegate methods. If no update was found, do_auto_updater() returns the status Not found.

Contributing

Bug reports and/or pull requests are welcome

License

The module is available as open source under the terms of the Apache License, Version 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cxupdater-0.3.1.dev0.tar.gz (34.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cxupdater-0.3.1.dev0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file cxupdater-0.3.1.dev0.tar.gz.

File metadata

  • Download URL: cxupdater-0.3.1.dev0.tar.gz
  • Upload date:
  • Size: 34.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for cxupdater-0.3.1.dev0.tar.gz
Algorithm Hash digest
SHA256 94b60d06b72afab04835485dfa8d773b883ed8cbee195dc20219112ef57f843f
MD5 62a2520ca7658a6cbc8e9c18485aefdd
BLAKE2b-256 80b32727c5d1be4ab868a83ddf75b7230e0346f3af5061221e5af1198a6108bc

See more details on using hashes here.

File details

Details for the file cxupdater-0.3.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: cxupdater-0.3.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for cxupdater-0.3.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 54287f8a4018a2cad986beb177f3e3f62bb97f75bff7798d8b1ed03e6299d0a4
MD5 1d8f6f7074d4773c4e57e006584d50c4
BLAKE2b-256 ca8cf37f195dd32d67b638e82bc07705557da6fda0ce810e00d6a20f4a8071cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page