mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 09:52:37 +02:00

The files in `container/` no longer make sense to have that name since the "document to pixels" part will run in Qubes OS in its own virtual machine. To adapt to this, this PR does the following: - Moves all the files in `container` to `dangerzone/conversion` - Splits the old `container/dangerzone.py` into its two components `dangerzone/conversion/{doc_to_pixels,pixels_to_pdf}.py` with a `common.py` file for shared functions - Moves the Dockerfile to the project root and adapts it to the new container code location - Updates the CircleCI config to properly cache Docker images. - Updates our install scripts to properly build Docker images. - Adds the new conversion module to the container image, so that it can be imported as a package. - Adapts the container isolation provider to use the new way of calling the code. NOTE: We have made zero changes to the conversion code in this commit, except for necessary imports in order to factor out some common parts. Any changes necessary for Qubes integration follow in the subsequent commits.
56 lines
1.9 KiB
Makefile
56 lines
1.9 KiB
Makefile
.PHONY: lint-black
|
|
lint-black: ## check python source code formatting issues, with black
|
|
black --check --diff --exclude dev_scripts/envs ./
|
|
|
|
.PHONY: lint-black-apply
|
|
lint-black-apply: ## apply black's source code formatting suggestions
|
|
black --exclude dev_scripts/envs ./
|
|
|
|
.PHONY: lint-isort
|
|
lint-isort: ## check imports are organized, with isort
|
|
isort --check-only --skip dev_scripts/envs ./
|
|
|
|
.PHONY: lint-isort-apply
|
|
lint-isort-apply: ## apply isort's imports organization suggestions
|
|
isort --skip dev_scripts/envs ./
|
|
|
|
MYPY_ARGS := --ignore-missing-imports \
|
|
--disallow-incomplete-defs \
|
|
--disallow-untyped-defs \
|
|
--show-error-codes \
|
|
--warn-unreachable \
|
|
--warn-unused-ignores
|
|
|
|
mypy-host:
|
|
mypy $(MYPY_ARGS) dangerzone
|
|
|
|
mypy-tests:
|
|
mypy $(MYPY_ARGS) tests
|
|
|
|
mypy: mypy-host mypy-tests ## check type hints with mypy
|
|
|
|
.PHONY: lint
|
|
lint: lint-black lint-isort mypy ## check the code with various linters
|
|
|
|
.PHONY: lint-apply
|
|
lint-apply: lint-black-apply lint-isort-apply ## apply all the linter's suggestions
|
|
|
|
.PHONY: test
|
|
test:
|
|
python ./dev_scripts/pytest-wrapper.py -v --cov --ignore dev_scripts
|
|
|
|
# Makefile self-help borrowed from the securedrop-client project
|
|
# Explaination of the below shell command should it ever break.
|
|
# 1. Set the field separator to ": ##" and any make targets that might appear between : and ##
|
|
# 2. Use sed-like syntax to remove the make targets
|
|
# 3. Format the split fields into $$1) the target name (in blue) and $$2) the target descrption
|
|
# 4. Pass this file as an arg to awk
|
|
# 5. Sort it alphabetically
|
|
# 6. Format columns with colon as delimiter.
|
|
.PHONY: help
|
|
help: ## Print this message and exit.
|
|
@printf "Makefile for developing and testing dangerzone.\n"
|
|
@printf "Subcommands:\n\n"
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z_-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) \
|
|
| sort \
|
|
| column -s ':' -t
|