Skip to content

Commit

Permalink
Added ability to clone all feedstocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Jan 11, 2016
1 parent a146208 commit 893b982
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions conda_smithy/feedstocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def feedstock_repos(gh_organization):
return sorted(repos, key=lambda repo: repo.name)


def list(gh_organization):
def list_feedstocks(gh_organization):
for repo in feedstock_repos(gh_organization):
print(repo.name)

Expand All @@ -45,8 +45,21 @@ def fetch_feedstocks(feedstock_directory):


def feedstocks_list_handle_args(args):
return list(args.organization)

return list_feedstocks(args.organization)


def feedstocks_clone_all_handle_args(args):
for repo in feedstock_repos(args.organization):
clone_directory = os.path.join(args.feedstocks_directory, repo.name)
if not os.path.exists(clone_directory):
print('Cloning {}'.format(repo.name))
new_repo = Repo.init(clone_directory)
new_repo.clone(repo.ssh_url)
clone = Repo(clone_directory)
if 'upstream' in [remote.name for remote in clone.remotes]:
clone.delete_remote('upstream')
clone.create_remote('upstream', url=repo.ssh_url)


def feedstocks_list_cloned_handle_args(args):
for feedstock_directory in cloned_feedstocks(args.feedstocks_directory):
Expand Down Expand Up @@ -85,6 +98,11 @@ def main():
list_feedstocks.set_defaults(func=feedstocks_list_handle_args)
list_feedstocks.add_argument("--organization", default="conda-forge")

clone_feedstocks = subparsers.add_parser('clone', help='Clone all of the feedstocks available on the GitHub organization.')
clone_feedstocks.set_defaults(func=feedstocks_clone_all_handle_args)
clone_feedstocks.add_argument("--organization", default="conda-forge")
clone_feedstocks.add_argument("--feedstocks-directory", default="./")

list_cloned_feedstocks = subparsers.add_parser('list-cloned', help='List all of the feedstocks which have been cloned.')
list_cloned_feedstocks.set_defaults(func=feedstocks_list_cloned_handle_args)
list_cloned_feedstocks.add_argument("--feedstocks-directory", default="./")
Expand Down

0 comments on commit 893b982

Please sign in to comment.