diff --git a/repology-schemacheck.py b/repology-schemacheck.py index 566d949f..8080a67c 100755 --- a/repology-schemacheck.py +++ b/repology-schemacheck.py @@ -94,6 +94,7 @@ 'openmandriva', 'openpkg', 'opensuse', + 'openvsx', 'openwrt', 'os4depot', 'pacstall', diff --git a/repology/parsers/parsers/openvsx.py b/repology/parsers/parsers/openvsx.py new file mode 100644 index 00000000..a04ed02f --- /dev/null +++ b/repology/parsers/parsers/openvsx.py @@ -0,0 +1,42 @@ +# Copyright (C) 2024 Gavin John +# +# This file is part of repology +# +# repology is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# repology is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with repology. If not, see . + +import json + +from typing import Iterable + +from repology.packagemaker import NameType, PackageFactory, PackageMaker +from repology.parsers import Parser + + +class OpenVSXParser(Parser): + def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]: + with open(path, 'r') as extdatafile: + extension_data = json.load(extdatafile) + raw_extensions = extension_data['extensions'] + + for extension in raw_extensions: + with factory.begin() as pkg: + # TODO: More metadata is available, it's just harder to fetch and will require its own fetcher, in all likelihood + pkg.add_name('vscode-extension:{namespace}-{name}'.format(**extension), NameType.GENERIC_SRC_NAME) + pkg.set_version(extension['version']) + pkg.set_summary(extension['description']) + pkg.add_maintainers('{namespace}@openvsx'.format(**extension)) + pkg.add_homepages('https://open-vsx.org/extension/{namespace}/{name}'.format(**extension)) + pkg.add_downloads(extension['files']['download']) + + yield pkg diff --git a/repos.d/openvsx.yaml b/repos.d/openvsx.yaml new file mode 100644 index 00000000..61b88387 --- /dev/null +++ b/repos.d/openvsx.yaml @@ -0,0 +1,22 @@ +########################################################################### +# OpenVSX +########################################################################### +- name: openvsx + type: repository + desc: OpenVSX + family: openvsx + ruleset: openvsx + minpackages: 3000 + sources: + - name: packages + fetcher: + class: FileFetcher + url: https://open-vsx.org/api/-/search?size=10000 # TODO: Do proper pagination + allow_zero_size: false + parser: + class: OpenVSXParser + repolinks: + - desc: OpenVSX registry + url: https://open-vsx.org/ + packagelinks: [] + groups: [ all, production ]