Skip to content

Commit

Permalink
Update version bump script in tools to write to __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Oct 20, 2023
1 parent 6a6c463 commit 33f8284
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/set_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def handle_version(version):


def increment_development_version():
with open("prawcore/const.py") as fp:
with open("prawcore/__init__.py") as fp:
version = re.search('__version__ = "([^"]+)"', fp.read()).group(1)

parsed_version = valid_version(version)
Expand Down Expand Up @@ -89,15 +89,15 @@ def update_changelog(version):


def update_package(version):
with open("prawcore/const.py") as fp:
with open("prawcore/__init__.py") as fp:
content = fp.read()

updated = re.sub('__version__ = "([^"]+)"', f'__version__ = "{version}"', content)
if content == updated:
sys.stderr.write("Package version string not changed\n")
return False

with open("prawcore/const.py", "w") as fp:
with open("prawcore/__init__.py", "w") as fp:
fp.write(updated)

print(version)
Expand Down

0 comments on commit 33f8284

Please sign in to comment.