From 7fb117a4c47864aa32cd7cf9c499840de61524d6 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 5 Apr 2020 12:51:11 +0000 Subject: [PATCH] python-tools.sh: Make __init__py recognize multiple package modules import my.mod.thing, my.mod.thang wouldn't work, if the modules where not in the same directory hierarchy, e.g. in $(HOME)/blah/my/mod/thing.py and $(HOME)/blub/my/mod/thang.py, not even with PYTHONPATH=$(HOME)/blah:$(HOME)/blub. This commit fixes that. See https://stackoverflow.com/questions/1675734 Signed-off-by: Jan Lindemann --- scripts/python-tools.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/python-tools.sh b/scripts/python-tools.sh index f1c8e54d..bc1a0a72 100644 --- a/scripts/python-tools.sh +++ b/scripts/python-tools.sh @@ -25,6 +25,8 @@ cmd_create_init() local e f files base extracted module_path local del="-------------------------- generated by $myname" echo "# >> $del >>" + echo "from pkgutil import extend_path" + echo "__path__ = extend_path(__path__, __name__)" files="$*" for f in $files; do test -d $f && continue