mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 20:51:49 +02:00
Compare commits
6 commits
7b00d7f03a
...
10be85b9f2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
10be85b9f2 | ||
![]() |
47d732e603 | ||
![]() |
d6451290db | ||
![]() |
f0bb65cb4e | ||
![]() |
0c741359cc | ||
![]() |
8c61894e25 |
6 changed files with 37 additions and 17 deletions
14
Makefile
14
Makefile
|
@ -22,7 +22,7 @@ fix: ## apply all the suggestions from ruff
|
||||||
ruff format
|
ruff format
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: ## Run the tests
|
||||||
# Make each GUI test run as a separate process, to avoid segfaults due to
|
# Make each GUI test run as a separate process, to avoid segfaults due to
|
||||||
# shared state.
|
# shared state.
|
||||||
# See more in https://github.com/freedomofpress/dangerzone/issues/493
|
# See more in https://github.com/freedomofpress/dangerzone/issues/493
|
||||||
|
@ -47,11 +47,11 @@ test-large: test-large-init ## Run large test set
|
||||||
python -m pytest --tb=no tests/test_large_set.py::TestLargeSet -v $(JUNIT_FLAGS) --junitxml=$(TEST_LARGE_RESULTS)
|
python -m pytest --tb=no tests/test_large_set.py::TestLargeSet -v $(JUNIT_FLAGS) --junitxml=$(TEST_LARGE_RESULTS)
|
||||||
python $(TEST_LARGE_RESULTS)/report.py $(TEST_LARGE_RESULTS)
|
python $(TEST_LARGE_RESULTS)/report.py $(TEST_LARGE_RESULTS)
|
||||||
|
|
||||||
Dockerfile: Dockerfile.env Dockerfile.in
|
Dockerfile: Dockerfile.env Dockerfile.in ## Regenerate the Dockerfile from its template
|
||||||
poetry run jinja2 Dockerfile.in Dockerfile.env > Dockerfile
|
poetry run jinja2 Dockerfile.in Dockerfile.env > Dockerfile
|
||||||
|
|
||||||
.PHONY: poetry-install
|
.PHONY: poetry-install
|
||||||
poetry-install:
|
poetry-install: ## Install project dependencies
|
||||||
poetry install
|
poetry install
|
||||||
|
|
||||||
.PHONY: build-clean
|
.PHONY: build-clean
|
||||||
|
@ -59,19 +59,19 @@ build-clean:
|
||||||
poetry run doit clean
|
poetry run doit clean
|
||||||
|
|
||||||
.PHONY: build-macos-intel
|
.PHONY: build-macos-intel
|
||||||
build-macos-intel: build-clean poetry-install
|
build-macos-intel: build-clean poetry-install ## Build macOS intel package (.dmg)
|
||||||
poetry run doit -n 8
|
poetry run doit -n 8
|
||||||
|
|
||||||
.PHONY: build-macos-arm
|
.PHONY: build-macos-arm
|
||||||
build-macos-arm: build-clean poetry-install
|
build-macos-arm: build-clean poetry-install ## Build macOS Apple Silicon package (.dmg)
|
||||||
poetry run doit -n 8 macos_build_dmg
|
poetry run doit -n 8 macos_build_dmg
|
||||||
|
|
||||||
.PHONY: build-linux
|
.PHONY: build-linux
|
||||||
build-linux: build-clean poetry-install
|
build-linux: build-clean poetry-install ## Build linux packages (.rpm and .deb)
|
||||||
poetry run doit -n 8 fedora_rpm debian_deb
|
poetry run doit -n 8 fedora_rpm debian_deb
|
||||||
|
|
||||||
.PHONY: regenerate-reference-pdfs
|
.PHONY: regenerate-reference-pdfs
|
||||||
regenerate-reference-pdfs:
|
regenerate-reference-pdfs: ## Regenerate the reference PDFs
|
||||||
pytest tests/test_cli.py -k regenerate --generate-reference-pdfs
|
pytest tests/test_cli.py -k regenerate --generate-reference-pdfs
|
||||||
# Makefile self-help borrowed from the securedrop-client project
|
# Makefile self-help borrowed from the securedrop-client project
|
||||||
# Explaination of the below shell command should it ever break.
|
# Explaination of the below shell command should it ever break.
|
||||||
|
|
|
@ -4,6 +4,12 @@ import sys
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Call freeze_support() to avoid passing unknown options to the subprocess.
|
||||||
|
# See https://github.com/freedomofpress/dangerzone/issues/873
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
multiprocessing.freeze_support()
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import vendor # type: ignore [attr-defined]
|
from . import vendor # type: ignore [attr-defined]
|
||||||
|
|
|
@ -3,7 +3,6 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import tempfile
|
import tempfile
|
||||||
import typing
|
import typing
|
||||||
from multiprocessing import freeze_support
|
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
@ -228,7 +227,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
if not is_version_valid:
|
if not is_version_valid:
|
||||||
self.handle_docker_desktop_version_check(is_version_valid, version)
|
self.handle_docker_desktop_version_check(is_version_valid, version)
|
||||||
except errors.UnsupportedContainerRuntime as e:
|
except errors.UnsupportedContainerRuntime as e:
|
||||||
pass # It's catched later in the flow.
|
pass # It's caught later in the flow.
|
||||||
|
except errors.NoContainerTechException as e:
|
||||||
|
pass # It's caught later in the flow.
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
@ -1236,9 +1237,6 @@ class DocumentsListWidget(QtWidgets.QListWidget):
|
||||||
def start_conversion(self) -> None:
|
def start_conversion(self) -> None:
|
||||||
if not self.thread_pool_initized:
|
if not self.thread_pool_initized:
|
||||||
max_jobs = self.dangerzone.isolation_provider.get_max_parallel_conversions()
|
max_jobs = self.dangerzone.isolation_provider.get_max_parallel_conversions()
|
||||||
# Call freeze_support() to avoid passing unknown options to the subprocess.
|
|
||||||
# See https://github.com/freedomofpress/dangerzone/issues/873
|
|
||||||
freeze_support()
|
|
||||||
self.thread_pool = ThreadPool(max_jobs)
|
self.thread_pool = ThreadPool(max_jobs)
|
||||||
|
|
||||||
for doc in self.docs_list:
|
for doc in self.docs_list:
|
||||||
|
|
|
@ -56,7 +56,14 @@ class Container(IsolationProvider):
|
||||||
security_args = ["--log-driver", "none"]
|
security_args = ["--log-driver", "none"]
|
||||||
security_args += ["--security-opt", "no-new-privileges"]
|
security_args += ["--security-opt", "no-new-privileges"]
|
||||||
if container_utils.get_runtime_version() >= (4, 1):
|
if container_utils.get_runtime_version() >= (4, 1):
|
||||||
security_args += ["--userns", "nomap"]
|
# We perform a platform check to avoid the following Podman Desktop
|
||||||
|
# error on Windows:
|
||||||
|
#
|
||||||
|
# Error: nomap is only supported in rootless mode
|
||||||
|
#
|
||||||
|
# See also: https://github.com/freedomofpress/dangerzone/issues/1127
|
||||||
|
if platform.system() != "Windows":
|
||||||
|
security_args += ["--userns", "nomap"]
|
||||||
else:
|
else:
|
||||||
security_args = ["--security-opt=no-new-privileges:true"]
|
security_args = ["--security-opt=no-new-privileges:true"]
|
||||||
|
|
||||||
|
@ -67,7 +74,15 @@ class Container(IsolationProvider):
|
||||||
# [1] https://github.com/freedomofpress/dangerzone/issues/846
|
# [1] https://github.com/freedomofpress/dangerzone/issues/846
|
||||||
# [2] https://github.com/containers/common/blob/d3283f8401eeeb21f3c59a425b5461f069e199a7/pkg/seccomp/seccomp.json
|
# [2] https://github.com/containers/common/blob/d3283f8401eeeb21f3c59a425b5461f069e199a7/pkg/seccomp/seccomp.json
|
||||||
seccomp_json_path = str(get_resource_path("seccomp.gvisor.json"))
|
seccomp_json_path = str(get_resource_path("seccomp.gvisor.json"))
|
||||||
security_args += ["--security-opt", f"seccomp={seccomp_json_path}"]
|
# We perform a platform check to avoid the following Podman Desktop
|
||||||
|
# error on Windows:
|
||||||
|
#
|
||||||
|
# Error: opening seccomp profile failed: open
|
||||||
|
# C:\[...]\dangerzone\share\seccomp.gvisor.json: no such file or directory
|
||||||
|
#
|
||||||
|
# See also: https://github.com/freedomofpress/dangerzone/issues/1127
|
||||||
|
if runtime.name == "podman" and platform.system() != "Windows":
|
||||||
|
security_args += ["--security-opt", f"seccomp={seccomp_json_path}"]
|
||||||
|
|
||||||
security_args += ["--cap-drop", "all"]
|
security_args += ["--cap-drop", "all"]
|
||||||
security_args += ["--cap-add", "SYS_CHROOT"]
|
security_args += ["--cap-add", "SYS_CHROOT"]
|
||||||
|
|
|
@ -5,7 +5,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
BUILD_CONTEXT = "dangerzone/"
|
BUILD_CONTEXT = "dangerzone"
|
||||||
IMAGE_NAME = "dangerzone.rocks/dangerzone"
|
IMAGE_NAME = "dangerzone.rocks/dangerzone"
|
||||||
if platform.system() in ["Darwin", "Windows"]:
|
if platform.system() in ["Darwin", "Windows"]:
|
||||||
CONTAINER_RUNTIME = "docker"
|
CONTAINER_RUNTIME = "docker"
|
||||||
|
@ -122,7 +122,8 @@ def main():
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
"./dev_scripts/repro-build.py",
|
sys.executable,
|
||||||
|
str(Path("dev_scripts") / "repro-build.py"),
|
||||||
"build",
|
"build",
|
||||||
"--runtime",
|
"--runtime",
|
||||||
args.runtime,
|
args.runtime,
|
||||||
|
|
|
@ -13,7 +13,7 @@ setup(
|
||||||
description="Dangerzone",
|
description="Dangerzone",
|
||||||
options={
|
options={
|
||||||
"build_exe": {
|
"build_exe": {
|
||||||
"packages": ["dangerzone", "dangerzone.gui"],
|
"packages": ["dangerzone", "dangerzone.gui", "pymupdf._wxcolors"],
|
||||||
"excludes": ["test", "tkinter"],
|
"excludes": ["test", "tkinter"],
|
||||||
"include_files": [("share", "share"), ("LICENSE", "LICENSE")],
|
"include_files": [("share", "share"), ("LICENSE", "LICENSE")],
|
||||||
"include_msvcr": True,
|
"include_msvcr": True,
|
||||||
|
|
Loading…
Reference in a new issue