mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
py-mod.mk, py-rules.mk: Split up py-mod.mk in py-mod.mk and py-rules.mk
py-rules.mk is meant to be usable outside of a jw Python module context, just for generating .pyc, for example Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
3ddd952187
commit
fb2f57b7b9
2 changed files with 31 additions and 28 deletions
|
|
@ -14,34 +14,7 @@ install: install-dirs.done install-reg.done
|
|||
clean: py.clean
|
||||
distclean:
|
||||
|
||||
py.clean:
|
||||
$(RM) -f *.done *.pyc
|
||||
/bin/bash $(MOD_SCRIPT_DIR)/scm.sh clean -f __init__.py
|
||||
$(RM) -rf __pycache__
|
||||
|
||||
install-dirs.done:
|
||||
$(INSTALL) -d -m $(PYMODDIRMODE) -o $(PYMODDIROWNER) -g $(PYMODDIRGROUP) $(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_VERSION),3)
|
||||
%.pyc: %.py
|
||||
else
|
||||
__pycache__/%.cpython-37.pyc: %.py
|
||||
endif
|
||||
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
|
||||
|
||||
ifeq ($(PYTHON_VERSION),3)
|
||||
$(PY_INSTALL_DIR_PY)/__pycache__/%.cpython-37.pyc: __pycache__/%.cpython-37.pyc
|
||||
else
|
||||
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
|
||||
endif
|
||||
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
||||
include $(MODDIR)/make/py-rules.mk
|
||||
|
||||
__init__.py: $(PY_INIT_TMPL) $(filter-out __init__.py,$(PY_SRC_PY))
|
||||
if [ "$(PY_INIT_TMPL)" ]; then cat "$(PY_INIT_TMPL)" > $@.tmp; else > $@.tmp; fi
|
||||
|
|
|
|||
30
make/py-rules.mk
Normal file
30
make/py-rules.mk
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
all:
|
||||
|
||||
py.clean:
|
||||
$(RM) -f *.done *.pyc
|
||||
/bin/bash $(MOD_SCRIPT_DIR)/scm.sh clean -f __init__.py
|
||||
$(RM) -rf __pycache__
|
||||
|
||||
install-dirs.done:
|
||||
$(INSTALL) -d -m $(PYMODDIRMODE) -o $(PYMODDIROWNER) -g $(PYMODDIRGROUP) $(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_VERSION),3)
|
||||
%.pyc: %.py
|
||||
else
|
||||
__pycache__/%.cpython-37.pyc: %.py
|
||||
endif
|
||||
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
|
||||
|
||||
ifeq ($(PYTHON_VERSION),3)
|
||||
$(PY_INSTALL_DIR_PY)/__pycache__/%.cpython-37.pyc: __pycache__/%.cpython-37.pyc
|
||||
else
|
||||
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
|
||||
endif
|
||||
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
||||
Loading…
Add table
Add a link
Reference in a new issue