diff --git a/build_image.py b/build_image.py index 6f9062a76..8385ab700 100644 --- a/build_image.py +++ b/build_image.py @@ -254,6 +254,7 @@ def create_dockerfile_base(config: OfrakImageConfig) -> str: def create_dockerfile_finish(config: OfrakImageConfig) -> str: full_base_image_name = "/".join((config.registry, config.base_image_name)) dockerfile_finish_parts = [ + "# syntax = docker/dockerfile:1.3\n\n", f"FROM {full_base_image_name}:{config.image_revision}\n\n", f"ARG OFRAK_SRC_DIR=/\n", ] @@ -273,13 +274,18 @@ def create_dockerfile_finish(config: OfrakImageConfig) -> str: "\\n", ] ) - dockerfile_finish_parts.append(f'RUN printf "{develop_makefile}" >> Makefile\n') - dockerfile_finish_parts.append("RUN make $INSTALL_TARGET\n\n") + dockerfile_finish_parts += [ + f'RUN printf "{develop_makefile}" >> Makefile\n' + '# We use --network="none" to ensure all dependencies were installed in base.Dockerfile\n', + 'RUN --network="none" make $INSTALL_TARGET\n\n', + ] test_names = " ".join([f"test_{package_name}" for package_name in package_names]) finish_makefile = "\\n\\\n".join( [ - ".PHONY: test " + test_names, - "test: " + test_names, + ".PHONY: test inspect" + test_names, + "inspect:", + "\tpython3 -m pip check", + "test: inspect" + test_names, ] + [ f"test_{package_name}:\\n\\\n\t\\$(MAKE) -C {package_name} test" diff --git a/disassemblers/ofrak_angr/Makefile b/disassemblers/ofrak_angr/Makefile index fb8cc4b83..4a09b1268 100644 --- a/disassemblers/ofrak_angr/Makefile +++ b/disassemblers/ofrak_angr/Makefile @@ -7,7 +7,9 @@ install: .PHONY: develop develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] .PHONY: inspect inspect: diff --git a/disassemblers/ofrak_binary_ninja/Makefile b/disassemblers/ofrak_binary_ninja/Makefile index e9c3f30a7..5d45dbc60 100644 --- a/disassemblers/ofrak_binary_ninja/Makefile +++ b/disassemblers/ofrak_binary_ninja/Makefile @@ -7,7 +7,9 @@ install: .PHONY: develop develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] .PHONY: inspect inspect: diff --git a/disassemblers/ofrak_capstone/Makefile b/disassemblers/ofrak_capstone/Makefile index 88e4cfe32..0ca3f9de7 100644 --- a/disassemblers/ofrak_capstone/Makefile +++ b/disassemblers/ofrak_capstone/Makefile @@ -7,7 +7,9 @@ install: .PHONY: develop develop: - $(PIP) install --pre -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install --pre -e .[test] .PHONY: inspect inspect: diff --git a/disassemblers/ofrak_ghidra/Makefile b/disassemblers/ofrak_ghidra/Makefile index dc78fcc47..d24276e80 100644 --- a/disassemblers/ofrak_ghidra/Makefile +++ b/disassemblers/ofrak_ghidra/Makefile @@ -5,7 +5,9 @@ install: $(PIP) install . develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] test: $(PYTHON) -m pytest --cov=ofrak_ghidra --cov-report=term-missing ofrak_ghidra_test diff --git a/ofrak_core/Makefile b/ofrak_core/Makefile index 847b3cdd3..113f0248b 100644 --- a/ofrak_core/Makefile +++ b/ofrak_core/Makefile @@ -7,7 +7,9 @@ install: ofrak/gui/public .PHONY: develop develop: ofrak/gui/public - $(PIP) install -e .[docs,test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[docs,test] .PHONY: inspect inspect: diff --git a/ofrak_io/Makefile b/ofrak_io/Makefile index f49e49397..e6be10d3a 100644 --- a/ofrak_io/Makefile +++ b/ofrak_io/Makefile @@ -7,7 +7,9 @@ install: .PHONY: develop develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] .PHONY: inspect inspect: diff --git a/ofrak_patch_maker/Makefile b/ofrak_patch_maker/Makefile index 5466c18f7..eb6e14aa9 100644 --- a/ofrak_patch_maker/Makefile +++ b/ofrak_patch_maker/Makefile @@ -8,7 +8,9 @@ install: .PHONY: develop develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] .PHONY: inspect inspect: diff --git a/ofrak_tutorial/Makefile b/ofrak_tutorial/Makefile index d1e70c727..4603cbcbd 100644 --- a/ofrak_tutorial/Makefile +++ b/ofrak_tutorial/Makefile @@ -29,7 +29,9 @@ run: .PHONY: develop develop: - ${PIP} install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" ${PIP} install -e .[test] make generate_stripped_notebooks .PHONY: install diff --git a/ofrak_type/Makefile b/ofrak_type/Makefile index f448930ce..c009cd954 100644 --- a/ofrak_type/Makefile +++ b/ofrak_type/Makefile @@ -7,7 +7,9 @@ install: .PHONY: develop develop: - $(PIP) install -e .[test] --config-settings editable_mode=compat + # Legacy-edinable is needed to allow mypy to find packages. + # See https://github.com/python/mypy/issues/13392 + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" $(PIP) install -e .[test] .PHONY: inspect inspect: