mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
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 <jan@janware.com>
This commit is contained in:
parent
477d4e2d8d
commit
7fb117a4c4
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue