Skip to content

Commit

Permalink
Merge pull request #17 from pelson/handle_jinja
Browse files Browse the repository at this point in the history
Handled Jinja2 templates for team management.
  • Loading branch information
pelson committed Feb 10, 2016
2 parents d11559c + d33e57e commit 3163f91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .ci_scripts/update_docs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ git diff
if (( "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" )); then
git commit -am "Re-ran make.py." | true
git remote add pushable https://${GH_TOKEN}@github.com/conda-forge/conda-forge.github.io.git/ > /dev/null
git push pushable new_site_content:master > /dev/null
git push pushable new_site_content:master 2> /dev/null
fi
21 changes: 13 additions & 8 deletions scripts/update_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@
# env:
# - python
# - conda-smithy
# - pygithub
# - pygithub 1.*
# channels:
# - conda-forge
# run_with: python

import argparse
import os

import conda_smithy.feedstocks as feedstocks

from github import Github
import github
import jinja2
import yaml

import argparse

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

args = parser.parse_args()


from conda_smithy.github import gh_token
from conda_smithy.feedstocks import cloned_feedstocks


token = gh_token()
Expand All @@ -39,6 +36,11 @@
feedstocks_path = args.feedstocks_clone


class NullUndefined(jinja2.Undefined):
def __unicode__(self):
return unicode(self._undefined_name)


def create_team(org, name, description, repos):
# PyGithub creates secret teams, and has no way of turning that off! :(
post_parameters = {
Expand Down Expand Up @@ -76,8 +78,11 @@ def create_team(org, name, description, repos):
print("The {} feedstock is recipe less".format(package_name))
continue

env = jinja2.Environment(undefined=NullUndefined)

with open(recipe) as fh:
data = yaml.safe_load(fh)
contents = env.from_string(''.join(fh)).render()
data = yaml.safe_load(contents)

contributors = set(data.get('extra', {}).get('recipe-maintainers', []))

Expand Down Expand Up @@ -106,7 +111,7 @@ def create_team(org, name, description, repos):

# Remove any teams which don't belong any more (because there is no longer a feedstock).
for team_to_remove in set(teams.keys()) - set(packages_visited):
if team_to_remove in ['Contributors', 'Core', 'conda-forge.github.io']:
if team_to_remove in ['Core', 'conda-forge.github.io']:
print('Keeping ', team_to_remove)
continue
teams[team_to_remove].delete()

0 comments on commit 3163f91

Please sign in to comment.