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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM