From 6d6e17c22f7436b4dfdd0a3fe95a1d9feca2b2bb Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Tue, 25 Jun 2024 00:15:32 -0400 Subject: [PATCH 1/5] Bump to 0.15.0 --- sherlock/__init__.py | 2 +- sherlock/sherlock.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sherlock/__init__.py b/sherlock/__init__.py index 5bf79e24..b8ed95dc 100644 --- a/sherlock/__init__.py +++ b/sherlock/__init__.py @@ -7,4 +7,4 @@ networks. __shortname__ = "Sherlock" __longname__ = "Sherlock: Find Usernames Across Social Networks" -__version__ = "0.14.4" +__version__ = "0.15.0" diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index db8e9c2c..b5b69e0c 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -26,7 +26,8 @@ del __version__ from .__init__ import ( # noqa: E402 __longname__, - __version__ + __shortname__, + __version__, ) from requests_futures.sessions import FuturesSession # noqa: E402 @@ -523,7 +524,7 @@ def main(): parser.add_argument( "--version", action="version", - version=f"Sherlock v{__version__}", + version=f"{__shortname__} v{__version__}", help="Display version information and dependencies.", ) parser.add_argument( From e3a4879fcd14c1fa39e4fff8a528582d8e599f9d Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Sat, 29 Jun 2024 18:50:24 -0400 Subject: [PATCH 2/5] Remove old version item --- sherlock/sherlock.py | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index b5b69e0c..6e1e4ce4 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -17,28 +17,17 @@ from argparse import ArgumentParser, RawDescriptionHelpFormatter from time import monotonic import requests - -# Removing __version__ here will trigger update message for users -# Do not remove until ready to trigger that message -# When removed, also remove all the noqa: E402 comments for linting -__version__ = "0.14.4" -del __version__ - -from .__init__ import ( # noqa: E402 - __longname__, - __shortname__, - __version__, -) - -from requests_futures.sessions import FuturesSession # noqa: E402 -from torrequest import TorRequest # noqa: E402 -from sherlock.result import QueryStatus # noqa: E402 -from sherlock.result import QueryResult # noqa: E402 -from sherlock.notify import QueryNotify # noqa: E402 -from sherlock.notify import QueryNotifyPrint # noqa: E402 -from sherlock.sites import SitesInformation # noqa: E402 -from colorama import init # noqa: E402 -from argparse import ArgumentTypeError # noqa: E402 +from requests_futures.sessions import FuturesSession +from torrequest import TorRequest + +from sherlock.__init__ import __longname__, __shortname__, __version__ +from sherlock.result import QueryStatus +from sherlock.result import QueryResult +from sherlock.notify import QueryNotify +from sherlock.notify import QueryNotifyPrint +from sherlock.sites import SitesInformation +from colorama import init +from argparse import ArgumentTypeError class SherlockFuturesSession(FuturesSession): From 99586a56cf5b318f722bb44623410e13d96d9724 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Sun, 30 Jun 2024 20:45:30 -0400 Subject: [PATCH 3/5] Prepare for tagged version checking --- sherlock/__init__.py | 3 +++ sherlock/sherlock.py | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sherlock/__init__.py b/sherlock/__init__.py index b8ed95dc..6f968d60 100644 --- a/sherlock/__init__.py +++ b/sherlock/__init__.py @@ -8,3 +8,6 @@ networks. __shortname__ = "Sherlock" __longname__ = "Sherlock: Find Usernames Across Social Networks" __version__ = "0.15.0" + +forgeReleaseUrlPrefix = "https://github.com/sherlock-project/sherlock/releases/tag/" +forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest" diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 6e1e4ce4..5a6caaaa 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -20,7 +20,14 @@ import requests from requests_futures.sessions import FuturesSession from torrequest import TorRequest -from sherlock.__init__ import __longname__, __shortname__, __version__ +from sherlock.__init__ import ( + __longname__, + __shortname__, + __version__, + forgeReleaseUrlPrefix, + #forgeApiLatestReleaseUrl, +) + from sherlock.result import QueryStatus from sherlock.result import QueryResult from sherlock.notify import QueryNotify @@ -666,12 +673,11 @@ def main(): ) remote_version = str(re.findall('__version__ *= *"(.*)"', r.text)[0]) - local_version = __version__ - if remote_version != local_version: + if remote_version != __version__: print( - "Update Available!\n" - + f"You are running version {local_version}. Version {remote_version} is available at https://github.com/sherlock-project/sherlock" + f"Update available! {__version__} --> {remote_version}" + f"\n{forgeReleaseUrlPrefix}v{remote_version}" ) except Exception as error: From 33db232493a7983f52f5063aa8c8d6fe5e3e4bdb Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Sun, 30 Jun 2024 21:01:42 -0400 Subject: [PATCH 4/5] Switch to tagged update checks --- sherlock/__init__.py | 1 - sherlock/sherlock.py | 18 ++++++++---------- tests/test_version.py | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sherlock/__init__.py b/sherlock/__init__.py index 6f968d60..81e04b6a 100644 --- a/sherlock/__init__.py +++ b/sherlock/__init__.py @@ -9,5 +9,4 @@ __shortname__ = "Sherlock" __longname__ = "Sherlock: Find Usernames Across Social Networks" __version__ = "0.15.0" -forgeReleaseUrlPrefix = "https://github.com/sherlock-project/sherlock/releases/tag/" forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest" diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 5a6caaaa..23c9a4d0 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -14,6 +14,7 @@ import os import re import sys from argparse import ArgumentParser, RawDescriptionHelpFormatter +from json import loads as json_loads from time import monotonic import requests @@ -24,8 +25,7 @@ from sherlock.__init__ import ( __longname__, __shortname__, __version__, - forgeReleaseUrlPrefix, - #forgeApiLatestReleaseUrl, + forgeApiLatestReleaseUrl, ) 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 try: - r = requests.get( - "https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/__init__.py" - ) - - remote_version = str(re.findall('__version__ *= *"(.*)"', r.text)[0]) + latestReleaseJsonRaw = requests.get(forgeApiLatestReleaseUrl).text + latestReleaseJsonData = json_loads(latestReleaseJsonRaw) + latestRemoteTag = latestReleaseJsonData["tag_name"] - if remote_version != __version__: + if latestRemoteTag[1:] != __version__: print( - f"Update available! {__version__} --> {remote_version}" - f"\n{forgeReleaseUrlPrefix}v{remote_version}" + f"Update available! {__version__} --> {latestRemoteTag[1:]}" + f"\n{latestReleaseJsonData['html_url']}" ) except Exception as error: diff --git a/tests/test_version.py b/tests/test_version.py index 68119c9e..31578463 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -11,7 +11,6 @@ def test_versioning() -> None: expected:list = [ # Normalization is REQUIRED for Windows ( / vs \ ) os.path.normpath("sherlock/__init__.py"), - os.path.normpath("sherlock/sherlock.py"), ] # Sorting is REQUIRED for Mac assert sorted(found) == sorted(expected) From f9617d4f64988c93fa13c9a963ee9f379d9df94e Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 8 Jul 2024 01:30:32 -0400 Subject: [PATCH 5/5] Address review wrt/snake_case --- sherlock/__init__.py | 2 +- sherlock/sherlock.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sherlock/__init__.py b/sherlock/__init__.py index 81e04b6a..ba780b41 100644 --- a/sherlock/__init__.py +++ b/sherlock/__init__.py @@ -9,4 +9,4 @@ __shortname__ = "Sherlock" __longname__ = "Sherlock: Find Usernames Across Social Networks" __version__ = "0.15.0" -forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest" +forge_api_latest_release = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest" diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 23c9a4d0..4439a41e 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -25,7 +25,7 @@ from sherlock.__init__ import ( __longname__, __shortname__, __version__, - forgeApiLatestReleaseUrl, + forge_api_latest_release, ) from sherlock.result import QueryStatus @@ -668,14 +668,14 @@ def main(): # Check for newer version of Sherlock. If it exists, let the user know about it try: - latestReleaseJsonRaw = requests.get(forgeApiLatestReleaseUrl).text - latestReleaseJsonData = json_loads(latestReleaseJsonRaw) - latestRemoteTag = latestReleaseJsonData["tag_name"] + latest_release_raw = requests.get(forge_api_latest_release).text + latest_release_json = json_loads(latest_release_raw) + latest_remote_tag = latest_release_json["tag_name"] - if latestRemoteTag[1:] != __version__: + if latest_remote_tag[1:] != __version__: print( - f"Update available! {__version__} --> {latestRemoteTag[1:]}" - f"\n{latestReleaseJsonData['html_url']}" + f"Update available! {__version__} --> {latest_remote_tag[1:]}" + f"\n{latest_release_json['html_url']}" ) except Exception as error: