Blame project/pydist.sh

ece54d
#!/bin/sh
ece54d
ece54d
# pydist.sh: a reference-only, development-time script
ece54d
# objective: generate pydist.in based on the scripts found
ece54d
#            under $PYTHON_SRCDIR/Lib, excluding the 'test'
ece54d
#            and 'plat-*' sub-directories.
ece54d
ece54d
set -eu
ece54d
ece54d
export LC_ALL=C
ece54d
ece54d
if [ -z "${PYTHON_SRCDIR:-}" ]; then
ece54d
	printf 'Variable PYTHON_SRCDIR is not set!\n'
ece54d
	exit 2
ece54d
fi
ece54d
ece54d
cd -- "$PYTHON_SRCDIR/Lib"
ece54d
ece54d
pydirs=$(find . -type d | grep -v -e '^\./test' -e '^./plat-' | sort)
ece54d
ece54d
for pydir in $pydirs; do
ece54d
	if [ $pydir = '.' ]; then
ece54d
		pysrcs=*.py
ece54d
		printf 'PYCDIR(,1)_\n'
ece54d
	else
ece54d
		pydir=${pydir#./}
ece54d
ece54d
		if ls $pydir/*.py > /dev/null 2>&1; then
ece54d
			pysrcs=$pydir/*.py
ece54d
			printf 'PYCDIR(%s,1)\n' $pydir
ece54d
		else
ece54d
			pysrcs=
ece54d
			printf 'PYCDIR(%s,0)\n' $pydir
ece54d
		fi
ece54d
ece54d
	fi
ece54d
ece54d
	for pysrc in $(printf '%s' "$pysrcs" | sort); do
ece54d
		if [ "${pysrc##*/}" != 'py3_test_grammar.py' ]; then
ece54d
			printf 'PYCSRC(%s)\n' "$pysrc"
ece54d
		fi
ece54d
	done
ece54d
ece54d
	printf '\n'
ece54d
done