parser = argparse.ArgumentParser(description=('Lint all of the feedstocks, ' 'raising issues if there is any.')) parser.add_argument('--feedstocks-dir', help="The location of the feedstocks.", default="~/dev/conda-forge/feedstocks") parser.add_argument('--regexp', help="Regexp of feedstocks to consider.", default=".*") args = parser.parse_args() feedstocks_dir = os.path.expanduser(args.feedstocks_dir) feedstocks.clone_all('conda-forge', feedstocks_dir) feedstocks.fetch_feedstocks(feedstocks_dir) regexp = re.compile(args.regexp) randomised_feedstocks = [feedstock for feedstock in feedstocks.cloned_feedstocks(feedstocks_dir) if regexp.match(feedstock.package)] random.shuffle(randomised_feedstocks) gh_token = conda_smithy.github.gh_token() gh = github.Github(gh_token) gh_forge = gh.get_organization('conda-forge') # Set to false to debug. if True: print("Collecting list of conda-forge repos...") forge_repos = {repo.name: repo for repo in gh_forge.get_repos()} else: # For debugging, we turn our attention to a single feedstock. debug_name = 'libtiff-feedstock' forge_repos = {debug_name: gh_forge.get_repo(debug_name)}
'raising issues if there is any.')) parser.add_argument('--feedstocks-dir', help="The location of the feedstocks.", default="~/dev/conda-forge/feedstocks") parser.add_argument('--regexp', help="Regexp of feedstocks to consider.", default=".*") args = parser.parse_args() feedstocks_dir = os.path.expanduser(args.feedstocks_dir) feedstocks.clone_all('conda-forge', feedstocks_dir) feedstocks.fetch_feedstocks(feedstocks_dir) regexp = re.compile(args.regexp) randomised_feedstocks = [ feedstock for feedstock in feedstocks.cloned_feedstocks(feedstocks_dir) if regexp.match(feedstock.package) ] random.shuffle(randomised_feedstocks) gh_token = conda_smithy.github.gh_token() gh = github.Github(gh_token) gh_forge = gh.get_organization('conda-forge') # Set to false to debug. if True: print("Collecting list of conda-forge repos...") forge_repos = {repo.name: repo for repo in gh_forge.get_repos()} else: # For debugging, we turn our attention to a single feedstock. debug_name = 'libtiff-feedstock'
print('Found {} conda-forge subscriptions.'.format(len(current_subscriptions))) class NullUndefined(jinja2.Undefined): def __unicode__(self): return six.text_type(self._undefined_name) def __getattr__(self, name): return six.text_type('{}.{}'.format(self, name)) def __getitem__(self, name): return '{}["{}"]'.format(self, name) env = jinja2.Environment(undefined=NullUndefined) for feedstock in feedstocks.cloned_feedstocks(feedstocks_dir): meta = os.path.join(feedstock.directory, 'recipe', 'meta.yaml') if not os.path.exists(meta): print('Found an empty repo... :(') continue with open(meta, 'r') as fh: contents = env.from_string(''.join(fh)).render(os=os, environ=os.environ) meta = yaml.safe_load(contents) me_a_maintainer = gh_me.login in meta.get('extra', {}).get('recipe-maintainers', []) print(' - {: <24}(maintainer: {})'.format(feedstock.package, me_a_maintainer)) if me_a_maintainer and feedstock.name not in current_subscriptions: print('*** Not watching {}, yet you are a maintainer of it! You may want to fix that.'.format(feedstock.name)) if not me_a_maintainer and feedstock.name in current_subscriptions: print('*** Removing {} from your watched list as you are not a maintainer of it.'.format(feedstock.name)) gh_me.remove_from_subscriptions(current_subscriptions[feedstock.name])
import conda_smithy.feedstocks as feedstocks parser = argparse.ArgumentParser(description='Propose a feedstock update.') parser.add_argument('--feedstocks-dir', help="The location of the feedstocks.", default="~/dev/conda-forge/feedstocks") args = parser.parse_args() feedstocks_dir = os.path.expanduser(args.feedstocks_dir) feedstocks.clone_all('conda-forge', feedstocks_dir) feedstocks.fetch_feedstocks(feedstocks_dir) # TODO: What about feedstocks that get removed? randomised_feedstocks = list(feedstocks.cloned_feedstocks(feedstocks_dir)) # Shuffle is in-place. :( random.shuffle(randomised_feedstocks) gh_token = conda_smithy.github.gh_token() gh = github.Github(gh_token) gh_me = gh.get_user() if gh_me.login != 'conda-forge-admin': raise ValueError("The github token isn't that of conda-forge-admin (it's " "for {}), I'm going to have to bail.".format(gh_me.login)) gh_forge = gh.get_organization('conda-forge')