deps.py: better heuristic to guess if import is a module
py/tools/deps.py tries to guess if an import statement is import a
submodule or a function / member. The heuristic failed for import like:
from aaa.bbb import *
Change the heuristic to make better guess (only "snake_case" name are
considered submodules).
Also fix the naming of a top level variable in argparse_utils.
'cros.factory.utils.argparse_utils.verbosity_cmd_arg' is a top level
variable that is exported for other modules to use. It should be named
in UPPER_CASE.
BUG=None
TEST=make test
TEST=py/tools/deps.py $(find py/ -name '*.py' -type f)
Change-Id: Id366df5c5851f8911b053cc9c15b08ce7ee6f828
Reviewed-on: https://chromium-review.googlesource.com/1824567
Tested-by: Wei-Han Chen <stimim@chromium.org>
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 60ae204..4bb7861 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -39,7 +39,7 @@
from cros.factory.utils import argparse_utils
from cros.factory.utils.argparse_utils import CmdArg
from cros.factory.utils.argparse_utils import ParseCmdline
-from cros.factory.utils.argparse_utils import verbosity_cmd_arg
+from cros.factory.utils.argparse_utils import VERBOSITY_CMD_ARG
from cros.factory.utils.debug_utils import SetupLogging
from cros.factory.utils import file_utils
from cros.factory.utils.process_utils import Spawn
@@ -838,7 +838,7 @@
CmdArg('--phase', default=None,
help=('override phase for phase checking (defaults to the current '
'as returned by the "factory phase" command)')),
- verbosity_cmd_arg)
+ VERBOSITY_CMD_ARG)
SetupLogging(options.verbosity, options.log)
event_log.SetGlobalLoggerDefaultPrefix('gooftool')
event_log.GetGlobalLogger().suppress = options.suppress_event_logs