diff --git a/stubs/JACK-Client/METADATA.toml b/stubs/JACK-Client/METADATA.toml index 9bc819273..f18e0144f 100644 --- a/stubs/JACK-Client/METADATA.toml +++ b/stubs/JACK-Client/METADATA.toml @@ -1,4 +1,5 @@ version = "0.5.*" +upstream_repository = "https://github.com/spatialaudio/jackclient-python" # Requires a version of numpy with a `py.typed` file requires = ["numpy>=1.20", "types-cffi"] diff --git a/stubs/WebOb/METADATA.toml b/stubs/WebOb/METADATA.toml index 690242a33..b3a8d04df 100644 --- a/stubs/WebOb/METADATA.toml +++ b/stubs/WebOb/METADATA.toml @@ -1 +1,2 @@ version = "1.8.*" +upstream_repository = "https://github.com/Pylons/webob" diff --git a/stubs/beautifulsoup4/METADATA.toml b/stubs/beautifulsoup4/METADATA.toml index 9be859b59..bfa9247a7 100644 --- a/stubs/beautifulsoup4/METADATA.toml +++ b/stubs/beautifulsoup4/METADATA.toml @@ -1,4 +1,5 @@ version = "4.12.*" +upstream_repository = "https://git.launchpad.net/beautifulsoup/tree" requires = ["types-html5lib"] partial_stub = true diff --git a/stubs/braintree/METADATA.toml b/stubs/braintree/METADATA.toml index 8fb64e259..b5cad7abd 100644 --- a/stubs/braintree/METADATA.toml +++ b/stubs/braintree/METADATA.toml @@ -1,4 +1,5 @@ version = "4.21.*" +upstream_repository = "https://github.com/braintree/braintree_python" partial_stub = true [tool.stubtest] diff --git a/stubs/cffi/METADATA.toml b/stubs/cffi/METADATA.toml index 3a9cb22e1..6bd875a85 100644 --- a/stubs/cffi/METADATA.toml +++ b/stubs/cffi/METADATA.toml @@ -1,4 +1,5 @@ version = "1.15.*" +upstream_repository = "https://foss.heptapod.net/pypy/cffi" requires = ["types-setuptools"] [tool.stubtest] diff --git a/stubs/docopt/METADATA.toml b/stubs/docopt/METADATA.toml index 03031f1e9..275fa883d 100644 --- a/stubs/docopt/METADATA.toml +++ b/stubs/docopt/METADATA.toml @@ -1 +1,2 @@ version = "0.6.*" +upstream_repository = "https://github.com/docopt/docopt" diff --git a/stubs/docutils/METADATA.toml b/stubs/docutils/METADATA.toml index 647482d55..03effc9d7 100644 --- a/stubs/docutils/METADATA.toml +++ b/stubs/docutils/METADATA.toml @@ -1,4 +1,5 @@ version = "0.20.*" +upstream_repository = "https://sourceforge.net/p/docutils/code" partial_stub = true [tool.stubtest] diff --git a/stubs/gdb/METADATA.toml b/stubs/gdb/METADATA.toml index a0d8f2902..dc8b117e3 100644 --- a/stubs/gdb/METADATA.toml +++ b/stubs/gdb/METADATA.toml @@ -1,4 +1,7 @@ version = "12.1.*" +# This is the official web portal for GDB, +# see https://sourceware.org/gdb/current/ for other ways of obtaining the source code. +upstream_repository = "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=tree" extra_description = """\ Type hints for GDB's \ [Python API](https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html). \ diff --git a/stubs/hdbcli/METADATA.toml b/stubs/hdbcli/METADATA.toml index f37098fcf..84c775a54 100644 --- a/stubs/hdbcli/METADATA.toml +++ b/stubs/hdbcli/METADATA.toml @@ -1 +1,2 @@ version = "2.17.*" +# upstream_repository = closed-source diff --git a/stubs/humanfriendly/METADATA.toml b/stubs/humanfriendly/METADATA.toml index 21700a749..c8518e705 100644 --- a/stubs/humanfriendly/METADATA.toml +++ b/stubs/humanfriendly/METADATA.toml @@ -1,4 +1,5 @@ version = "10.0.*" +upstream_repository = "https://github.com/xolox/python-humanfriendly" [tool.stubtest] stubtest_requirements = ["docutils", "mock"] diff --git a/stubs/ibm-db/METADATA.toml b/stubs/ibm-db/METADATA.toml index 84307529a..e02e23ad3 100644 --- a/stubs/ibm-db/METADATA.toml +++ b/stubs/ibm-db/METADATA.toml @@ -1 +1,2 @@ version = "3.1.*" +upstream_repository = "https://github.com/ibmdb/python-ibmdb" diff --git a/stubs/inifile/METADATA.toml b/stubs/inifile/METADATA.toml index 582104d3a..ff2e16bd4 100644 --- a/stubs/inifile/METADATA.toml +++ b/stubs/inifile/METADATA.toml @@ -1 +1,2 @@ version = "0.4.*" +upstream_repository = "https://github.com/mitsuhiko/python-inifile" diff --git a/stubs/paho-mqtt/METADATA.toml b/stubs/paho-mqtt/METADATA.toml index 6cf9fae44..11a8c8820 100644 --- a/stubs/paho-mqtt/METADATA.toml +++ b/stubs/paho-mqtt/METADATA.toml @@ -1 +1,2 @@ version = "1.6.*" +upstream_repository = "https://github.com/eclipse/paho.mqtt.python" diff --git a/stubs/passlib/METADATA.toml b/stubs/passlib/METADATA.toml index ef7966007..c1eabfd07 100644 --- a/stubs/passlib/METADATA.toml +++ b/stubs/passlib/METADATA.toml @@ -1 +1,2 @@ version = "1.7.*" +upstream_repository = "https://foss.heptapod.net/python-libs/passlib" diff --git a/stubs/pexpect/METADATA.toml b/stubs/pexpect/METADATA.toml index ef6637ec5..c484c720f 100644 --- a/stubs/pexpect/METADATA.toml +++ b/stubs/pexpect/METADATA.toml @@ -1 +1,2 @@ version = "4.8.*" +upstream_repository = "https://github.com/pexpect/pexpect" diff --git a/stubs/protobuf/METADATA.toml b/stubs/protobuf/METADATA.toml index 3fe25cf08..01c72968f 100644 --- a/stubs/protobuf/METADATA.toml +++ b/stubs/protobuf/METADATA.toml @@ -1,5 +1,6 @@ version = "4.24.*" -extra_description = "Generated with aid from mypy-protobuf v3.4.0" +upstream_repository = "https://github.com/protocolbuffers/protobuf" +extra_description = "Generated with aid from [mypy-protobuf](https://github.com/nipunn1313/mypy-protobuf) v3.4.0" partial_stub = true [tool.stubtest] diff --git a/stubs/pyaudio/METADATA.toml b/stubs/pyaudio/METADATA.toml index 477c39829..68f013087 100644 --- a/stubs/pyaudio/METADATA.toml +++ b/stubs/pyaudio/METADATA.toml @@ -1,4 +1,6 @@ version = "0.2.*" +# There is no web portal for the source, this is the official source link: +# upstream_repository = "https://people.csail.mit.edu/hubert/pyaudio/#sources" [tool.stubtest] # linux and win32 are equivalent diff --git a/stubs/pycurl/METADATA.toml b/stubs/pycurl/METADATA.toml index 6a7699667..a50bf4154 100644 --- a/stubs/pycurl/METADATA.toml +++ b/stubs/pycurl/METADATA.toml @@ -1,4 +1,5 @@ version = "7.45.2" +upstream_repository = "https://github.com/pycurl/pycurl" [tool.stubtest] # Install on Windows requires building PycURL from source diff --git a/stubs/python-nmap/METADATA.toml b/stubs/python-nmap/METADATA.toml index 7431acfe0..03ac98d97 100644 --- a/stubs/python-nmap/METADATA.toml +++ b/stubs/python-nmap/METADATA.toml @@ -1 +1,2 @@ version = "0.7.*" +upstream_repository = "https://bitbucket.org/xael/python-nmap" diff --git a/stubs/pytz/METADATA.toml b/stubs/pytz/METADATA.toml index 7c6bf92b0..334d21947 100644 --- a/stubs/pytz/METADATA.toml +++ b/stubs/pytz/METADATA.toml @@ -1 +1,3 @@ version = "2023.3" +# This is a mirror of https://git.launchpad.net/pytz/tree, see https://pythonhosted.org/pytz/#latest-versions +upstream_repository = "https://github.com/stub42/pytz" diff --git a/stubs/untangle/METADATA.toml b/stubs/untangle/METADATA.toml index 249b0a7c0..7510b283e 100644 --- a/stubs/untangle/METADATA.toml +++ b/stubs/untangle/METADATA.toml @@ -1 +1,2 @@ version = "1.2.*" +upstream_repository = "https://github.com/stchris/untangle" diff --git a/tests/parse_metadata.py b/tests/parse_metadata.py index 483eb034c..5360054fa 100644 --- a/tests/parse_metadata.py +++ b/tests/parse_metadata.py @@ -31,6 +31,8 @@ __all__ = [ _STUBTEST_PLATFORM_MAPPING: Final = {"linux": "apt_dependencies", "darwin": "brew_dependencies", "win32": "choco_dependencies"} +# Some older websites have a bad pattern of using query params for navigation. +_QUERY_URL_ALLOWLIST = {"sourceware.org"} def _is_list_of_strings(obj: object) -> TypeGuard[list[str]]: @@ -202,10 +204,17 @@ def read_metadata(distribution: str) -> StubMetadata: assert isinstance(upstream_repository, (str, type(None))) if isinstance(upstream_repository, str): parsed_url = urllib.parse.urlsplit(upstream_repository) - assert parsed_url.scheme == "https", "URLs in the upstream_repository field should use https" - assert not parsed_url.netloc.startswith("www."), "`www.` should be removed from URLs in the upstream_repository field" - assert not parsed_url.query - assert not parsed_url.fragment + assert parsed_url.scheme == "https", f"{distribution}: URLs in the upstream_repository field should use https" + no_www_please = ( + f"{distribution}: `World Wide Web` subdomain (`www.`) should be removed from URLs in the upstream_repository field" + ) + assert not parsed_url.netloc.startswith("www."), no_www_please + no_query_params_please = ( + f"{distribution}: Query params (`?`) should be removed from URLs in the upstream_repository field" + ) + assert parsed_url.hostname in _QUERY_URL_ALLOWLIST or (not parsed_url.query), no_query_params_please + no_fragments_please = f"{distribution}: Fragments (`#`) should be removed from URLs in the upstream_repository field" + assert not parsed_url.fragment, no_fragments_please if parsed_url.netloc == "github.com": cleaned_url_path = parsed_url.path.strip("/") num_url_path_parts = len(Path(cleaned_url_path).parts)