chromite: Remove cros_import usages.
The module is made obsolete by importlib. Use that instead.
BUG=None
TEST=run_tests
TEST=Ran examples in scripts/wrapper:FindTarget, except used a
random unittest instead of cbuildbot for the examples where
that one was used.
Change-Id: Icb793cf79a696085e3917df839cbb7c924c5a608
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1965680
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/cli/command.py b/cli/command.py
index 5b92489..5559061 100644
--- a/cli/command.py
+++ b/cli/command.py
@@ -16,12 +16,12 @@
from __future__ import print_function
+import importlib
import os
from chromite.lib import constants
from chromite.lib import commandline
from chromite.lib import cros_build_lib
-from chromite.lib import cros_import
from chromite.lib import cros_logging as logging
@@ -60,7 +60,8 @@
'cros_%s' % (name.replace('-', '_'),))
import_path = os.path.relpath(os.path.realpath(module_path),
os.path.dirname(constants.CHROMITE_DIR))
- cros_import.ImportModule(import_path.split(os.path.sep))
+ module_parts = import_path.split(os.path.sep)
+ importlib.import_module('.'.join(module_parts))
return _commands[name]