py-defs.mk, py-mod.mk: Add PY_LOCAL_PY(C)
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m17s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m22s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m57s
CI / Packaging test (push) Successful in 0s
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m17s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m22s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m57s
CI / Packaging test (push) Successful in 0s
The meaning of the many PY_XXX variables isn't easy to tell apart, so start renaming some of them. PY_ALL_PY and PY_PYC consistently are now named PY_LOCAL|INSTALL_PY and PY_LOCAL|INSTALL_PYC, depending on whether or not they are intended to be installed. The old PY_INSTALL_PY was renamed to PY_DO_INSTALLL_PY, a move that would be better applied to all boolean variables. I won't try with this commit, however, because a lot of downstream packages depend on PY_UPDATE_INIT_PY and PY_INSTALL_INIT_PY, i.e. without "_DO". Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
5a3355b936
commit
e6e96d64c2
2 changed files with 21 additions and 15 deletions
|
|
@ -3,14 +3,14 @@ include $(JWBDIR)/make/py-version.mk
|
||||||
PY_INSTALL_INIT_PY ?= true
|
PY_INSTALL_INIT_PY ?= true
|
||||||
PY_UPDATE_INIT_PY ?= true
|
PY_UPDATE_INIT_PY ?= true
|
||||||
PY_INSTALL ?= true
|
PY_INSTALL ?= true
|
||||||
PY_INSTALL_REG ?= true
|
PY_DO_INSTALL_REG ?= true
|
||||||
|
|
||||||
ifneq ($(PY_INSTALL),true)
|
ifneq ($(PY_INSTALL),true)
|
||||||
PY_INSTALL_REG = false
|
PY_DO_INSTALL_REG = false
|
||||||
endif
|
endif
|
||||||
PY_INSTALL_PYC ?= true
|
PY_DO_INSTALL_PYC ?= true
|
||||||
ifneq ($(PY_INSTALL_REG),true)
|
ifneq ($(PY_DO_INSTALL_REG),true)
|
||||||
PY_INSTALL_PYC = false
|
PY_DO_INSTALL_PYC = false
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DEVELOPMENT),true)
|
ifeq ($(DEVELOPMENT),true)
|
||||||
|
|
@ -20,13 +20,16 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PY_SRC_PY ?= $(wildcard *.py)
|
PY_SRC_PY ?= $(wildcard *.py)
|
||||||
PY_ALL_PY = $(filter-out __init__.py,$(PY_SRC_PY))
|
PY_LOCAL_PY = $(PY_SRC_PY)
|
||||||
|
PY_INSTALL_PY = $(filter-out __init__.py,$(PY_SRC_PY))
|
||||||
|
|
||||||
ifneq ($(PYTHON_MAJOR),3)
|
ifneq ($(PYTHON_MAJOR),3)
|
||||||
PY_PYC = $(patsubst %.py,%.pyc,$(PY_ALL_PY))
|
PY_LOCAL_PYC = $(patsubst %.py,%.pyc,$(PY_LOCAL_PY))
|
||||||
|
PY_INSTALL_PYC = $(patsubst %.py,%.pyc,$(PY_INSTALL_PY))
|
||||||
else
|
else
|
||||||
PY_CPYTHON_PREFIX := $(shell $(PYTHON) -c "import sys; print('cpython-{}{}'.format(sys.version_info[0],sys.version_info[1]))")
|
PY_CPYTHON_PREFIX := $(shell $(PYTHON) -c "import sys; print('cpython-{}{}'.format(sys.version_info[0],sys.version_info[1]))")
|
||||||
PY_PYC = $(patsubst %.py,__pycache__/%.$(PY_CPYTHON_PREFIX).pyc,$(PY_ALL_PY))
|
PY_LOCAL_PYC = $(patsubst %.py,__pycache__/%.$(PY_CPYTHON_PREFIX).pyc,$(PY_LOCAL_PY))
|
||||||
|
PY_INSTALL_PYC = $(patsubst %.py,__pycache__/%.$(PY_CPYTHON_PREFIX).pyc,$(PY_INSTALL_PY))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(PY_INSTALL_DIR),)
|
ifneq ($(PY_INSTALL_DIR),)
|
||||||
|
|
@ -46,7 +49,10 @@ ifeq ($(PY_INSTALL_DIR_PY),)
|
||||||
endif
|
endif
|
||||||
PY_MOD ?= $(subst /,.,$(PY_INSTALL_MOD))
|
PY_MOD ?= $(subst /,.,$(PY_INSTALL_MOD))
|
||||||
ifeq ($(PY_INSTALL_INIT_PY),true)
|
ifeq ($(PY_INSTALL_INIT_PY),true)
|
||||||
PY_ALL_PY += __init__.py
|
PY_INSTALL_PY += __init__.py
|
||||||
|
PY_LOCAL_PY += __init__.py
|
||||||
|
else ifeq ($(PY_UPDATE_INIT_PY),true)
|
||||||
|
PY_LOCAL_PY += __init__.py
|
||||||
endif
|
endif
|
||||||
PY_INSTALL_DIR_PY ?= $(ENV_PREFIX)$(PY_SITE_PACKAGES_PATH)/$(patsubst .,/,$(PY_INSTALL_MOD))
|
PY_INSTALL_DIR_PY ?= $(ENV_PREFIX)$(PY_SITE_PACKAGES_PATH)/$(patsubst .,/,$(PY_INSTALL_MOD))
|
||||||
else
|
else
|
||||||
|
|
@ -62,12 +68,12 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PY_INSTALL_DIRS ?= $(sort $(PY_INSTALL_DIR_PY) $(PY_INSTALL_DIR_PYC))
|
PY_INSTALL_DIRS ?= $(sort $(PY_INSTALL_DIR_PY) $(PY_INSTALL_DIR_PYC))
|
||||||
PY_INSTALLED_PY = $(addprefix $(PY_INSTALL_DIR_PY)/,$(sort $(PY_ALL_PY)))
|
PY_INSTALLED_PY = $(addprefix $(PY_INSTALL_DIR_PY)/,$(sort $(PY_INSTALL_PY)))
|
||||||
PY_INSTALLED_PY_TYPED = $(addprefix $(PY_INSTALL_DIR_PY)/,$(wildcard py.typed))
|
PY_INSTALLED_PY_TYPED = $(addprefix $(PY_INSTALL_DIR_PY)/,$(wildcard py.typed))
|
||||||
ifeq ($(PY_INSTALL_PYC),true)
|
ifeq ($(PY_DO_INSTALL_PYC),true)
|
||||||
PY_INSTALLED_PYC = $(addprefix $(PY_INSTALL_DIR_PY)/,$(PY_PYC))
|
PY_INSTALLED_PYC = $(addprefix $(PY_INSTALL_DIR_PY)/,$(PY_INSTALL_PYC))
|
||||||
endif
|
endif
|
||||||
ifeq ($(PY_INSTALL_REG),true)
|
ifeq ($(PY_DO_INSTALL_REG),true)
|
||||||
PY_INSTALLED_REG = $(PY_INSTALLED_PY) $(PY_INSTALLED_PYC) $(PY_INSTALLED_PY_TYPED)
|
PY_INSTALLED_REG = $(PY_INSTALLED_PY) $(PY_INSTALLED_PYC) $(PY_INSTALLED_PY_TYPED)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ endif
|
||||||
#leftparen := (
|
#leftparen := (
|
||||||
#PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY))
|
#PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY))
|
||||||
|
|
||||||
all: $(PY_PYC)
|
all: $(PY_LOCAL_PYC)
|
||||||
install: install-dirs.done install-reg.done
|
install: install-dirs.done install-reg.done
|
||||||
clean: invalidate-testability py.clean
|
clean: invalidate-testability py.clean
|
||||||
distclean:
|
distclean:
|
||||||
|
|
@ -34,6 +34,6 @@ ifeq ($(PY_UPDATE_INIT_PY),true)
|
||||||
__init__.py: $(PY_INIT_TMPL) $(filter-out __init__.py,$(PY_SRC_PY))
|
__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
|
if [ "$(PY_INIT_TMPL)" ]; then cat "$(PY_INIT_TMPL)" > $@.tmp; else > $@.tmp; fi
|
||||||
set -e -o pipefail; $(PY_GENERATE_INIT_PY) \
|
set -e -o pipefail; $(PY_GENERATE_INIT_PY) \
|
||||||
$(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp
|
$(filter-out __init__.py,$(PY_LOCAL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue