The mypy module names of the test tree derive from the full path, anchored by the top-level test/__init__.py, but a file below a path component that is not a valid identifier - the dashes in jw-pkg - falls back to the bare file name, so two same-named test.py drivers collide (the duplicate module error that drove the runme.py and main.py renames). Rename the directory a sane Python name - jw_pkg, that's the better fix. Then name the driver test.py like all the others for consistency. Signed-off-by: Jan Lindemann <jan@janware.com>
41 lines
691 B
Shell
41 lines
691 B
Shell
#!/bin/bash
|
|
# shellcheck disable=SC2048,SC2086
|
|
# Unquoted $* and $cmds are intentional — word splitting for subcommand names
|
|
|
|
run()
|
|
{
|
|
local log_cmd
|
|
# shellcheck disable=SC2001
|
|
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
|
|
printf '============= Running: %s\n' "$log_cmd"
|
|
"$@"
|
|
}
|
|
|
|
parse_subcmds()
|
|
{
|
|
$jw_pkg_py $* --help | awk '/^ [a-z]/ {print $1}'
|
|
}
|
|
|
|
help_cmd()
|
|
{
|
|
local cmds subcommand subcommands
|
|
cmds="$*"
|
|
run $jw_pkg_py $cmds --help
|
|
subcommands=$(parse_subcmds $cmds)
|
|
for subcommand in $subcommands; do
|
|
help_cmd $cmds $subcommand
|
|
done
|
|
}
|
|
|
|
cmd_test()
|
|
{
|
|
help_cmd
|
|
}
|
|
|
|
export LC_ALL="C"
|
|
set -euo pipefail
|
|
shopt -s nullglob
|
|
|
|
jw_pkg_py="$*"
|
|
|
|
cmd_test
|