mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
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:
parent
3ec49304a1
commit
55f9b50562
3 changed files with 35 additions and 19 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue