def build_feedstock_index(filename, gh_org='conda-forge'):
    "Iterate over feedstocks and return dict of pkg-name:feedstock"
    pkg_index = {}
    for repo in feedstocks.feedstock_repos(gh_org):
        try:
            meta = repo.get_file_contents(path='recipe/meta.yaml').decoded_content
            pkg_name = _extract_package_name(meta)
        except (AttributeError, KeyError, ScannerError) as err:
            # unable to parse the bob.io.image-feedstock
            print('Unable to parse meta.yaml for {}'.format(repo.url))
            print('guessing pkg name from feedstock url')
            print('Traceback: \n', err)
            pkg_name = repo.url.split('/')[-1].split('-feedstock')[0].lower()
        pkg_index[pkg_name] = repo.full_name

    with open(filename, 'w') as f:
        json.dump(pkg_index, f)
        print('feedstocks index written to {}'.format(filename))
def build_feedstock_index(filename, gh_org='conda-forge'):
    "Iterate over feedstocks and return dict of pkg-name:feedstock"
    pkg_index = {}
    for repo in feedstocks.feedstock_repos(gh_org):
        try:
            meta = repo.get_file_contents(
                path='recipe/meta.yaml').decoded_content
            pkg_name = _extract_package_name(meta)
        except (AttributeError, KeyError, ScannerError) as err:
            # unable to parse the bob.io.image-feedstock
            print('Unable to parse meta.yaml for {}'.format(repo.url))
            print('guessing pkg name from feedstock url')
            print('Traceback: \n', err)
            pkg_name = repo.url.split('/')[-1].split('-feedstock')[0].lower()
        pkg_index[pkg_name] = repo.full_name

    with open(filename, 'w') as f:
        json.dump(pkg_index, f)
        print('feedstocks index written to {}'.format(filename))
Beispiel #3
0
import argparse

import warnings

parser = argparse.ArgumentParser(
    description='Update the conda-forge/feedstocks repo.')
parser.add_argument(
    'feedstocks_repo',
    help="The location of the checked out conda-forge/feedstocks repo.")

args = parser.parse_args()

feedstocks_repo = Repo(args.feedstocks_repo)

forge_feedstocks = feedstocks.feedstock_repos('conda-forge')

# Identify the submodule names which lie withing the repo.
submodules = {sm.name: sm for sm in feedstocks_repo.submodules}

for feedstock in forge_feedstocks:
    repo_subdir = os.path.join('feedstocks', feedstock.package_name)
    abs_subdir = os.path.join(feedstocks_repo.working_tree_dir, repo_subdir)
    if not os.path.exists(abs_subdir):
        print('Adding {} to submodules.'.format(feedstock.package_name))

        # For situations where the submodule already exists, but not in the expected locations, just
        # remove it, and re-add.
        if feedstock.package_name in submodules:
            feedstocks_repo.submodules[feedstock.package_name].remove()
import os

import conda_smithy.feedstocks as feedstocks
from git import Repo

import argparse

parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('feedstocks_repo', help="The location of the checked out conda-forge/feedstocks repo.")

args = parser.parse_args()

feedstocks_repo = Repo(args.feedstocks_repo)

for feedstock in feedstocks.feedstock_repos('conda-forge'):
    repo_subdir = os.path.join('feedstocks', feedstock.package_name)
    abs_subdir = os.path.join(feedstocks_repo.working_tree_dir, repo_subdir)
    sm_names = [sm.name for sm in feedstocks_repo.submodules]
    if not os.path.exists(abs_subdir):
        print('Adding {} to submodules.'.format(feedstock.package_name))

        # For situations where the submodule already exists, but not in the expected locations, just
        # remove it, and re-add.
        if feedstock.package_name in sm_names:
            feedstocks_repo.submodules[feedstock.package_name].remove()

        # Add the new submodule.
        feedstocks_repo.create_submodule(feedstock.package_name, repo_subdir,
                                         url=feedstock.clone_url,
                                         branch='master')
# channels:
#  - conda-forge
# run_with: python

import os

import conda_smithy.feedstocks as feedstocks

from jinja2 import Environment, FileSystemLoader

import argparse

parser = argparse.ArgumentParser(description='Generate the conda-forge html.')
parser.add_argument('--html-source',
                    help="The location of the conda-forge.github.io checkout.",
                    default=os.path.abspath(
                        os.path.dirname(os.path.dirname(__file__))))

args = parser.parse_args()

html_source = args.html_source
loader = FileSystemLoader(html_source)
env = Environment(loader=loader)

context = {}
context['gh_feedstocks'] = feedstocks.feedstock_repos('conda-forge')

tmpl = env.get_template('feedstocks.html.tmpl')
with open(os.path.join(html_source, 'feedstocks.html'), 'w') as fh:
    fh.write(tmpl.render(context))
import conda_smithy.feedstocks as feedstocks
from git import Repo
from git.exc import GitCommandError

import argparse

import warnings

parser = argparse.ArgumentParser(description='Update the conda-forge/feedstocks repo.')
parser.add_argument('feedstocks_repo', help="The location of the checked out conda-forge/feedstocks repo.")

args = parser.parse_args()

feedstocks_repo = Repo(args.feedstocks_repo)

forge_feedstocks = feedstocks.feedstock_repos('conda-forge')

# Identify the submodule names which lie withing the repo.
submodules = {sm.name: sm for sm in feedstocks_repo.submodules}

for feedstock in forge_feedstocks:
    repo_subdir = os.path.join('feedstocks', feedstock.package_name)
    abs_subdir = os.path.join(feedstocks_repo.working_tree_dir, repo_subdir)
    if not os.path.exists(abs_subdir):
        print('Adding {} to submodules.'.format(feedstock.package_name))

        # For situations where the submodule already exists, but not in the expected locations, just
        # remove it, and re-add.
        if feedstock.package_name in submodules:
            feedstocks_repo.submodules[feedstock.package_name].remove()
#  - conda-smithy
# channels:
#  - conda-forge
# run_with: python

import os

import conda_smithy.feedstocks as feedstocks

from jinja2 import Environment, FileSystemLoader

import argparse

parser = argparse.ArgumentParser(description='Generate the conda-forge html.')
parser.add_argument('--html-source', help="The location of the conda-forge.github.io checkout.",
                   default=os.path.abspath(os.path.dirname(os.path.dirname(__file__))))

args = parser.parse_args()

html_source = args.html_source
loader = FileSystemLoader(html_source)
env = Environment(loader=loader)

context = {}
context['gh_feedstocks'] = feedstocks.feedstock_repos('conda-forge')


tmpl = env.get_template('feedstocks.html.tmpl')
with open(os.path.join(html_source, 'feedstocks.html'), 'w') as fh:
    fh.write(tmpl.render(context))