From patchwork Sat Apr 18 00:08:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 237957 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Fri, 17 Apr 2020 18:08:58 -0600 Subject: [PATCH v2 07/14] binman: Rename the main module In-Reply-To: <20200418000905.239056-1-sjg@chromium.org> References: <20200418000905.239056-1-sjg@chromium.org> Message-ID: <20200417180829.v2.7.If414e1007d37becaeb01f4dbf7af7d209b0e3b4e@changeid> Python does not like the module name being the same as the module directory. To allow buildman modules to be used from other tools, rename it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/binman/binman | 2 +- tools/binman/ftest.py | 6 +++--- tools/binman/{binman.py => main.py} | 4 ++-- tools/patman/test_util.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename tools/binman/{binman.py => main.py} (98%) diff --git a/tools/binman/binman b/tools/binman/binman index 979b7e4d4b..11a5d8e18a 120000 --- a/tools/binman/binman +++ b/tools/binman/binman @@ -1 +1 @@ -binman.py \ No newline at end of file +main.py \ No newline at end of file diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 67f976e5d0..0e2b50771e 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -15,7 +15,7 @@ import sys import tempfile import unittest -import binman +import main import cbfs_util import cmdline import command @@ -1428,14 +1428,14 @@ class TestFunctional(unittest.TestCase): def testEntryDocs(self): """Test for creation of entry documentation""" with test_util.capture_sys_output() as (stdout, stderr): - control.WriteEntryDocs(binman.GetEntryModules()) + control.WriteEntryDocs(main.GetEntryModules()) self.assertTrue(len(stdout.getvalue()) > 0) def testEntryDocsMissing(self): """Test handling of missing entry documentation""" with self.assertRaises(ValueError) as e: with test_util.capture_sys_output() as (stdout, stderr): - control.WriteEntryDocs(binman.GetEntryModules(), 'u_boot') + control.WriteEntryDocs(main.GetEntryModules(), 'u_boot') self.assertIn('Documentation is missing for modules: u_boot', str(e.exception)) diff --git a/tools/binman/binman.py b/tools/binman/main.py similarity index 98% rename from tools/binman/binman.py rename to tools/binman/main.py index ec152e9b3b..daff7ae4d3 100755 --- a/tools/binman/binman.py +++ b/tools/binman/main.py @@ -155,8 +155,8 @@ def RunTestCoverage(): glob_list = GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] for item in glob_list if '_testing' not in item]) - test_util.RunTestCoverage('tools/binman/binman.py', None, - ['*test*', '*binman.py', 'tools/patman/*', 'tools/dtoc/*'], + test_util.RunTestCoverage('tools/binman/binman', None, + ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*'], args.build_dir, all_set) def RunBinman(args): diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index 4d0085e2ed..76dbc21e3a 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -41,7 +41,7 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): glob_list = [] glob_list += exclude_list glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*'] - test_cmd = 'test' if 'binman.py' in prog else '-t' + test_cmd = 'test' if 'binman' in prog else '-t' cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run ' '--omit "%s" %s %s -P1' % (build_dir, PYTHON, ','.join(glob_list), prog, test_cmd))