mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-06 05:31:48 +02:00
Compare commits
1 commit
f4c2c87072
...
12e3762d4f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
12e3762d4f |
1 changed files with 12 additions and 39 deletions
51
dodo.py
51
dodo.py
|
@ -2,7 +2,6 @@ import json
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from doit import task_params
|
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():
|
def task_system_checks():
|
||||||
"""Common status checks for a system."""
|
|
||||||
return {
|
return {
|
||||||
"actions": None,
|
"actions": None,
|
||||||
"task_dep": [
|
"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():
|
def task_macos_system_checks():
|
||||||
"""Run macOS specific system checks, as well as the generic ones."""
|
|
||||||
return {
|
return {
|
||||||
"actions": None,
|
"actions": None,
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
"system_checks",
|
"system_checks",
|
||||||
"macos_check_cert",
|
"macos_check_cert",
|
||||||
"macos_check_docker_containerd",
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def task_tessdata():
|
def task_download_tessdata():
|
||||||
"""Download Tesseract data"""
|
|
||||||
tessdata_dir = Path("share") / "tessdata"
|
tessdata_dir = Path("share") / "tessdata"
|
||||||
langs = json.loads(open(tessdata_dir.parent / "ocr-languages.json").read()).values()
|
langs = json.loads(open(tessdata_dir.parent / "ocr-languages.json").read()).values()
|
||||||
targets = [tessdata_dir / f"{lang}.traineddata" for lang in langs]
|
targets = [tessdata_dir / f"{lang}.traineddata" for lang in langs]
|
||||||
targets.append(tessdata_dir)
|
targets.append(tessdata_dir)
|
||||||
return {
|
return {
|
||||||
"actions": ["python install/common/download-tessdata.py"],
|
"actions": [["python", "install/common/download-tessdata.py"]],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
"install/common/download-tessdata.py",
|
"install/common/download-tessdata.py",
|
||||||
"share/ocr-languages.json",
|
"share/ocr-languages.json",
|
||||||
|
|
Loading…
Reference in a new issue