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 <jaraco@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Jason R. Coombs <jaraco@google.com>
diff --git a/git_command.py b/git_command.py
index 0e25639..3c3869a 100644
--- a/git_command.py
+++ b/git_command.py
@@ -196,12 +196,10 @@
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 @@
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 @@
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 @@
)
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,
)