Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handled Jinja2 templates for team management. #17

Merged
merged 1 commit into from
Feb 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()