#!/usr/bin/env bash
{ set +x; } 2>/dev/null

IFS=

find_python="$(find-python)" || exit
set --;while IFS= read python; do
	python_lib="$("$python" -c "from distutils.sysconfig import *;print(get_python_lib(standard_lib=True))")"
	set -- "$@" "$python_lib"
	[ -d "$python_lib"/lib-dynload ] && set -- "$@" "$python_lib"/lib-dynload
done <<< "$find_python"
modules="$( ( find "$@" -maxdepth 1 | while read path; do
	basename="${path##*/}"
	IFS=.;set $basename;echo $1
done; cat <<EOF
__builtin__
__builtins__
__future__
__main__
__pycache__
builtins
errno
marshal
sys
EOF
) | sort -u)"
txt=data_files/.python_lib.txt
echo "$modules" > "$txt"
( set -x; cat "$txt" )


