summaryrefslogtreecommitdiffstats
path: root/scripts/qt/branch_qt.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2022-02-11 13:57:33 +0200
committerIikka Eklund <iikka.eklund@qt.io>2022-02-28 08:24:45 +0200
commit18edb9d61c92bd5c4e4b65a7c98fd1fd3eeff118 (patch)
tree5087bece92d3f4d6fce1ffe7fdb7514b0a810881 /scripts/qt/branch_qt.py
parent04645e55349285b9c5c3a493aaef43a507a608fb (diff)
branch_qt.py: Minor refactoring
Limit the amount of indendations for cleaner code. Change-Id: Ifd328668c02538f1dd8fd7dde0160c82c7f23bf7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'scripts/qt/branch_qt.py')
-rwxr-xr-xscripts/qt/branch_qt.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/scripts/qt/branch_qt.py b/scripts/qt/branch_qt.py
index c037d8fc..dec33615 100755
--- a/scripts/qt/branch_qt.py
+++ b/scripts/qt/branch_qt.py
@@ -364,21 +364,22 @@ class QtBranching:
content = f.read()
match = re.search(pattern, content, flags=re.MULTILINE)
- if match is not None:
- if match.group(1) != self.fromVersion:
- log.warning(
- f"--version ({self.fromVersion}) differs the one "
- f"({match.group(1)}) parsed from {file}, SKIPPING"
- )
- return False
- log.info(f"bump {repo}:{file} from {self.fromVersion} to {self.toBranch}")
- i, j = match.span(1)
- with open(file, mode="w", encoding="utf-8") as f:
- f.write(content[:i] + self.toBranch + content[j:])
- return True
-
- log.warning(f"could not read version in {repo}, {file}, SKIPPING")
- return False
+ if match is None:
+ log.warning(f"could not read version in {repo}, {file}, SKIPPING")
+ return False
+
+ if match.group(1) != self.fromVersion:
+ log.warning(
+ f"--version ({self.fromVersion}) differs the one ({match.group(1)}) "
+ f"parsed from {file}, SKIPPING"
+ )
+ return False
+
+ log.info(f"bump {repo}:{file} from {self.fromVersion} to {self.toBranch}")
+ i, j = match.span(1)
+ with open(file, mode="w", encoding="utf-8") as f:
+ f.write(content[:i] + self.toBranch + content[j:])
+ return True
def version_bump_repo(self, repo: git.Repo) -> None:
repo_name = get_repo_name(repo)