summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/config/cfgdefs.sh12
-rw-r--r--project/pydist.m4160
-rw-r--r--project/pydist.mk35
-rwxr-xr-xproject/pydist.sh45
4 files changed, 251 insertions, 1 deletions
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
index c76629d..6826af7 100644
--- a/project/config/cfgdefs.sh
+++ b/project/config/cfgdefs.sh
@@ -82,6 +82,18 @@ cfgdefs_detect_python_version()
exit 2
fi
+ pydist_macros="$mb_project_dir/project/pydist.m4"
+ pydist_helper="$mb_project_dir/sofort/core/modern.m4"
+ pydist_srclst="$mb_project_dir/project/variants/$python_major.$python_minor.$python_micro/pydist.in"
+
+ if ! [ -f "$pydist_srclst" ]; then
+ exit 2
+ fi
+
+ if ! m4 "$pydist_helper" "$pydist_macros" "$pydist_srclst" > pydist.mk ; then
+ exit 2
+ fi
+
python_ver="$python_major.$python_minor"
if [ "$mb_package" = '@' ]; then
diff --git a/project/pydist.m4 b/project/pydist.m4
new file mode 100644
index 0000000..28f6e18
--- /dev/null
+++ b/project/pydist.m4
@@ -0,0 +1,160 @@
+m4_divert(-1)
+
+_
+_ <pysrcs>
+_
+m4_divert(5)
+m4_srclist(PYDIST_PY_SRCS)
+m4_srcitem($(PYDIST_SYSCFG_SRCS))
+m4_divert(-1)
+
+m4_define([PYCDIR],[_
+m4_ifelse([$1],[],_
+[m4_divert(1)]_
+m4_srclist([PYDIST_SRCS])
+[m4_divert(-1)],_
+[$2],[1],_
+[m4_divert(1)]_
+m4_srclist([PYDIST_]m4_pathvar([$1][_SRCS]))
+[m4_divert(-1)])_
+_
+m4_divert(2)_
+m4_ifelse([$1],[],
+[m4_divert(-1)],
+m4_tab[mkdir -p $(PYDIST_PYCDIR)/./][$1]
+m4_tab[mkdir -p $(PYDIST_PYCDIR)/./][$1][/./__pycache__])
+_
+m4_divert(3)_
+m4_ifelse([$1],[],
+m4_rightalign(64,[$(PYDIST_PYCDIR)/./][%.py:])[pydist.tag],_
+m4_rightalign(64,[$(PYDIST_PYCDIR)/./][$1]/[%.py:])[pydist.tag])
+_
+m4_divert(4)
+m4_ifelse([$1],[],
+[$(PYDIST_PYCDIR)/./][%.py: \]
+m4_tabtabtab([$(SOURCE_DIR)/Lib/./][[$1]][%.py pydist.tag]),
+[$(PYDIST_PYCDIR)/./][$1]/[%.py: \]
+m4_tabtabtab([$(SOURCE_DIR)/Lib/./][[$1]]/[%.py pydist.tag]))
+m4_tabtab[PYCOPY_PYTHON=$(PYCOPY_PYTHON) \]
+m4_tabtab[PYCOPY_PREFIX=$(PYCOPY_PREFIX) \]
+m4_tabtab[PYCOPY_DSTDIR=$(PYDIST_PYCDIR)/./][$1] \
+m4_tabtab[$(PYCOPY) $<]
+_
+m4_ifelse([$1],[],_
+[m4_divert(5)]_
+m4_srcitem([$(PYDIST_SRCS)])
+[m4_divert(-1)],
+[$2],[1],_
+[m4_divert(5)]_
+m4_srcitem([$(PYDIST_]m4_pathvar([$1][_SRCS)]))
+[m4_divert(-1)])
+_
+m4_divert(6)_
+m4_tab[mkdir -p $(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./][$1]
+m4_ifelse([$1],[],_
+m4_tab[mkdir -p $(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./][__pycache__],
+m4_tab[mkdir -p $(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./][$1][/./__pycache__])
+m4_divert(-1)
+_
+m4_ifelse([$1],[],_
+[m4_divert(7)]_
+m4_tab[]_
+m4_rightalign(79,[cp -p $(PYDIST_SRCS)])_
+[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./]
+[m4_divert(-1)],
+[$2],[1],_
+[m4_divert(7)]_
+m4_tab[]_
+m4_rightalign(79,[cp -p $(PYDIST_]m4_pathvar([$1][_SRCS)]))_
+[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./][$1]
+[m4_divert(-1)])
+_
+m4_ifelse([$1],[],_
+[m4_divert(8)]_
+m4_tab[cp -p $(PYDIST_SRCS][:$(PYDIST_PYCDIR)/./%.py=$(PYDIST_PYCDIR)/././__pycache__/%.$(PYCABI).pyc) \]
+m4_tabtab[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/././__pycache__]
+[m4_divert(-1)],
+[$1],[lib2to3/tests/data],[],
+[$1],[lib2to3/tests/data/fixers],[],
+[$1],[lib2to3/tests/data/fixers/myfixes],[],
+[$2],[1],_
+[m4_divert(8)]_
+m4_tab[cp -p $(PYDIST_]m4_pathvar([$1][_SRCS])[:$(PYDIST_PYCDIR)/./[$1]/%.py=$(PYDIST_PYCDIR)/./[$1]/./__pycache__/%.$(PYCABI).pyc) \]
+m4_tabtab[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./][$1][/./__pycache__]
+[m4_divert(-1)])
+])
+
+
+m4_define([PYCSRC],[_
+m4_divert(1)_
+m4_srcitem($(PYDIST_PYCDIR)/./[$1])]_
+m4_divert(-1))
+_
+_ </pysrcs>
+_
+
+
+_
+_ <pydist.tag>
+_
+m4_divert(2)
+pydist.tag:
+m4_tab[mkdir -p $(PYDIST_PYCDIR)/./__pycache__]
+m4_divert(-1)
+_
+m4_m4wrap([_
+m4_divert(2)_
+m4_tab[touch pydist.tag]
+m4_divert(-1)_
+])
+_
+_ </pydist.tag>
+_
+
+
+m4_divert(3)
+m4_divert(4)
+
+_
+_ <pydist-install-tree>
+_
+m4_divert(6)
+pydist-install-tree:
+m4_divert(-1)
+_
+_ </pydist-install-tree>
+_
+
+
+_
+_ <pydist-install-py>
+_
+m4_divert(7)
+pydist-install-py: $(PYDIST_PY_SRCS)
+pydist-install-py: pydist-install-tree
+pydist-install-py:
+m4_tab[]_
+m4_rightalign([79],[cp -p $(PYDIST_SYSCFG_SRCS)])_
+[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)]
+m4_divert(-1)
+_
+_ <pydist-install-py>
+_
+
+
+_
+_ <pydist-install-pyc>
+_
+m4_divert(8)
+pydist-install-pyc: $(PYCGEN_OBJS)
+pydist-install-pyc: pydist-install-tree
+pydist-install-pyc:
+m4_tab[cp -p $(PYDIST_SYSCFG_SRCS:$(PYDIST_PYCDIR)/./%.py=$(PYDIST_PYCDIR)/./__pycache__/%.$(PYCABI).pyc) \]
+m4_tabtab[$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/./__pycache__]
+m4_divert(-1)
+_
+_ <pydist-install-py>
+_
+
+
+m4_divert(-1)
diff --git a/project/pydist.mk b/project/pydist.mk
index 2d0c914..0467a4d 100644
--- a/project/pydist.mk
+++ b/project/pydist.mk
@@ -1,3 +1,36 @@
+PYCOPY = $(PROJECT_DIR)/project/pycopy.sh
+PYCABI = cpython-$(PYTHON_MAJOR)$(PYTHON_MINOR)
+PYCOPY_PYTHON = $(NICKNAME)
+PYCOPY_PREFIX = $(PREFIX)
+
+PYDIST_LIBDIR = lib
+PYDIST_PYCDIR = lib/$(NICKNAME)
+
+
+PYDIST_SYSCFG_SRCS = \
+ $(PYDIST_PYCDIR)/./_sysconfigdata_$(PYTHON_ABIFL)_$(PYTHON_PLATFORM)_.py
+
+
ifneq ($(PYTHON_MAJOR),)
-include $(PROJECT_DIR)/project/variants/$(PYTHON_MAJOR).$(PYTHON_MINOR).$(PYTHON_MICRO)/pydist.mk
+include pydist.mk
endif
+
+
+pydist-py-srcs: $(PYDIST_PY_SRCS)
+
+pydist-py-srcs-clean:
+ rm -f $(PYDIST_PY_SRCS)
+ rm -f pydist.tag
+
+clean: pydist-py-srcs-clean
+
+install-app: pydist-install-py
+install-app: pydist-install-pyc
+
+
+.PHONY: pydist-py-srcs
+.PHONY: pydist-py-srcs-clean
+
+.PHONY: pydist-install-tree
+.PHONY: pydist-install-py
+.PHONY: pydist-install-pyc
diff --git a/project/pydist.sh b/project/pydist.sh
new file mode 100755
index 0000000..d5dd8f1
--- /dev/null
+++ b/project/pydist.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# pydist.sh: a reference-only, development-time script
+# objective: generate pydist.in based on the scripts found
+# under $PYTHON_SRCDIR/Lib, excluding the 'test'
+# and 'plat-*' sub-directories.
+
+set -eu
+
+export LC_ALL=C
+
+if [ -z "${PYTHON_SRCDIR:-}" ]; then
+ printf 'Variable PYTHON_SRCDIR is not set!\n'
+ exit 2
+fi
+
+cd -- "$PYTHON_SRCDIR/Lib"
+
+pydirs=$(find . -type d | grep -v -e '^\./test' -e '^./plat-' | sort)
+
+for pydir in $pydirs; do
+ if [ $pydir = '.' ]; then
+ pysrcs=*.py
+ printf 'PYCDIR(,1)_\n'
+ else
+ pydir=${pydir#./}
+
+ if ls $pydir/*.py > /dev/null 2>&1; then
+ pysrcs=$pydir/*.py
+ printf 'PYCDIR(%s,1)\n' $pydir
+ else
+ pysrcs=
+ printf 'PYCDIR(%s,0)\n' $pydir
+ fi
+
+ fi
+
+ for pysrc in $(printf '%s' "$pysrcs" | sort); do
+ if [ "${pysrc##*/}" != 'py3_test_grammar.py' ]; then
+ printf 'PYCSRC(%s)\n' "$pysrc"
+ fi
+ done
+
+ printf '\n'
+done