Skip to content

Commit

Permalink
version update script
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed May 11, 2021
1 parent 46b6807 commit cd7f4eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Documentation](https://img.shields.io/badge/rebound-v3.17.0-green.svg?style=flat)](https://rebound.readthedocs.org)
[![Version](https://img.shields.io/badge/rebound-v3.17.0-green.svg?style=flat)](https://rebound.readthedocs.org)
[![PyPI](https://badge.fury.io/py/rebound.svg)](https://badge.fury.io/py/rebound)
[![GPL](https://img.shields.io/badge/license-GPL-green.svg?style=flat)](https://github.com/hannorein/rebound/blob/main/LICENSE)
[![Travis](https://api.travis-ci.org/hannorein/rebound.svg?branch=main)](https://travis-ci.org/hannorein/rebound/)
Expand Down
19 changes: 5 additions & 14 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
reboundversion = f.readlines()[0].strip()
print("Updating version to "+reboundversion)

with open("README.rst") as f:
with open("README.md") as f:
readme = f.readlines()

keep_lines_after_header = 5

with open("README.rst","w") as f:
with open("README.md","w") as f:
start_delete = -1
for i in range(0,len(readme)):
if "badge/rebound-v" in readme[i]:
readme[i] = ".. image:: https://img.shields.io/badge/rebound-v"+reboundversion+"-green.svg?style=flat\n"
# [![Version](https://img.shields.io/badge/rebound-v3.17.0-green.svg?style=flat)](https://rebound.readthedocs.org)
if "![Version]" in readme[i]:
readme[i] = "[![Version](https://img.shields.io/badge/rebound-v"+reboundversion+"-green.svg?style=flat)](https://rebound.readthedocs.org)\n"
f.write(readme[i])

with open("src/rebound.c") as f:
Expand Down Expand Up @@ -46,15 +47,5 @@

shortversion = shortversion[:-1]

with open("doc/conf.py") as f:
conflines = f.readlines()
for i,l in enumerate(conflines):
if "version =" in l:
conflines[i] = "version = '"+shortversion+"'\n"
if "release =" in l:
conflines[i] = "release = '"+reboundversion+"'\n"

with open("doc/conf.py", "w") as f:
f.writelines(conflines)
print("To commit, copy and paste:")
print("\ngit commit -a -m \"Updating version to "+reboundversion+"\"")

0 comments on commit cd7f4eb

Please sign in to comment.