Skip to content

Commit 1836735

Browse files
committed
Merge branch 'bump-version' into release/0.15.0-rc2
2 parents ba3952d + f9617d4 commit 1836735

File tree

3 files changed

+23
-29
lines changed

3 files changed

+23
-29
lines changed

sherlock_project/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010

1111
__shortname__ = "Sherlock"
1212
__longname__ = "Sherlock: Find Usernames Across Social Networks"
13-
__version__ = "0.14.4"
13+
__version__ = "0.15.0"
14+
15+
forge_api_latest_release = "https://api.github.com/repos/sherlock-project/sherlock/releases/latest"

sherlock_project/sherlock.py

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,26 @@
2222
import os
2323
import re
2424
from argparse import ArgumentParser, RawDescriptionHelpFormatter
25+
from json import loads as json_loads
2526
from time import monotonic
2627

2728
import requests
29+
from requests_futures.sessions import FuturesSession
2830

29-
# Removing __version__ here will trigger update message for users
30-
# Do not remove until ready to trigger that message
31-
# When removed, also remove all the noqa: E402 comments for linting
32-
__version__ = "0.14.4"
33-
del __version__
34-
35-
from sherlock_project.__init__ import ( # noqa: E402
31+
from sherlock_project.__init__ import (
3632
__longname__,
37-
__version__
33+
__shortname__,
34+
__version__,
35+
forge_api_latest_release,
3836
)
3937

40-
from requests_futures.sessions import FuturesSession # noqa: E402
41-
from torrequest import TorRequest # noqa: E402
42-
from sherlock_project.result import QueryStatus # noqa: E402
43-
from sherlock_project.result import QueryResult # noqa: E402
44-
from sherlock_project.notify import QueryNotify # noqa: E402
45-
from sherlock_project.notify import QueryNotifyPrint # noqa: E402
46-
from sherlock_project.sites import SitesInformation # noqa: E402
47-
from colorama import init # noqa: E402
48-
from argparse import ArgumentTypeError # noqa: E402
38+
from sherlock_project.result import QueryStatus
39+
from sherlock_project.result import QueryResult
40+
from sherlock_project.notify import QueryNotify
41+
from sherlock_project.notify import QueryNotifyPrint
42+
from sherlock_project.sites import SitesInformation
43+
from colorama import init
44+
from argparse import ArgumentTypeError
4945

5046

5147
class SherlockFuturesSession(FuturesSession):
@@ -560,7 +556,7 @@ def main():
560556
parser.add_argument(
561557
"--version",
562558
action="version",
563-
version=f"Sherlock v{__version__}",
559+
version=f"{__shortname__} v{__version__}",
564560
help="Display version information and dependencies.",
565561
)
566562
parser.add_argument(
@@ -715,17 +711,14 @@ def main():
715711

716712
# Check for newer version of Sherlock. If it exists, let the user know about it
717713
try:
718-
r = requests.get(
719-
"https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/__init__.py"
720-
)
721-
722-
remote_version = str(re.findall('__version__ *= *"(.*)"', r.text)[0])
723-
local_version = __version__
714+
latest_release_raw = requests.get(forge_api_latest_release).text
715+
latest_release_json = json_loads(latest_release_raw)
716+
latest_remote_tag = latest_release_json["tag_name"]
724717

725-
if remote_version != local_version:
718+
if latest_remote_tag[1:] != __version__:
726719
print(
727-
"Update Available!\n"
728-
+ f"You are running version {local_version}. Version {remote_version} is available at https://github.com/sherlock-project/sherlock"
720+
f"Update available! {__version__} --> {latest_remote_tag[1:]}"
721+
f"\n{latest_release_json['html_url']}"
729722
)
730723

731724
except Exception as error:

tests/test_version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def test_versioning() -> None:
1111
expected:list = [
1212
# Normalization is REQUIRED for Windows ( / vs \ )
1313
os.path.normpath("sherlock_project/__init__.py"),
14-
os.path.normpath("sherlock_project/sherlock.py"),
1514
]
1615
# Sorting is REQUIRED for Mac
1716
assert sorted(found) == sorted(expected)

0 commit comments

Comments
 (0)