diff --git a/net-misc/sherlock/Manifest b/net-misc/sherlock/Manifest index 01d5c3a59..3f1929c3a 100644 --- a/net-misc/sherlock/Manifest +++ b/net-misc/sherlock/Manifest @@ -1 +1 @@ -DIST sherlock-0.7.5_p20190721.tar.gz 1413211 BLAKE2B 3c47e0cd9e4bf334e5dcbac6d70411388ccdc350f760e73f451f33d0bda230a398f0b2e2461835510da64a455714ffd2af472073bb367b2a3f9a857c1e6e94c6 SHA512 aac47fb8de53b7f4bec5a6f637253656c9cfd80e5c4f8d83b47496c94c30010e9050776789783d4daad5212ed228c17d1d75b79812fe1d6e2339f6c295b01915 +DIST sherlock-0.8.2.tar.gz 1415580 BLAKE2B 603b82aa9598d5e0da9ab96cfb9906e946fe9512e09ce3af74bd7138c6a8ffca5540fd785606f381c8af255ae069579bc8d6cdf1a5147f062472e5d71548c1b8 SHA512 c367de86e65c06fc4cd3017a4d585b1e75a6dd68490e78c482a65c5cc3d728a6a5b747ec84a95974c736714d443d0a82c2170b3a1c21ca85d0f0a4a31ea8f141 diff --git a/net-misc/sherlock/files/add_support_custom_data_json.patch b/net-misc/sherlock/files/add_support_custom_data_json.patch new file mode 100644 index 000000000..650be5c5a --- /dev/null +++ b/net-misc/sherlock/files/add_support_custom_data_json.patch @@ -0,0 +1,64 @@ +diff -ur a/site_list.py b/site_list.py +--- a/site_list.py 2019-08-25 03:35:01.000000000 +0300 ++++ b/site_list.py 2019-08-25 17:08:46.958552165 +0300 +@@ -1,8 +1,13 @@ ++#!/usr/bin/env python3 ++ + """Sherlock: Supported Site Listing + This module generates the listing of supported sites. + """ ++ ++import os + import json + import sys ++import shutil + import requests + import threading + import xml.etree.ElementTree as ET +@@ -11,6 +16,8 @@ + + pool = list() + ++DEFAULT_DATA_JSON_FILE = '/usr/share/sherlock/data.json' ++ + def get_rank(domain_to_query, dest): + result = -1 + +@@ -36,12 +43,12 @@ + ) + args = parser.parse_args() + +-with open("data.json", "r", encoding="utf-8") as data_file: +- data = json.load(data_file) ++if os.path.exists(DEFAULT_DATA_JSON_FILE): ++ shutil.copyfile(DEFAULT_DATA_JSON_FILE, 'data.json') + +-with open("sites.md", "w") as site_file: ++with open('data.json', "r", encoding="utf-8") as data_file: ++ data = json.load(data_file) + data_length = len(data) +- site_file.write(f'## List Of Supported Sites ({data_length} Sites In Total!)\n') + + for social_network in data: + url_main = data.get(social_network).get("urlMain") +@@ -58,17 +65,14 @@ + for social_network, url_main, th in pool: + if args.rank: + th.join() +- site_file.write(f'{index}. [{social_network}]({url_main})\n') + sys.stdout.write("\r{0}".format(f"Updated {index} out of {data_length} entries")) + sys.stdout.flush() + index = index + 1 + +- if args.rank: +- site_file.write(f'\nAlexa.com rank data fetched at ({datetime.utcnow()} UTC)\n') +- + sorted_json_data = json.dumps(data, indent=2, sort_keys=True) + +-with open("data.json", "w") as data_file: ++with open('data.json', "w") as data_file: + data_file.write(sorted_json_data) + +-print("\nFinished updating supported site listing!") ++print("\nFinished updating supported site listing in: " + os.path.abspath('data.json')) ++print("\nUsage: sherlock --json " + os.path.abspath('data.json') + ' USERNAMES [USERNAMES ...]') diff --git a/net-misc/sherlock/sherlock-0.7.5_p20190721.ebuild b/net-misc/sherlock/sherlock-0.8.2.ebuild similarity index 100% rename from net-misc/sherlock/sherlock-0.7.5_p20190721.ebuild rename to net-misc/sherlock/sherlock-0.8.2.ebuild diff --git a/net-misc/sherlock/sherlock-9999.ebuild b/net-misc/sherlock/sherlock-9999.ebuild index 186057128..e380f1940 100644 --- a/net-misc/sherlock/sherlock-9999.ebuild +++ b/net-misc/sherlock/sherlock-9999.ebuild @@ -14,8 +14,8 @@ if [[ ${PV} == *9999 ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/sherlock-project/sherlock" else - # snapshot: 20190721 - HASH_COMMIT="4e04e122a0756e8f4839e79a77cbdbcf4d42453c" + # snapshot: 20190825 + HASH_COMMIT="6914c308a36df42929b31d0ee20cdb8dc53a1dfa" SRC_URI="https://github.com/sherlock-project/sherlock/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz" KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86" @@ -24,9 +24,10 @@ fi LICENSE="MIT" SLOT=0 - +#IUSE="test" IUSE="" REQUIRED_USE="${PYTHON_REQUIRED_USE}" + RDEPEND="${PYTHON_DEPS} dev-python/beautifulsoup:4[${PYTHON_USEDEP}] dev-python/certifi[${PYTHON_USEDEP}] @@ -47,21 +48,28 @@ pkg_setup() { } src_prepare() { - sed -e "s/__version__ = \"\(.*\)\"/__version__ = \"${PV}\"/" \ - -i sherlock.py || die + eapply "${FILESDIR}"/add_support_custom_data_json.patch + + if [[ ${PV} != *9999 ]]; then + sed -e "s/__version__ = \"\(.*\)\"/__version__ = \"${PV}\"/" \ + -i sherlock.py || die + fi - python_fix_shebang "${S}" default } +src_test() { + : +} + src_install() { insinto "/usr/share/${PN}" - doins -r data.json *.py + doins data.json *.py python_optimize "${D}/usr/share/${PN}" - make_wrapper $PN \ - "python3 /usr/share/${PN}/sherlock.py" + make_wrapper ${PN} "python3 /usr/share/${PN}/sherlock.py" + make_wrapper ${PN}-get-sitelist "python3 /usr/share/${PN}/site_list.py" dodoc *.md Dockerfile }