jw-pkg/make/py-rules.mk
Jan Lindemann 8a2cd02ac7
py-defs.mk / py-rules.mk: install py.typed

If $(wildcard py.typed) is found in a python module directory, install it. py.typed should be used by every repo that declares properly typed code, for jw-pkg that would be at the jw.pkg node, i.e installed to <site-dir>/jw/jw-pkg/py.typed.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-05-31 18:20:32 +02:00

36 lines
1 KiB
Makefile

all:
py.clean:
$(RM) -f *.done *.pyc *.rep
/bin/bash $(JWB_SCRIPT_DIR)/scm.sh clean -f __init__.py
$(RM) -rf __pycache__ .mypy_cache
install-dirs.done:
$(INSTALL) -d -m $(PYJWBDIRMODE) -o $(PYJWBDIROWNER) -g $(PYJWBDIRGROUP) $(PY_INSTALL_DIRS)
touch $@
install-reg.done: install-dirs.done $(PY_INSTALLED_REG)
touch $@
$(PY_INSTALL_DIR_PY)/%.py: %.py
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
ifneq ($(PYTHON_MAJOR),3)
%.pyc: %.py
else
__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: %.py
endif
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
ifeq ($(PYTHON_MAJOR),3)
$(PY_INSTALL_DIR_PY)/__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: __pycache__/%.$(PY_CPYTHON_PREFIX).pyc
else
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
endif
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
check:
$(PY_MYPY) $(shell /bin/bash $(JWB_SCRIPT_DIR)/scm.sh ls-files | grep '\.py$$')
$(PY_INSTALL_DIR_PY)/py.typed: py.typed
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@