Skip to content

Commit

Permalink
Add OpenVSX
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandapip1 committed Sep 11, 2024
1 parent 7880351 commit 2809e14
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions repology-schemacheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'openmandriva',
'openpkg',
'opensuse',
'openvsx',
'openwrt',
'os4depot',
'pacstall',
Expand Down
42 changes: 42 additions & 0 deletions repology/parsers/parsers/openvsx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (C) 2024 Gavin John <gavinnjohn@gmail.com>
#
# 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 <http://www.gnu.org/licenses/>.

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"):
extension_data = json.load()
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
22 changes: 22 additions & 0 deletions repos.d/openvsx.yaml
Original file line number Diff line number Diff line change
@@ -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 ]

0 comments on commit 2809e14

Please sign in to comment.