mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-24 14:50:38 +01:00
py-xxx.mk: Introduce PYTHON_MAJOR
Where *.pyc files are created is decided by PYTHON_MAJOR, not PYTHON_VERSION, so introduce it. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
15f39de08f
commit
a82fa9023b
2 changed files with 5 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ ifeq ($(PYTHON),)
|
||||||
else
|
else
|
||||||
PYTHON_VERSION ?= $(patsubst python%,%,$(notdir $(PYTHON)))
|
PYTHON_VERSION ?= $(patsubst python%,%,$(notdir $(PYTHON)))
|
||||||
endif
|
endif
|
||||||
|
PYTHON_MAJOR = $(basename $(PYTHON_VERSION))
|
||||||
|
|
||||||
ifeq ($(DEVELOPMENT),true)
|
ifeq ($(DEVELOPMENT),true)
|
||||||
PY_SITE_PACKAGES_PATH := $(PREFIX)/python$(PYTHON_VERSION)/site-packages
|
PY_SITE_PACKAGES_PATH := $(PREFIX)/python$(PYTHON_VERSION)/site-packages
|
||||||
|
|
@ -26,7 +27,7 @@ PY_MYPY ?= mypy --ignore-missing-imports
|
||||||
PY_SRC_PY ?= $(wildcard *.py)
|
PY_SRC_PY ?= $(wildcard *.py)
|
||||||
PY_ALL_PY = $(PY_SRC_PY)
|
PY_ALL_PY = $(PY_SRC_PY)
|
||||||
|
|
||||||
ifneq ($(PYTHON_VERSION),3)
|
ifneq ($(PYTHON_MAJOR),3)
|
||||||
PY_PYC = $(patsubst %.py,%.pyc,$(PY_ALL_PY))
|
PY_PYC = $(patsubst %.py,%.pyc,$(PY_ALL_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]))")
|
||||||
|
|
@ -55,7 +56,7 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PYTHON_VERSION),3)
|
ifeq ($(PYTHON_MAJOR),3)
|
||||||
PY_INSTALL_DIR_PYC ?= $(PY_INSTALL_DIR_PY)/__pycache__
|
PY_INSTALL_DIR_PYC ?= $(PY_INSTALL_DIR_PY)/__pycache__
|
||||||
else
|
else
|
||||||
PY_INSTALL_DIR_PYC ?= $(PY_INSTALL_DIR_PY)
|
PY_INSTALL_DIR_PYC ?= $(PY_INSTALL_DIR_PY)
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ install-reg.done: install-dirs.done $(PY_INSTALLED_REG)
|
||||||
$(PY_INSTALL_DIR_PY)/%.py: %.py
|
$(PY_INSTALL_DIR_PY)/%.py: %.py
|
||||||
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
||||||
|
|
||||||
ifneq ($(PYTHON_VERSION),3)
|
ifneq ($(PYTHON_MAJOR),3)
|
||||||
%.pyc: %.py
|
%.pyc: %.py
|
||||||
else
|
else
|
||||||
__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: %.py
|
__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: %.py
|
||||||
endif
|
endif
|
||||||
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
|
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
|
||||||
|
|
||||||
ifeq ($(PYTHON_VERSION),3)
|
ifeq ($(PYTHON_MAJOR),3)
|
||||||
$(PY_INSTALL_DIR_PY)/__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: __pycache__/%.$(PY_CPYTHON_PREFIX).pyc
|
$(PY_INSTALL_DIR_PY)/__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: __pycache__/%.$(PY_CPYTHON_PREFIX).pyc
|
||||||
else
|
else
|
||||||
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
|
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue