diff --git a/ci-support.sh b/ci-support.sh index afca97492b460e75bb5e676230e9a8df9f8bf341..25ae673fa8722a35c366d3729395ca835672143c 100644 --- a/ci-support.sh +++ b/ci-support.sh @@ -611,7 +611,8 @@ function build_asv_html asv publish --html-dir doc/_build/html/benchmarks } -function build_and_run_benchmarks { +function build_and_run_benchmarks +{ setup_asv clone_results_repo run_asv @@ -620,4 +621,14 @@ function build_and_run_benchmarks { # }}} +# {{{ transfer_requirements_git_urls + +function transfer_requirements_git_urls() +{ + curl -L -O "${ci_support}transfer-requirements-git-urls" + ./transfer-requirements-git-urls "$@" +} + +# }}} + # vim: foldmethod=marker:sw=2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3d66394d19b145c8311cc6d763b6648d2993a034 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[flake8] +ignore = E126,E127,E128,E123,E226,E241,E242,E265,E402,W503,E731 +max-line-length=85 + +inline-quotes = " +docstring-quotes = " +multiline-quotes = """ + +# enable-flake8-bugbear + +[wheel] +universal = 1 + +[mypy] +ignore_missing_imports = True + +[mypy-pytools.mpiwrap] +ignore_errors = True + +[mypy-pytools.persistent_dict] +ignore_errors = True + +[mypy-pytools.stopwatch] +ignore_errors = True diff --git a/transfer-requirements-git-urls b/transfer-requirements-git-urls new file mode 100755 index 0000000000000000000000000000000000000000..9f2a530c86bc1afdc6c29d8104b57000774b206d --- /dev/null +++ b/transfer-requirements-git-urls @@ -0,0 +1,73 @@ +#! /usr/bin/env python3 + +import sys +import pathlib +import re + + +vcs_url_re = re.compile( + r"(git\+[a-z]+://[-a-zA-Z0-9./]+)" + "((?:@[-_a-zA-Z0-9]+)?)" + r"\#egg=([-a-zA-Z0-9_.]+)" + ) + + +def main(): + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("from_file", metavar="FROM_REQ.TXT") + parser.add_argument("to_file", metavar="TO_REQ.TXT") + args = parser.parse_args() + + pkg_to_url_branch = {} + with pathlib.Path(args.from_file).open() as req_txt: + for ln in req_txt: + ln = ln.strip() + if not ln: + continue + if ln.startswith("#"): + continue + + match = vcs_url_re.search(ln) + if not match: + continue + + branch = match.group(2) + if branch: + assert branch.startswith("@") + branch = branch[1:] + + pkg_to_url_branch[match.group(3)] = ( + match.group(1), + branch, + ) + + with pathlib.Path(args.to_file).open() as req_txt: + result = [] + for ln in req_txt: + lnread = ln.strip() + if not lnread: + result.append(ln) + if lnread.startswith("#"): + result.append(ln) + + match = vcs_url_re.search(lnread) + if match and match.group(3) in pkg_to_url_branch: + projname = match.group(3) + base_url, branch = pkg_to_url_branch[projname] + pkgspec = f"{base_url}" + if branch: + pkgspec += f"@{branch}" + pkgspec += f"#egg={projname}" + + result.append(vcs_url_re.sub(pkgspec, ln)) + else: + result.append(ln) + + with pathlib.Path(args.to_file).open("w") as req_txt: + req_txt.write("".join(result)) + + +if __name__ == "__main__": + main()