From c71ee7e163550069828b89247dd7228d35cf10c7 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 4 Apr 2023 13:45:41 -0500 Subject: binman: Use unsigned long over typedef ulong The header binman_sym.h depends on ulong typedef but does not include types.h. This means the header must be included after including types.h or a header that includes it. We could include types.h but instead let's just switch from ulong to directly using unsigned long. This removes the need for typedef'ing it in some of the tests, so also remove those. Signed-off-by: Andrew Davis Reviewed-by: Simon Glass --- tools/binman/test/blob_syms.c | 2 -- tools/binman/test/u_boot_binman_syms.c | 2 -- tools/binman/test/u_boot_binman_syms_size.c | 2 -- 3 files changed, 6 deletions(-) (limited to 'tools') diff --git a/tools/binman/test/blob_syms.c b/tools/binman/test/blob_syms.c index d652c79aa98..1df8d64353f 100644 --- a/tools/binman/test/blob_syms.c +++ b/tools/binman/test/blob_syms.c @@ -5,8 +5,6 @@ * Simple program to create some binman symbols. This is used by binman tests. */ -typedef unsigned long ulong; - #include #include diff --git a/tools/binman/test/u_boot_binman_syms.c b/tools/binman/test/u_boot_binman_syms.c index ed761246aec..147c90230f8 100644 --- a/tools/binman/test/u_boot_binman_syms.c +++ b/tools/binman/test/u_boot_binman_syms.c @@ -5,8 +5,6 @@ * Simple program to create some binman symbols. This is used by binman tests. */ -typedef unsigned long ulong; - #include #include diff --git a/tools/binman/test/u_boot_binman_syms_size.c b/tools/binman/test/u_boot_binman_syms_size.c index fa41b3d9a33..f686892a4da 100644 --- a/tools/binman/test/u_boot_binman_syms_size.c +++ b/tools/binman/test/u_boot_binman_syms_size.c @@ -5,8 +5,6 @@ * Simple program to create some binman symbols. This is used by binman tests. */ -typedef unsigned long ulong; - #include #include -- cgit v1.3.1 From ad827e15b22ad370b5e548c12f58efcedf657740 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 19 Apr 2023 15:21:14 -0600 Subject: binman: Use expanduser instead of HOME There may not be a HOME environment variable, so use the os.expanduser() function instead. Signed-off-by: Simon Glass --- tools/binman/cmdline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index 4b875a9dcda..9632ec115e5 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -95,7 +95,7 @@ controlled by a description in the board device tree.''' parser.add_argument('-H', '--full-help', action='store_true', default=False, help='Display the README file') parser.add_argument('--tooldir', type=str, - default=os.path.join(os.getenv('HOME'), '.binman-tools'), + default=os.path.join(os.path.expanduser('~/.binman-tools')), help='Set the directory to store tools') parser.add_argument('--toolpath', type=str, action='append', help='Add a path to the list of directories containing tools') -- cgit v1.3.1 From c25be4f3ace634f132e92ae651ed9fbd2aa44171 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Apr 2023 20:07:29 +0200 Subject: patman: fix class TestFunctional Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block. tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- tools/patman/func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 42ac4ed77b7..e3918497cf4 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -489,8 +489,8 @@ complicated as possible''') # pylint: disable=E1101 self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) control.setup() + orig_dir = os.getcwd() try: - orig_dir = os.getcwd() os.chdir(self.gitdir) # Check that it can detect the current branch @@ -679,8 +679,8 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) # Check that it can detect the current branch + orig_dir = os.getcwd() try: - orig_dir = os.getcwd() os.chdir(self.gitdir) with self.assertRaises(ValueError) as exc: gitutil.count_commits_to_branch(None) -- cgit v1.3.1 From de65b122a2534a5bc61f7714f10125baee5d58f3 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sat, 22 Apr 2023 16:42:48 +0200 Subject: tools: Fall back to importlib_resources on Python 3.6 importlib.resources became part of 3.7 only. Allow using distros with 3.6 and the importlib_resources backport. Signed-off-by: Jan Kiszka Reviewed-by: Simon Glass --- tools/binman/control.py | 6 +++++- tools/buildman/control.py | 6 +++++- tools/patman/__main__.py | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/binman/control.py b/tools/binman/control.py index 0febcb79a60..68597c4e779 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -7,7 +7,11 @@ from collections import OrderedDict import glob -import importlib.resources +try: + import importlib.resources +except ImportError: + # for Python 3.6 + import importlib_resources import os import pkg_resources import re diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 35f44c0cf3d..09a11f25b3f 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -3,7 +3,11 @@ # import multiprocessing -import importlib.resources +try: + import importlib.resources +except ImportError: + # for Python 3.6 + import importlib_resources import os import shutil import subprocess diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py index 48ffbc8eadf..8eba5d34864 100755 --- a/tools/patman/__main__.py +++ b/tools/patman/__main__.py @@ -7,7 +7,11 @@ """See README for more information""" from argparse import ArgumentParser -import importlib.resources +try: + import importlib.resources +except ImportError: + # for Python 3.6 + import importlib_resources import os import re import sys -- cgit v1.3.1