py-defs/py-mod.mk: Fix __init__.py generation

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-07-25 15:04:44 +00:00
commit 3f782d3f3f
3 changed files with 8 additions and 5 deletions

View file

@ -19,4 +19,3 @@ proj_query_cmd = $(PYTHON) $(MOD_SCRIPT_DIR)/projects.py -p $(PROJECTS_D
proj_query = $(shell $(proj_query_cmd) $(1)) proj_query = $(shell $(proj_query_cmd) $(1))
proj_dir = $(call proj_query,proj-dir $(1)) proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1)) htdocs_dir = $(call proj_query,htdocs-dir $(1))

View file

@ -12,8 +12,9 @@ PY_PROJ_MODULE_DIRS ?= $(wildcard $(foreach subdir,/tools/python /src/python,$(
PY_MODULE_DIRS ?= $(PY_PROJ_MODULE_DIRS) PY_MODULE_DIRS ?= $(PY_PROJ_MODULE_DIRS)
PY_PROJ_MODULES += $(dir $(wildcard $(PY_MODULE_DIRS)/*/__init__.py)) PY_PROJ_MODULES += $(dir $(wildcard $(PY_MODULE_DIRS)/*/__init__.py))
PY_MODULES ?= $(PY_PROJ_MODULES) PY_MODULES ?= $(PY_PROJ_MODULES)
PY_SRC_PY = $(sort $(wildcard *.py) __init__.py) PY_SRC_PY ?= $(wildcard *.py)
PY_PYC = $(patsubst %.py,%.pyc,$(PY_SRC_PY)) PY_ALL_PY = $(sort $(PY_SRC_PY) __init__.py)
PY_PYC = $(patsubst %.py,%.pyc,$(PY_ALL_PY))
PY_INSTALL_PKG_MOD ?= $(shell pwd | sed 's%.*/python/%%; s%/.*%%') PY_INSTALL_PKG_MOD ?= $(shell pwd | sed 's%.*/python/%%; s%/.*%%')
PY_INSTALL_SUB_MOD ?= $(shell pwd | sed "s%.*/$(PY_INSTALL_PKG_MOD)\(/\|$$\)%%") PY_INSTALL_SUB_MOD ?= $(shell pwd | sed "s%.*/$(PY_INSTALL_PKG_MOD)\(/\|$$\)%%")
@ -24,7 +25,7 @@ else
endif endif
PY_MOD ?= $(subst /,.,$(PY_INSTALL_MOD)) PY_MOD ?= $(subst /,.,$(PY_INSTALL_MOD))
PY_INSTALL_DIR = $(ENV_PREFIX)$(PY_SITE_PACKAGES_PATH)/$(patsubst .,/,$(PY_INSTALL_MOD)) PY_INSTALL_DIR = $(ENV_PREFIX)$(PY_SITE_PACKAGES_PATH)/$(patsubst .,/,$(PY_INSTALL_MOD))
PY_INSTALLED_REG = $(addprefix $(PY_INSTALL_DIR)/,$(PY_SRC_PY) $(PY_PYC)) PY_INSTALLED_REG = $(addprefix $(PY_INSTALL_DIR)/,$(PY_ALL_PY) $(PY_PYC))
empty := empty :=
space := $(empty) $(empty) space := $(empty) $(empty)

View file

@ -3,7 +3,10 @@ include $(MODDIR)/make/py-defs.mk
include $(MODDIR)/make/dirs.mk include $(MODDIR)/make/dirs.mk
PY_INIT_TMPL = $(wildcard __init__.py.tmpl) PY_INIT_TMPL = $(wildcard __init__.py.tmpl)
PY_SED_EXTRACT_EXPORT ?= /class ..*\# *export/ !d; s/class *//; s/[(:].*// PY_SED_EXTRACT_EXPORT ?= /\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[(:].*//
#leftparen:=(
#PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY))
all: $(PY_PYC) all: $(PY_PYC)
install: install-dirs.done install-reg.done install: install-dirs.done install-reg.done