Skip to content

Commit 6a2670a

Browse files
committed
Add OpenVSX
1 parent 4e031a9 commit 6a2670a

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

repology-schemacheck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
'openmandriva',
9595
'openpkg',
9696
'opensuse',
97+
'openvsx',
9798
'openwrt',
9899
'os4depot',
99100
'pacstall',
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2024 Gavin John <[email protected]>
2+
#
3+
# This file is part of repology
4+
#
5+
# repology is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# repology is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with repology. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import json
19+
20+
from typing import Iterable
21+
22+
from repology.package import LinkType
23+
from repology.packagemaker import NameType, PackageFactory, PackageMaker
24+
from repology.parsers import Parser
25+
26+
27+
class OpenVSXParser(Parser):
28+
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]:
29+
with open(path, 'r') as extdatafile:
30+
extension_data = json.load(extdatafile)
31+
raw_extensions = extension_data['extensions']
32+
33+
for extension in raw_extensions:
34+
with factory.begin() as pkg:
35+
# TODO: More metadata is available, it's just harder to fetch and will require its own fetcher, in all likelihood
36+
pkg.add_name('vscode-extension:{namespace}-{name}'.format(**extension), NameType.GENERIC_SRC_NAME)
37+
pkg.set_version(extension['version'])
38+
pkg.set_summary(extension['description'])
39+
pkg.add_maintainers('{namespace}@openvsx'.format(**extension))
40+
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, 'https://open-vsx.org/extension/{namespace}/{name}'.format(**extension))
41+
pkg.add_links(LinkType.UPSTREAM_DOWNLOAD, extension['files']['download'])
42+
43+
yield pkg

repos.d/openvsx.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
###########################################################################
2+
# OpenVSX
3+
###########################################################################
4+
- name: openvsx
5+
type: repository
6+
desc: OpenVSX
7+
family: openvsx
8+
ruleset: openvsx
9+
minpackages: 3000
10+
sources:
11+
- name: packages
12+
fetcher:
13+
class: FileFetcher
14+
url: https://open-vsx.org/api/-/search?size=10000 # TODO: Do proper pagination
15+
allow_zero_size: false
16+
parser:
17+
class: OpenVSXParser
18+
repolinks:
19+
- desc: OpenVSX registry
20+
url: https://open-vsx.org/
21+
packagelinks: []
22+
groups: [ all, production ]

0 commit comments

Comments
 (0)