-
Notifications
You must be signed in to change notification settings - Fork 1
/
repo_downloader.py
30 lines (21 loc) · 768 Bytes
/
repo_downloader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
This file downloads the repos listed in .csv file.
"""
import subprocess
import os
import pandas as pd
print('\n enter the .csv filename which consists of git clone url for repositories')
filename = str(input())
final_filename = filename + '.csv'
current_directory = os.getcwd()
print('\n the .csv you are looking for is :', final_filename)
directory_path = current_directory + '/' + filename + '_repos'
os.mkdir(directory_path)
def repo_downloader(repo_url):
return subprocess.Popen(['git', 'clone', '--depth', '1', repo_url])
data = pd.read_csv(final_filename)
repo_clone_url = data['repository_clone_url']
for i in repo_clone_url:
print("Finished cloning the repositories for {}".format(i))
os.chdir(directory_path)
repo_downloader(i)