Skip to content

Commit

Permalink
Add code to parse conda channels (not enabled) (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Dec 13, 2018
1 parent 3c67c80 commit 7d7a171
Show file tree
Hide file tree
Showing 3 changed files with 68 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 @@ -36,6 +36,7 @@
'buckaroo',
'centos',
'chocolatey',
'conda',
'cpan',
'cran',
'crates_io',
Expand Down
33 changes: 33 additions & 0 deletions repology/parsers/parsers/conda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (C) 2018 Dmitry Marakasov <[email protected]>
#
# 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 repology.parsers import Parser


class CondaRepodataJsonParser(Parser):
def iter_parse(self, path, factory):
with open(path, 'r', encoding='utf-8') as jsonfile:
for pkgfilename, pkgdata in json.load(jsonfile)['packages'].items():
pkg = factory.begin(pkgfilename)

pkg.set_name(pkgdata['name'])
pkg.set_version(pkgdata['version'])
pkg.add_licenses(pkgdata.get('license', ''))

yield pkg
34 changes: 34 additions & 0 deletions repos.d/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
###########################################################################
# Conda
###########################################################################
- name: conda_forge
type: repository
desc: conda-forge
family: conda
minpackages: 1
sources:
- name: [noarch, linux-32, linux-64, osx-64, win-32, win-64]
fetcher: FileFetcher
parser: CondaRepodataJsonParser
url: 'https://conda.anaconda.org/conda-forge/{source}/repodata.json'
subrepo: '{source}'
repolinks:
- desc: conda-forge home
url: https://conda-forge.org/
tags: [ all, experimental, conda ]

- name: bioconda
type: repository
desc: Bioconda
family: conda
minpackages: 1
sources:
- name: [noarch, linux-32, linux-64, osx-32, osx-64, win-32, win-64]

This comment has been minimized.

Copy link
@epruesse

epruesse Dec 13, 2018

Bioconda has only noarch, linux-64 and osx-64. It's rather unlikely that windows or 32 bit will ever be added.

This comment has been minimized.

Copy link
@AMDmi3

AMDmi3 Dec 13, 2018

Author Member

Others are included for completeness. There's no problem if they are empty.

fetcher: FileFetcher
parser: CondaRepodataJsonParser
url: 'https://conda.anaconda.org/bioconda/{source}/repodata.json'
subrepo: '{source}'
repolinks:
- desc: Bioconda home
url: https://bioconda.github.io/
tags: [ all, experimental, conda ]

0 comments on commit 7d7a171

Please sign in to comment.