Skip to content

Commit

Permalink
Merge pull request #1051 from ProgramR4732/patch-1
Browse files Browse the repository at this point in the history
Removed unnecessary indentation blocks and optimized if blocks.
  • Loading branch information
niklasf authored Oct 13, 2023
2 parents 99eeeae + 4a6dd9a commit 5a130a6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions release.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def system(command):
print(command)
exit_code = os.system(command)
if exit_code != 0:
if exit_code:
sys.exit(exit_code)


Expand All @@ -21,7 +21,7 @@ def check_git():

system("git fetch origin")
behind = int(subprocess.check_output(["git", "rev-list", "--count", "master..origin/master"]))
if behind > 0:
if behind:
print(f"master is {behind} commit(s) behind origin/master")
sys.exit(1)

Expand Down Expand Up @@ -65,15 +65,14 @@ def tag_and_push():
release_txt.write(headline + os.linesep)

for line in changelog_file:
if not first_section:
if line.startswith("-------"):
first_section = True
if line.startswith("-------") and not first_section:
first_section = True
else:
if line.startswith("-------"):
break
else:
if not prev_line.startswith("------"):
release_txt.write(prev_line)

if not prev_line.startswith("------"):
release_txt.write(prev_line)

prev_line = line

Expand Down

0 comments on commit 5a130a6

Please sign in to comment.