Update appimage step

Fix platform case
Remove icu check from appimage step as ComicTagger is not installed
Add appimagetool to allowed commands
Fix appimage paths
This commit is contained in:
Timmy Welch 2023-04-24 22:59:50 -07:00
parent 14fa70e608
commit f94c9ef857
No known key found for this signature in database
2 changed files with 28 additions and 20 deletions

View File

@ -1,26 +1,33 @@
from __future__ import annotations
import argparse
import os
import pathlib
import stat
import requests
parser = argparse.ArgumentParser()
parser.add_argument("APPIMAGETOOL", default="build/appimagetool-x86_64.AppImage", type=pathlib.Path, nargs="?")
def urlretrieve(url: str, dest: str) -> None:
opts = parser.parse_args()
opts.APPIMAGETOOL = opts.APPIMAGETOOL.absolute()
def urlretrieve(url: str, dest: pathlib.Path) -> None:
resp = requests.get(url)
if resp.status_code == 200:
pathlib.Path(dest).write_bytes(resp.content)
dest.parent.mkdir(parents=True, exist_ok=True)
dest.write_bytes(resp.content)
APPIMAGETOOL = "build/appimagetool-x86_64.AppImage"
if os.path.exists(APPIMAGETOOL):
if opts.APPIMAGETOOL.exists():
raise SystemExit(0)
urlretrieve(
"https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage", APPIMAGETOOL
"https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage", opts.APPIMAGETOOL
)
os.chmod(APPIMAGETOOL, stat.S_IRWXU)
os.chmod(opts.APPIMAGETOOL, stat.S_IRWXU)
if not os.path.exists(APPIMAGETOOL):
if not opts.APPIMAGETOOL.exists():
raise SystemExit(1)

View File

@ -222,7 +222,7 @@ commands =
[testenv:appimage]
description = Generate appimage executable
skip_install = true
platform = Linux
platform = linux
base = {env:tox_env:testenv}
labels =
release
@ -233,20 +233,21 @@ depends =
pyinstaller
deps =
requests
extras =
all
allowlist_externals =
{tox_root}/build/appimagetool-x86_64.AppImage
change_dir = dist
commands_pre =
-python -c 'import shutil; shutil.rmtree("{tox_root}/build/", ignore_errors=True)'
python {tox_root}/build-tools/get_appimage.py {tox_root}/build/appimagetool-x86_64.AppImage
commands =
python -c 'import importlib,platform; importlib.import_module("icu") if platform.system() != "Windows" else ...' # Sanity check for icu
-python -c 'import shutil; shutil.rmtree("./build/", ignore_errors=True)'
python -c 'import shutil,pathlib; shutil.copytree("./dist/comictagger/", "./build/appimage", dirs_exist_ok=True); \
shutil.copy("./comictaggerlib/graphics/app.png", "./build/appimage/app.png"); \
pathlib.Path("./build/appimage/AppRun").symlink_to("comictagger"); \
pathlib.Path("./build/appimage/AppRun.desktop").write_text( \
pathlib.Path("build-tools/ComicTagger.desktop").read_text() \
python -c 'import shutil,pathlib; shutil.copytree("{tox_root}/dist/comictagger/", "{tox_root}/build/appimage", dirs_exist_ok=True); \
shutil.copy("{tox_root}/comictaggerlib/graphics/app.png", "{tox_root}/build/appimage/app.png"); \
pathlib.Path("{tox_root}/build/appimage/AppRun").symlink_to("comictagger"); \
pathlib.Path("{tox_root}/build/appimage/AppRun.desktop").write_text( \
pathlib.Path("{tox_root}/build-tools/ComicTagger.desktop").read_text() \
.replace("/usr/local/share/comictagger/app.png", "app") \
.replace("Exec=comictagger", "Exec=./comictagger"))'
python ./build-tools/get_appimage.py
./build/appimagetool ./build/appimage
.replace("Exec=comictagger", "Exec={tox_root}/comictagger"))'
{tox_root}/build/appimagetool-x86_64.AppImage {tox_root}/build/appimage
[testenv:zip_artifacts]
description = Zip release artifacts