From 91ec82fc9263994c5588292c9f251d67958e1e53 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 5 Dec 2018 20:14:20 -0500 Subject: project: pydist.sh (reference only): added .py and .pyc installation logic. --- project/pydist.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/project/pydist.sh b/project/pydist.sh index 889e60c..27c3520 100755 --- a/project/pydist.sh +++ b/project/pydist.sh @@ -5,6 +5,25 @@ # under $PYTHON_SRCDIR/Lib, excluding the 'test' # and 'plat-*' sub-directories. +if [ -z "$PYTHON_SRCDIR" ]; then + printf 'Variable PYTHON_SRCDIR is not set!\n' + exit 2 +fi + +cd "$PYTHON_SRCDIR"/Lib || exit 2 + +pydirs=$(find . -type d | grep -v -e '^\./test' -e '^./plat-' | sort) +pysrcs=$(mktemp) +pypycs=$(mktemp) + +if [ -z $pysrcs ]; then + exit 2 +fi + +if [ -z $pypycs ]; then + exit 2 +fi + printf 'PYCOPY = $(PROJECT_DIR)/project/pycopy.sh\n' printf 'PYCOPY_PYTHON = $(NICKNAME)\n' printf 'PYCOPY_PREFIX = $(PREFIX)\n\n' @@ -15,9 +34,11 @@ printf 'PYDIST_PYCDIR = lib/$(NICKNAME)\n\n\n' printf 'PYDIST_SYSCFG_SRCS = \\\n' printf '\t$(PYDIST_PYCDIR)/./_sysconfigdata.py\n\n' -cd "$PYTHON_SRCDIR"/Lib || exit 2 +cpvar=$(printf '\tcp -p $(%s)' 'PYDIST_SYSCFG_SRCS') +printf '%-64s$(DESTDIR)/$(LIBDIR)/$(PACKAGE)\n' "$cpvar" >> $pysrcs -pydirs=$(find . -type d | grep -v -e '^\./test' -e '^./plat-' | sort) +cpvar=$(printf '\tcp -p $(%s:%s.py=%s.pyc)' 'PYDIST_SYSCFG_SRCS' '%' '%') +printf '%-68s$(DESTDIR)/$(LIBDIR)/$(PACKAGE)\n' "$cpvar" >> $pypycs for pydir in $pydirs; do if [ $(find "$pydir" -name '*.py' | wc -l) != '0' ]; then @@ -28,6 +49,12 @@ for pydir in $pydirs; do printf "%s = "'\\'"\n" "$pyvar" pyvars="$pyvars $pyvar" + cpvar=$(printf '\tcp -p $(%s)' "$pyvar") + printf '%-64s$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/%s\n' "$cpvar" "$pydir" >> $pysrcs + + cpvar=$(printf '\tcp -p $(%s:%s.py=%s.pyc)' "$pyvar" '%' '%') + printf '%-68s$(DESTDIR)/$(LIBDIR)/$(PACKAGE)/%s\n' "$cpvar" "$pydir" >> $pypycs + for pysrc in $pydir/*.py; do if [ $pysrc != $pydir/py3_test_grammar.py ]; then printf "\t"'$(PYDIST_PYCDIR)/'"%s "'\\'"\n" $pysrc @@ -77,7 +104,37 @@ printf '\trm -f $(PYDIST_PY_SRCS)\n' printf '\trm -f pydist.tag\n\n' printf 'clean:\tpydist-py-srcs-clean\n\n' +printf '\n\n' +printf 'pydist-install-tree:\n' + +for pydir in $pydirs; do + if [ $pydir != '.' ]; then + printf '\tmkdir -p $(DESTDIR)/$(LIBDIR)/$(PACKAGE)/%s\n' $pydir + fi +done + +printf '\n\n' +printf 'pydist-install-py: $(PYDIST_PY_SRCS)\n' +printf 'pydist-install-py: pydist-install-tree\n' +printf 'pydist-install-py:\n' +cat $pysrcs + +printf '\n\n' +printf 'pydist-install-pyc: $(PYCGEN_OBJS)\n' +printf 'pydist-install-pyc: pydist-install-tree\n' +printf 'pydist-install-pyc:\n' +cat $pypycs + +printf '\n\n' +printf 'install-app:\tpydist-install-py\n' +printf 'install-app:\tpydist-install-pyc\n' + +printf '\n\n' printf '.PHONY:\tpydist-py-srcs\n' printf '.PHONY:\tpydist-py-srcs-clean\n\n' +printf '.PHONY:\tpydist-install-tree\n' +printf '.PHONY:\tpydist-install-py\n' +printf '.PHONY:\tpydist-install-pyc\n' + exit 0 -- cgit v1.2.3