Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andiricum2 committed Sep 4, 2023
1 parent 191abac commit fd881a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions piemc/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
# @link http://www.PieMC-Dev.github.io/

import requests
import piemc.server
from piemc.server import __version__

repo_url = "https://api.github.com/repos/PieMC-Dev/PieMC/releases"


def compare_versions(version1, version2):
def normalize(v):
return [int(x) for x in v.split('.')]
numeric_part = ''.join(filter(str.isdigit, v))
return [int(x) for x in numeric_part.split('.')]

version1_parts = normalize(version1)
version2_parts = normalize(version2)
Expand All @@ -43,8 +44,7 @@ def check_for_updates():
latest_release = releases[0]
latest_release_version = latest_release["tag_name"]

# Access the version directly from piemc.server module
current_release_version = piemc.server.__version__
current_release_version = __version__

if compare_versions(current_release_version, latest_release_version) < 0:
print("⚠️\033[33mNew version available:\033[0m", latest_release_version)
Expand Down

0 comments on commit fd881a7

Please sign in to comment.