Repository: conda-forge/conda-smithy

Issue:
AttributeError: 'module' object has no attribute 'meta_of_feedstock'
https://travis-ci.org/conda-forge/staged-recipes/builds/367829917#L880


Discussion:

Resolving patch:
diff --git a/conda_smithy/github.py b/conda_smithy/github.py
--- a/conda_smithy/github.py
+++ b/conda_smithy/github.py
@@ -1,19 +1,16 @@
 from __future__ import absolute_import, print_function
 
 import os
-import random
 from random import choice
 
-import git
 from git import Repo
 
-import github
 from github import Github
 from github.GithubException import GithubException
 from github.Organization import Organization
 from github.Team import Team
 
-from . import configure_feedstock
+import conda_build.api
 
 
 def gh_token():
@@ -89,7 +86,14 @@ def get_cached_team(org, team_name, description=""):
 
 def create_github_repo(args):
     token = gh_token()
-    meta = configure_feedstock.meta_of_feedstock(args.feedstock_directory)
+    meta = conda_build.api.render(args.feedstock_directory,
+                                  permit_undefined_jinja=True, finalize=False,
+                                  bypass_env_check=True, trim_skip=False)[0][0]
+
+    if "parent_recipe" in meta.meta["extra"]:
+        feedstock_name = meta.meta["extra"]["parent_recipe"]["name"]
+    else:
+        feedstock_name = meta.name()
 
     gh = Github(token)
     user_or_org = None
@@ -101,10 +105,11 @@ def create_github_repo(args):
         # Use the organization provided.
         user_or_org = gh.get_organization(args.organization)
 
-    repo_name = '{}-feedstock'.format(meta.name())
+    repo_name = '{}-feedstock'.format(feedstock_name)
     try:
-        gh_repo = user_or_org.create_repo(repo_name, has_wiki=False,
-                                          description='A conda-smithy repository for {}.'.format(meta.name()))
+        gh_repo = user_or_org.create_repo(
+            repo_name, has_wiki=False,
+            description='A conda-smithy repository for {}.'.format(feedstock_name))
         print('Created {} on github'.format(gh_repo.full_name))
     except GithubException as gh_except:
         if gh_except.data.get('errors', [{}])[0].get('message', '') != u'name already exists on this account':
@@ -120,16 +125,17 @@ def create_github_repo(args):
             existing_remote = repo.remotes[remote_name]
             if existing_remote.url != gh_repo.ssh_url:
                 print("Remote {} already exists, and doesn't point to {} "
-                      "(it points to {}).".format(remote_name, gh_repo.ssh_url, existing_remote.url))
+                      "(it points to {}).".format(remote_name, gh_repo.ssh_url,
+                                                  existing_remote.url))
         else:
             repo.create_remote(remote_name, gh_repo.ssh_url)
 
     if args.add_teams:
         if isinstance(user_or_org, Organization):
-            configure_github_team(meta, gh_repo, user_or_org)
+            configure_github_team(meta, gh_repo, user_or_org, feedstock_name)
 
 
-def configure_github_team(meta, gh_repo, org):
+def configure_github_team(meta, gh_repo, org, feedstock_name):
 
     # Add a team for this repo and add the maintainers to it.
     superlative = [
@@ -144,7 +150,7 @@ def configure_github_team(meta, gh_repo, org):
         meta.meta.get('extra', {}).get('recipe-maintainers', [])
     )
     maintainers = set(maintainer.lower() for maintainer in maintainers)
-    team_name = meta.name()
+    team_name = feedstock_name
     # Try to get team or create it if it doesn't exist.
     team = next((team for team in gh_repo.get_teams() if team.name == team_name), None)
     current_maintainers = []
@@ -160,7 +166,6 @@ def configure_github_team(meta, gh_repo, org):
     else:
         current_maintainers = team.get_members()
 
-
     # Add only the new maintainers to the team.
     current_maintainers_handles = set([
         e.login.lower() for e in current_maintainers
@@ -172,7 +177,7 @@ def configure_github_team(meta, gh_repo, org):
     for old_maintainer in current_maintainers_handles - maintainers:
         print(
             "AN OLD MEMBER ({}) NEEDS TO BE REMOVED FROM {}".format(
-                old_maintainer, repo_name
+                old_maintainer, gh_repo
             )
         )
 


Test patch: