Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/loader.py
- This file was moved from swh/loader/package/functional/loader.py.
Show All 23 Lines | response = requests.get(url, | ||||
allow_redirects=True) | allow_redirects=True) | ||||
if response.status_code != 200: | if response.status_code != 200: | ||||
raise ValueError("Got %d HTTP code on %s", | raise ValueError("Got %d HTTP code on %s", | ||||
response.status_code, url) | response.status_code, url) | ||||
return json.loads(response.content.decode('utf-8')) | return json.loads(response.content.decode('utf-8')) | ||||
class FunctionalLoader(PackageLoader): | class NixGuixLoader(PackageLoader): | ||||
"""Load sources from a sources.json file. This loader is used to load | """Load sources from a sources.json file. This loader is used to load | ||||
sources used by functional package manager (eg. Nix and Guix). | sources used by functional package manager (eg. Nix and Guix). | ||||
""" | """ | ||||
visit_type = 'functional' | visit_type = 'nixguix' | ||||
def __init__(self, url): | def __init__(self, url): | ||||
super().__init__(url=url) | super().__init__(url=url) | ||||
s = retrieve_sources(url) | s = retrieve_sources(url) | ||||
self.sources = s['sources'] | self.sources = s['sources'] | ||||
self.provider_url = url | self.provider_url = url | ||||
# The revision used to create the sources.json file. For Nix, | # The revision used to create the sources.json file. For Nix, | ||||
# this revision belongs to the github.com/nixos/nixpkgs | # this revision belongs to the github.com/nixos/nixpkgs | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |