maintainers/scripts/kde/generate-sources: allow overriding sources URL
This commit is contained in:
parent
06fc919789
commit
96e439e029
|
@ -4,6 +4,7 @@ import base64
|
||||||
import binascii
|
import binascii
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
from typing import Optional
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import bs4
|
import bs4
|
||||||
|
@ -57,19 +58,26 @@ def to_sri(hash):
|
||||||
),
|
),
|
||||||
default=pathlib.Path(__file__).parent.parent.parent.parent
|
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"
|
root_dir = nixpkgs / "pkgs/kde"
|
||||||
set_dir = root_dir / set
|
set_dir = root_dir / set
|
||||||
generated_dir = root_dir / "generated"
|
generated_dir = root_dir / "generated"
|
||||||
metadata = utils.KDERepoMetadata.from_json(generated_dir)
|
metadata = utils.KDERepoMetadata.from_json(generated_dir)
|
||||||
|
|
||||||
set_url = {
|
if sources_url is None:
|
||||||
"frameworks": "kf",
|
set_url = {
|
||||||
"gear": "releases",
|
"frameworks": "kf",
|
||||||
"plasma": "plasma",
|
"gear": "releases",
|
||||||
}[set]
|
"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()
|
sources.raise_for_status()
|
||||||
bs = bs4.BeautifulSoup(sources.text, features="html.parser")
|
bs = bs4.BeautifulSoup(sources.text, features="html.parser")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user