Switch to tagged update checks

pull/2191/head
Paul Pfeister 6 months ago
parent 99586a56cf
commit 33db232493
No known key found for this signature in database
GPG Key ID: 70D33A96CBD7A994

@ -9,5 +9,4 @@ __shortname__ = "Sherlock"
__longname__ = "Sherlock: Find Usernames Across Social Networks" __longname__ = "Sherlock: Find Usernames Across Social Networks"
__version__ = "0.15.0" __version__ = "0.15.0"
forgeReleaseUrlPrefix = "https://github.com/sherlock-project/sherlock/releases/tag/"
forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest" forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest"

@ -14,6 +14,7 @@ import os
import re import re
import sys import sys
from argparse import ArgumentParser, RawDescriptionHelpFormatter from argparse import ArgumentParser, RawDescriptionHelpFormatter
from json import loads as json_loads
from time import monotonic from time import monotonic
import requests import requests
@ -24,8 +25,7 @@ from sherlock.__init__ import (
__longname__, __longname__,
__shortname__, __shortname__,
__version__, __version__,
forgeReleaseUrlPrefix, forgeApiLatestReleaseUrl,
#forgeApiLatestReleaseUrl,
) )
from sherlock.result import QueryStatus from sherlock.result import QueryStatus
@ -668,16 +668,14 @@ def main():
# Check for newer version of Sherlock. If it exists, let the user know about it # Check for newer version of Sherlock. If it exists, let the user know about it
try: try:
r = requests.get( latestReleaseJsonRaw = requests.get(forgeApiLatestReleaseUrl).text
"https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/__init__.py" latestReleaseJsonData = json_loads(latestReleaseJsonRaw)
) latestRemoteTag = latestReleaseJsonData["tag_name"]
remote_version = str(re.findall('__version__ *= *"(.*)"', r.text)[0])
if remote_version != __version__: if latestRemoteTag[1:] != __version__:
print( print(
f"Update available! {__version__} --> {remote_version}" f"Update available! {__version__} --> {latestRemoteTag[1:]}"
f"\n{forgeReleaseUrlPrefix}v{remote_version}" f"\n{latestReleaseJsonData['html_url']}"
) )
except Exception as error: except Exception as error:

@ -11,7 +11,6 @@ def test_versioning() -> None:
expected:list = [ expected:list = [
# Normalization is REQUIRED for Windows ( / vs \ ) # Normalization is REQUIRED for Windows ( / vs \ )
os.path.normpath("sherlock/__init__.py"), os.path.normpath("sherlock/__init__.py"),
os.path.normpath("sherlock/sherlock.py"),
] ]
# Sorting is REQUIRED for Mac # Sorting is REQUIRED for Mac
assert sorted(found) == sorted(expected) assert sorted(found) == sorted(expected)

Loading…
Cancel
Save