PyUpdater 基于 pyinstall 的第三方自动升级包

PyUpdater 基于 pyinstall 的第三方自动升级包

什么是 PyUpdater ?

一个简单的 python 自动升级库,安全高效的 app 升级应用。

特点

  • 简单安装

  • CI/CD 支持

  • 基础自动升级

  • EdDSA 支持

  • 科学安全的在线升级

  • 稳定发布渠道

如何使用

安装

$ pip install --upgrade PyUpdater

命令

archive

usage: pyupdater archive [opts] filename

optional arguments:
 -h, --help            show this help message and exit
 --name NAME           Name used when renaming binary before archiving.
 --version VERSION     Version of file
 -k, --keep            Will not delete source file after archiving

存档命令将存档应用程序使用的外部资源,从而使你的应用得到更新。

例子:

$ pyupdater archive --name ffmpeg --version 2.1.4

$ pyupdater archive --name ffmpeg --version 2.2

build

usage: pyupdater build [opts]<script>

optional arguments:
 -h, --help            show this help message and exit
 --archive-format {zip,gztar,bztar,default}
 --clean               Clean build. Bypass the cache
 --app-version APP_VERSION
 -k, --keep            Will not delete executable after archiving
 --pyinstaller-log-info
                       Prints PyInstaller execution info to consoleconsole

build 命令包装并使用 pyinstall 来创建最终可使用的执行文件。所有的选项都将传递给 pyinstall。构建后,可执行文件以 pyupdater 兼容的格式存档,并放置在 pyu-data/new 目录。如果你提供带有 alpha 或者 beta 标签的版本号,在处理中,此文件将放在相应的发布频道。注意这个修复仅仅用在稳定的发布频道。

例子:

# Build from python script
$ pyupdater build -F --app-version 1.0 app.py

# Build from spec file (see Make Spec on how to create spec files)
$ pyupdater build --app-version 1.2 app.spec

# Beta channel
$ pyupdater build --app-version 1.2beta2

Clean

usage: pyupdater clean [-h] [-y]

optional arguments:
 -h, --help  show this help message and exit
 -y, --yes   Confirms removal of pyu-data & .pyupdater folder

移除 pyupdater 使用痕迹。

例子:

$ pyupdater clean

Collect Debug Info

usage: pyupdater collect-debug-info [-h]

optional arguments:
 -h, --help  show this help message and exit

上传 debug 日志 ,从 pyupdater 命令界面。

例子:

$ pyupdater collect-debug-info

Init

usage: pyupdater init [-h]

optional arguments:
 -h, --help            show this help message and exit

初始化 pyupdater 。你需要描述几个关于应用的问题。一旦完成一个配置目录一个数据目录,一个 client_config.py 文件将被创建。它将安全的删除你需要删除的文件。你可以随时升级更新创建的 client_config.py 文件。

例子:

$ pyupdater init

Keys

usage: pyupdater keys [-h] [-i] [-c] [-y]

optional arguments:
 -h, --help    show this help message and exit
 -i, --import  Imports a keypack from the current working directory
 -c, --create  Creates keypack. Should only be used on your off-line machine
 -y, --yes     Will run command without conformation prompt

keys命令用于创建和导入 keypack 文件。建议在离线计算机上创建密钥。Keypack 文件包含对 pyupdater 使用的元数据文件进行加密签名的密钥。可以根据需要多次创建和导入密钥。通常只有在开发机器出现问题时才需要。

例子:

# Create
$ pyupdater keys --create

# Once you initialized your repo & copied the keypack to the root of the repo.
$ pyupdater keys --import

Make Spec

usage: pyupdater make-spec <script> [opts]

optional arguments:
 -h, --help            show this help message and exit
 --pyinstaller-log-info
                       Prints PyInstaller execution info to console

用于创建与 pyupdater 兼容的 spec 文件。

例子:

$ pyupdater make-spec app.py

Pkg

usage: pyupdater pkg [-h] [-p] [-s] [--split-version] [-v]

optional arguments:
 -h, --help         show this help message and exit
 -p, -P, --process  Adds update metadata to version file & moves files from
                    the new to deploy directory.
 -s, -S, --sign     Sign version file
 --split-version    Creates a version manifest for the current platform only. For CI/CD
 -v, --verbose      More output messages

Description:

process 标志用于处理包、创建补丁(如果可能)并处理它们和更新包元数据。在处理过程中,我们收集哈希、文件大小、版本和平台信息。一旦完成,归档和修补程序(如果有的话)就会放在deploy目录中。sign 标志对包元数据进行签名,归档元数据并将这些资产放在deploy 目录中。

例子:

# Used to process packages. Usually ran after build or archive command
$ pyupdater pkg -p

# Used to sign meta-data. Can be used anytime.
$ pyupdater pkg -S

Plugins

usage: pyupdater plugins [-h]

optional arguments:

 -h, --help        shows this help message and exit

plugins 命令显示已安装的上传插件和作者名称的列表。

例子:

$ pyupdater plugins

s3 by Digital Sapphire
scp by Digital Sapphire

Settings

usage: pyupdater settings [-h] [--company] [--config-path] [--http-timeout]
                         [--max-download-retries] [--patches]
                         [--plugin PLUGIN] [--show-plugin SHOW_PLUGIN]
                         [--urls]

optional arguments:
 -h, --help            show this help message and exit
 --company             Change company name
 --config-path         Path to place your client config. You'll need to
                       import this file to initialize the update process.
 --http-timeout        Settings the timeout, in seconds, for the
                       FileDownloader
 --max-download-retries
                       Set the max number of times to try a download.
 --patches             Changed patch support
 --plugin PLUGIN       Change the named plugin's settings
 --show-plugin SHOW_PLUGIN
                       Show the name plugin's settings
 --urls                Change update urls

更新当前存储库的配置。

例子:

$ pyupdater settings --urls

$ pyupdater settings --plugin s3

$ pyupdater settings --company

Upload

usage: pyupdater upload [-h] [--keep] [-s SERVICE]

optional arguments:
 -h, --help            show this help message and exit
 --keep                Keep files after upload
 -s SERVICE, --service SERVICE
                       The plugin used for uploads

将部署文件夹中的所有数据上载到所需的远程位置。上传程序有一个插件接口。检查安装页面中的核心插件链接。插件由安装激活。

例子:

# Upload to Amazon S3
$ pyupdater upload --service s3

# Upload to remote server over ssh
$ pyupdater upload --service scp

Help

usage: pyupdater

positional arguments:
 {archive,build,clean,collect-debug-info,init,keys,make-spec,pkg,plugins,settings,upload,version}
                       commands
   archive             Archive an asset which needs updating. Can be another
                       executable, .so, .dll, .img, etc.
   build               Compiles script or spec file
   clean               * WARNING * removes all traces of pyupdater from the
                       current repo
   collect-debug-info  Upload debug logs to github gist and return url.
   init                Initializes a src directory
   keys                Manage signing keys
   make-spec           Creates spec file
   pkg                 Manage creation of file meta-data & signing
   plugins             Shows installed plugins
   settings            Updated config settings
   upload              Uploads files
   version             Show version

optional arguments:
 -h, --help            show this help message and exit

展示帮助信息。

例子:

$ pyupdater -h

$ pyupdater {command} -h
posted @ 2021-01-28 10:58  风水涣  阅读(2338)  评论(1编辑  收藏  举报