Skip to content

Commit

Permalink
feat(kivymd): fix make_release script
Browse files Browse the repository at this point in the history
  • Loading branch information
MagneticNeedle committed Jan 21, 2024
1 parent af89862 commit 43a2ce2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions kivymd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
import kivy
from kivy.logger import Logger

from kivymd._version import __version__
from kivymd._version import __version__, release

release = False
if "READTHEDOCS" not in os.environ:
kivy.require("2.3.0")

Expand Down
1 change: 1 addition & 0 deletions kivymd/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
release = False
__version__ = "2.0.1.dev0"
__hash__ = "78d37316781700978d9f57b3fa11e1aad365863d"
__short_hash__ = "78d3731"
Expand Down
14 changes: 7 additions & 7 deletions kivymd/tools/release/make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ def replace_in_file(pattern, repl, file):
return not file_content == new_file_content


def update_init_py(version, is_release, test: bool = False):
"""Change version in `kivymd/__init__.py`."""
def update_version_py(version, is_release, test: bool = False):
"""Change version in `kivymd/_version.py`."""

init_file = os.path.abspath("kivymd/__init__.py")
init_file = os.path.abspath("kivymd/_version.py")
init_version_regex = r"(?<=^__version__ = ['\"])[^'\"]+(?=['\"]$)"
success = replace_in_file(init_version_regex, version, init_file)

if test and not success:
print("Couldn't update __init__.py file.", file=sys.stderr)
print("Couldn't update _version.py file.", file=sys.stderr)

init_version_regex = r"(?<=^release = )(True|False)(?=$)"
success = replace_in_file(init_version_regex, str(is_release), init_file)

if test and not success:
print("Couldn't update __init__.py file.", file=sys.stderr)
print("Couldn't update _version.py file.", file=sys.stderr)


def update_readme(previous_version, version, test: bool = False):
Expand Down Expand Up @@ -264,7 +264,7 @@ def main():
git_push([], ask=ask, push=push)
return

update_init_py(version, is_release=True, test=test)
update_version_py(version, is_release=True, test=test)
update_readme(previous_version, version, test=test)

changelog_index_file = os.path.join(
Expand Down Expand Up @@ -303,7 +303,7 @@ def main():
version,
test=test,
)
update_init_py(next_version, is_release=False, test=test)
update_version_py(next_version, is_release=False, test=test)
git_commit(f"KivyMD {next_version}")
git_push(branches_to_push, ask=ask, push=push)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def update_version_info():
version_info = (
"\n".join(
[
f'__version__ = "{__version__}"',
f"release = False" f'__version__ = "{__version__}"',
f'__hash__ = "{git_revision}"',
f'__short_hash__ = "{git_revision[:7]}"',
f'__date__ = "{date}"',
Expand Down

0 comments on commit 43a2ce2

Please sign in to comment.