Compare commits

..

1 commit

Author SHA1 Message Date
Alex Pyrgiotis
12e3762d4f
WIP: Doit automation 2024-11-25 18:09:04 +02:00

51
dodo.py
View file

@ -2,7 +2,6 @@ import json
import os
import platform
import shutil
import subprocess
from pathlib import Path
from doit import task_params
@ -88,8 +87,17 @@ def task_container_runtime():
}
def task_macos_check_cert():
"""Test that the macOS developer certificate can be used."""
return {
"actions": [
"xcrun notarytool history --apple-id %(apple_id)s --keychain-profile dz-notarytool-release-key"
],
"params": [PARAM_APPLE_ID],
}
def task_system_checks():
"""Common status checks for a system."""
return {
"actions": None,
"task_dep": [
@ -99,58 +107,23 @@ def task_system_checks():
}
def task_macos_check_cert():
"""Test that the Apple developer certificate can be used."""
return {
"actions": [
"xcrun notarytool history --apple-id %(apple_id)s --keychain-profile dz-notarytool-release-key"
],
"params": [PARAM_APPLE_ID],
}
def task_macos_check_docker_containerd():
"""Test that Docker uses the containard image store."""
def check_containerd_store():
cmd = ["docker", "info", "-f", "{{ .DriverStatus }}"]
driver = subprocess.check_output(cmd).strip()
if driver != "[[driver-type io.containerd.snapshotter.v1]]":
raise RuntimeError(
f"Probing the Docker image store with {cmd} returned {driver}."
" Switch to Docker's containerd image store from the Docker Desktop"
" settings."
)
return {
"actions": [
"which docker",
"docker ps",
check_containerd_store,
],
"params": [PARAM_APPLE_ID],
}
def task_macos_system_checks():
"""Run macOS specific system checks, as well as the generic ones."""
return {
"actions": None,
"task_dep": [
"system_checks",
"macos_check_cert",
"macos_check_docker_containerd",
],
}
def task_tessdata():
"""Download Tesseract data"""
def task_download_tessdata():
tessdata_dir = Path("share") / "tessdata"
langs = json.loads(open(tessdata_dir.parent / "ocr-languages.json").read()).values()
targets = [tessdata_dir / f"{lang}.traineddata" for lang in langs]
targets.append(tessdata_dir)
return {
"actions": ["python install/common/download-tessdata.py"],
"actions": [["python", "install/common/download-tessdata.py"]],
"file_dep": [
"install/common/download-tessdata.py",
"share/ocr-languages.json",