diff options
author | K900 <me@0upti.me> | 2024-03-12 21:12:35 +0300 |
---|---|---|
committer | K900 <me@0upti.me> | 2024-03-12 21:15:17 +0300 |
commit | 96e439e0291fa37103ef6c5ad91739a969fbae0d (patch) | |
tree | 22f02fe8052735b77a7af0a22bea41bca2d7d7cb /maintainers | |
parent | 06fc9197890a2b26a404a83adc1465091f1fec40 (diff) | |
download | nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar.gz nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar.bz2 nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar.lz nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar.xz nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.tar.zst nixlib-96e439e0291fa37103ef6c5ad91739a969fbae0d.zip |
maintainers/scripts/kde/generate-sources: allow overriding sources URL
Diffstat (limited to 'maintainers')
-rwxr-xr-x | maintainers/scripts/kde/generate-sources.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/maintainers/scripts/kde/generate-sources.py b/maintainers/scripts/kde/generate-sources.py index 380213ee6907..7b3b2ac35d26 100755 --- a/maintainers/scripts/kde/generate-sources.py +++ b/maintainers/scripts/kde/generate-sources.py @@ -4,6 +4,7 @@ import base64 import binascii import json import pathlib +from typing import Optional from urllib.parse import urlparse import bs4 @@ -57,19 +58,26 @@ def to_sri(hash): ), default=pathlib.Path(__file__).parent.parent.parent.parent ) -def main(set: str, version: str, nixpkgs: pathlib.Path): +@click.option( + "--sources-url", + type=str, + default=None, +) +def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: Optional[str]): root_dir = nixpkgs / "pkgs/kde" set_dir = root_dir / set generated_dir = root_dir / "generated" metadata = utils.KDERepoMetadata.from_json(generated_dir) - set_url = { - "frameworks": "kf", - "gear": "releases", - "plasma": "plasma", - }[set] + if sources_url is None: + set_url = { + "frameworks": "kf", + "gear": "releases", + "plasma": "plasma", + }[set] + sources_url = f"https://kde.org/info/sources/source-{set_url}-{version}.html" - sources = httpx.get(f"https://kde.org/info/sources/source-{set_url}-{version}.html") + sources = httpx.get(sources_url) sources.raise_for_status() bs = bs4.BeautifulSoup(sources.text, features="html.parser") |