From b32ccbb66bb16965ecb8b4e266c4e45186636c1b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 29 Sep 2023 11:04:49 -0400 Subject: cleanup: Update codebase to expect Python 3.6 - Bump minimum version to Python 3.6. - Use f-strings in a lot of places. Change-Id: I2aa70197230fcec2eff8e7c8eb754f20c08075bb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389034 Tested-by: Jason R. Coombs Reviewed-by: Mike Frysinger Commit-Queue: Jason R. Coombs --- git_command.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'git_command.py') diff --git a/git_command.py b/git_command.py index 0e256392..3c3869a2 100644 --- a/git_command.py +++ b/git_command.py @@ -196,12 +196,10 @@ class UserAgent: def git(self): """The UA when running git.""" if self._git_ua is None: - self._git_ua = "git/%s (%s) git-repo/%s" % ( - git.version_tuple().full, - self.os, - RepoSourceVersion(), + self._git_ua = ( + f"git/{git.version_tuple().full} ({self.os}) " + f"git-repo/{RepoSourceVersion()}" ) - return self._git_ua @@ -216,7 +214,7 @@ def git_require(min_version, fail=False, msg=""): need = ".".join(map(str, min_version)) if msg: msg = " for " + msg - error_msg = "fatal: git %s or later required%s" % (need, msg) + error_msg = f"fatal: git {need} or later required{msg}" logger.error(error_msg) raise GitRequireError(error_msg) return False @@ -243,7 +241,7 @@ def _build_env( env["GIT_SSH"] = ssh_proxy.proxy env["GIT_SSH_VARIANT"] = "ssh" if "http_proxy" in env and "darwin" == sys.platform: - s = "'http.proxy=%s'" % (env["http_proxy"],) + s = f"'http.proxy={env['http_proxy']}'" p = env.get("GIT_CONFIG_PARAMETERS") if p is not None: s = p + " " + s @@ -468,7 +466,7 @@ class GitCommand: ) except Exception as e: raise GitPopenCommandError( - message="%s: %s" % (command[1], e), + message=f"{command[1]}: {e}", project=self.project.name if self.project else None, command_args=self.cmdv, ) -- cgit v1.2.3-54-g00ecf