From patchwork Fri May 22 02:29:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 246219 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Thu, 21 May 2020 20:29:04 -0600 Subject: [PATCH v3 5/5] patman: Avoid importing gitutil in settings In-Reply-To: <20200522022904.239301-1-sjg@chromium.org> References: <20200522022904.239301-1-sjg@chromium.org> Message-ID: <20200522022904.239301-5-sjg@chromium.org> Pass this module in so that settings does not need to import it. Signed-off-by: Simon Glass Reported-by: Stefan Bosch --- Changes in v3: - Add more patches based on testing on a dusty Ubuntu 14.04 Changes in v2: - Update gitutil as well tools/patman/main.py | 2 +- tools/patman/settings.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/patman/main.py b/tools/patman/main.py index f3d9c0c4348..c5f247ed514 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -77,7 +77,7 @@ specified by tags you place in the commits. Use -n to do a dry run first.""" # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project). (options, args) = parser.parse_args() -settings.Setup(parser, options.project, '') +settings.Setup(gitutil, parser, options.project, '') (options, args) = parser.parse_args() if __name__ != "__main__": diff --git a/tools/patman/settings.py b/tools/patman/settings.py index ca74fc611ff..635561ac056 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -11,7 +11,6 @@ import os import re from patman import command -from patman import gitutil from patman import tools """Default settings per-project. @@ -185,7 +184,7 @@ def ReadGitAliases(fname): fd.close() -def CreatePatmanConfigFile(config_fname): +def CreatePatmanConfigFile(gitutil, config_fname): """Creates a config file under $(HOME)/.patman if it can't find one. Args: @@ -301,7 +300,7 @@ def GetItems(config, section): except: raise -def Setup(parser, project_name, config_fname=''): +def Setup(gitutil, parser, project_name, config_fname=''): """Set up the settings module by reading config files. Args: @@ -318,7 +317,7 @@ def Setup(parser, project_name, config_fname=''): if not os.path.exists(config_fname): print("No config file found ~/.patman\nCreating one...\n") - CreatePatmanConfigFile(config_fname) + CreatePatmanConfigFile(gitutil, config_fname) config.read(config_fname)