Compare commits

..

2 commits

Author SHA1 Message Date
Alex Pyrgiotis
f4c2c87072
WIP: Fix doit for macOS 2024-11-25 20:52:46 +02:00
Alex Pyrgiotis
fa797c8a8d
WIP: Doit automation 2024-11-25 20:45:19 +02:00

51
dodo.py
View file

@ -2,6 +2,7 @@ import json
import os
import platform
import shutil
import subprocess
from pathlib import Path
from doit import task_params
@ -87,17 +88,8 @@ 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": [
@ -107,23 +99,58 @@ 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_download_tessdata():
def task_tessdata():
"""Download Tesseract data"""
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",