mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-05 21:21:49 +02:00
Compare commits
2 commits
12e3762d4f
...
f4c2c87072
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f4c2c87072 | ||
![]() |
fa797c8a8d |
1 changed files with 39 additions and 12 deletions
51
dodo.py
51
dodo.py
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue