|
17 | 17 | folder_name = url.split("/").pop()[:-4] |
18 | 18 | folder_path = "./Access/access_modules/" + folder_name |
19 | 19 | try: |
20 | | - Repo.clone_from(url, folder_path) |
21 | | - # move all folders, not files in the cloned repo to the access_modules |
22 | | - # folder except the .git, .github and secrets folder |
23 | | - for file in os.listdir(folder_path): |
24 | | - if ( |
| 20 | + Repo.clone_from(url, folder_path) |
| 21 | + # move all folders, not files in the cloned repo to the access_modules |
| 22 | + # folder except the .git, .github and secrets folder |
| 23 | + for file in os.listdir(folder_path): |
| 24 | + if ( |
25 | 25 | os.path.isdir(folder_path + "/" + file) |
26 | 26 | and file != ".git" |
27 | 27 | and file != ".github" |
28 | 28 | and file != "secrets" |
29 | 29 | ) : |
30 | | - os.rename( |
31 | | - folder_path + "/" + file, "./Access/access_modules/" + file |
32 | | - ) |
| 30 | + os.rename( |
| 31 | + folder_path + "/" + file, "./Access/access_modules/" + file |
| 32 | + ) |
33 | 33 |
|
34 | | - if(file == "requirements.txt"): |
35 | | - |
36 | | - current_requirements_file = folder_path + "/" + file |
37 | | - #Read the requirements |
38 | | - with open(requirements_file, 'r') as f1: |
| 34 | + if(file == "requirements.txt"): |
| 35 | + current_requirements_file = folder_path + "/" + file |
| 36 | + #Read the requirements |
| 37 | + with open(requirements_file, 'r') as f1: |
39 | 38 | requirements1 = f1.readlines() |
40 | 39 |
|
41 | | - with open(current_requirements_file, 'r') as f1: |
| 40 | + with open(current_requirements_file, 'r') as f1: |
42 | 41 | requirements2 = f1.readlines() |
43 | 42 |
|
44 | | - # Merge the requirements |
45 | | - merged_requirements = list(set(requirements1 + requirements2)) |
| 43 | + # Merge the requirements |
| 44 | + merged_requirements = list(set(requirements1 + requirements2)) |
46 | 45 |
|
47 | | - #update the requirements.txt |
48 | | - with open(requirements_file, 'w') as out_file: |
| 46 | + #update the requirements.txt |
| 47 | + with open(requirements_file, 'w') as out_file: |
49 | 48 | for requirement in sorted(merged_requirements): |
50 | 49 | out_file.write(requirement) |
51 | 50 |
|
52 | | - |
53 | | - |
54 | | - print("Cloning successful!") |
55 | | - |
| 51 | + print("Cloning successful!") |
56 | 52 | except Exception as e: |
57 | 53 | print(e) |
58 | | - |
59 | 54 | print("failed cloning " + folder_name + ".") |
60 | | - # remove the cloned repo folder entirely with all its contents which |
61 | | - # includes folders and files using shutil.rmtree() |
| 55 | + |
| 56 | + # remove the cloned repo folder entirely with all its contents which |
| 57 | + # includes folders and files using shutil.rmtree() |
62 | 58 | # shutil.rmtree() sometimes throws an error on windows, |
63 | 59 | # so we use try and except to ignore the error |
64 | 60 | try: |
|
0 commit comments