py-defs.mk, py-mod.mk, python-tools.sh: Improve python module handling

- Fix superflous dots in module names
- Generate PYTHONPATH in projects.py
- Add support for __init__.py.tmpl

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-07-24 10:59:08 +00:00
commit 55f9b50562
3 changed files with 35 additions and 19 deletions

View file

@ -12,16 +12,21 @@ usage()
cmd_create_init()
{
local f files base extracted
local f files base extracted module_path
files="$*"
for f in $files; do
base=${f##*/}
base=${base%.py}
if [ "$module" ]; then
module_path=$module.$base
else
module_path=$base
fi
if [ "$sed_extract_command" ]; then
#echo running $sed_extract_command on $f
extracted=`sed "$sed_extract_command" $f`
if [ "$extracted" ]; then
echo "from $module.$base import $extracted"
echo "from $module_path import $extracted"
fi
fi
done
@ -35,7 +40,7 @@ eval set -- `getopt -o 'he:m:' "$@"`
while [ "$1" != -- ]; do
case $1 in
-e)
sed_extract_command=$2
sed_extract_command="$2"
shift
;;
-m)