diff options
author | Christian Tismer <tismer@stackless.com> | 2019-09-29 17:13:38 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-09-30 19:00:00 +0200 |
commit | 3f31779af61c064c5bcbebaa588c7fd18a591b0d (patch) | |
tree | b2eef8a6384bf379d9af18aa8bf4be4c7e1af515 /sources/pyside2 | |
parent | 12300111a002926d38afb69e5addb60146f2b2a5 (diff) |
Enable the Function Registry for 5.14 augmented
This patch fixes some small quirks and improves the scraping.
Change-Id: Ia0366e2e29c833fe985353768de166fd538f0d24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r-- | sources/pyside2/tests/registry/init_platform.py | 6 | ||||
-rw-r--r-- | sources/pyside2/tests/registry/scrape_testresults.py | 43 |
2 files changed, 39 insertions, 10 deletions
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py index 1c4261b4b..15cf46097 100644 --- a/sources/pyside2/tests/registry/init_platform.py +++ b/sources/pyside2/tests/registry/init_platform.py @@ -155,7 +155,11 @@ if sys.platform.startswith('linux'): except ImportError: import platform as distro platform_name = "".join(distro.linux_distribution()[:2]).lower() - platform_name = re.sub('[^0-9a-z]', '', platform_name) + # this currently happens on opensuse in 5.14: + if not platform_name: + # We intentionally crash when that last resort is also absent: + platform_name = os.environ["MACHTYPE"] + platform_name = re.sub('[^0-9a-z]', '_', platform_name) else: platform_name = sys.platform # In the linux case, we need more information. diff --git a/sources/pyside2/tests/registry/scrape_testresults.py b/sources/pyside2/tests/registry/scrape_testresults.py index 128269fd5..1e0164be7 100644 --- a/sources/pyside2/tests/registry/scrape_testresults.py +++ b/sources/pyside2/tests/registry/scrape_testresults.py @@ -117,7 +117,7 @@ def find_all_links(text, url, ignore=()): names = list(row["href"] for row in lis) names = list(name for name in names if name not in ignore) for name in names: - if not re.match("^[A-Za-z0-9_\-.]+/?$", name): + if not re.match(r"^[A-Za-z0-9_\-.]+/?$", name): print("Unexpected character in link:", name) # Not clear how to terminate the pool quick and clean. # We crash badly in handle_suburl_tup, ugly but works. @@ -144,8 +144,17 @@ def read_url(url): def get_timestamp(text): # agent:2018/06/29 15:02:15 global stop_all - ts = text[6 : 6 + 19] - ts = re.sub('[^0-9]','_', ts) + prefix = "\nagent:" + try: + startpos = text.index(prefix) + except ValueError: + print("this is not the usual format of COIN log files") + stop_all = True + raise + startpos += len(prefix) + text = text[startpos : startpos + 80] + ts = text[:19] + ts = re.sub(r'[^0-9]', '_', ts) # check that it is a valid time stamp try: datetime.strptime(ts, "%Y_%m_%d_%H_%M_%S") @@ -156,7 +165,14 @@ def get_timestamp(text): return ts def write_data(name, text): - ts = get_timestamp(text) + try: + ts = get_timestamp(text) + except ValueError: + print() + print(name) + print() + print(text) + raise lines = text.split("\n") for idx, line in enumerate(lines): if "BEGIN_FILE" in line: @@ -171,7 +187,7 @@ def write_data(name, text): while lines[-1] == "": lines.pop() text = "\n".join(lines) + "\n" - modname = re.search("'(..*?)'", text).group(1) + modname = re.search(r"'(..*?)'", text).group(1) fn = os.path.join(test_path, f"{ts}-{name}-{modname}.py") if os.path.exists(fn): # do not change the file, we want to skip it @@ -187,14 +203,14 @@ def update_license(text): text = my_text[:my_end_license] + text[end_license:] return text -def eval_data(): +def eval_data(force=False): """ Read all found files, sort them and keep the latest version. """ files = [] for entry in os.scandir(test_path): if "exists_" in entry.name and entry.name.endswith(".py"): - if os.path.getmtime(entry.path) >= start_time: + if force or os.path.getmtime(entry.path) >= start_time: # this file is newly created files.append(entry.path) files.sort() @@ -209,6 +225,7 @@ def eval_data(): name = os.path.join(target_path, fn + ".py") with open(name, "w") as f: f.write(update_license(results[fn])) + print("+++ generated:", name) return len(results) def handle_suburl(idx, n, url, level): @@ -328,14 +345,22 @@ if __name__ == "__main__": Warning: On the first call, this script may take almost 30 minutes to run. Subsequent calls are *much* faster due to caching. + {os.path.basename(my_name)} [-h] eval + + Enforces evaluation when a scan did not complete yet. + For more information, see the file sources/shiboken2/libshiboken/signature_doc.rst """)) subparsers = parser.add_subparsers(dest="command", metavar="", title="required argument") # create the parser for the "scan" command - parser_test = subparsers.add_parser("scan", help="run the scan") + parser_scan = subparsers.add_parser("scan", help="run the scan") + parser_eval = subparsers.add_parser("eval", help="force evaluation") args = parser.parse_args() if not args.command: parser.print_usage() exit(1) - get_test_results("https://testresults.qt.io/coin/api/results/pyside/pyside-setup/") + if args.command == "scan": + get_test_results("https://testresults.qt.io/coin/api/results/pyside/pyside-setup/") + elif args.command == "eval": + eval_data(force=True) |