|
| 1 | +import os |
| 2 | + |
| 3 | +from sys import platform |
1 | 4 | from pydriller import Repository
|
2 |
| -import os |
3 |
| -import datetime |
4 |
| -os.system("cp examples/speedtest.py examples/speedtest2.py") # the file has to be outside of git |
5 |
| -for idx, commit in enumerate(Repository('.', from_tag="v0.6.0").traverse_commits()): |
6 |
| - name=commit.msg.replace('\n', ' ').replace('\r', ' ') |
7 |
| - print(idx, commit.hash, name) |
8 | 5 |
|
| 6 | +if platform == "win32": |
| 7 | + copy_cmd = "copy" |
| 8 | + rm_dir_cmd = "rmdir /s /q" |
| 9 | +else: |
| 10 | + copy_cmd = "cp" |
| 11 | + rm_dir_cmd = "rm -rf" |
9 | 12 |
|
| 13 | +speedtest_src_path = os.path.join("examples", "speedtest.py") |
| 14 | +speedtest_path = os.path.join("examples", "speedtest2.py") |
| 15 | +os.system(f"{copy_cmd} {speedtest_src_path} {speedtest_path}") # the file has to be outside of git |
| 16 | + |
| 17 | +commits = list(Repository('.', from_tag="v0.6.0").traverse_commits()) |
| 18 | +print("Found commits:") |
| 19 | +for idx, commit in enumerate(commits): |
| 20 | + name = commit.msg.replace('\n', ' ').replace('\r', ' ') |
| 21 | + print(idx, commit.hash, name) |
10 | 22 |
|
11 |
| -for commit in Repository('.', from_tag="v0.6.0").traverse_commits(): |
12 |
| - |
13 |
| - name=commit.msg.replace('\n', ' ').replace('\r', ' ') |
14 |
| - print(commit.hash, name) |
15 |
| - |
16 |
| - os.system(f"git checkout {commit.hash}; rm -rf build; ") |
| 23 | +for commit in commits: |
| 24 | + name = commit.msg.replace('\n', ' ').replace('\r', ' ') |
| 25 | + print("\nProcessing", commit.hash, name) |
| 26 | + |
| 27 | + os.system(f"git checkout {commit.hash}") |
| 28 | + os.system(f"{rm_dir_cmd} build") |
17 | 29 | print("\n\n--------------------\n\n")
|
18 |
| - ret=os.system("python -m pip install .") |
19 |
| - print(ret) |
20 |
| - |
21 |
| - if ret != 0: |
22 |
| - print ("build failed!!!!") |
23 |
| - print ("build failed!!!!") |
24 |
| - print ("build failed!!!!") |
25 |
| - print ("build failed!!!!") |
26 |
| - continue |
27 |
| - |
28 |
| - os.system(f'python examples/speedtest2.py -n "{name}" -d 4 -t 1') |
29 |
| - os.system(f'python examples/speedtest2.py -n "{name}" -d 64 -t 1') |
30 |
| - os.system(f'python examples/speedtest2.py -n "{name}" -d 128 -t 1') |
31 |
| - os.system(f'python examples/speedtest2.py -n "{name}" -d 4 -t 24') |
32 |
| - os.system(f'python examples/speedtest2.py -n "{name}" -d 128 -t 24') |
| 30 | + ret = os.system("python -m pip install .") |
| 31 | + print("Install result:", ret) |
33 | 32 |
|
| 33 | + if ret != 0: |
| 34 | + print("build failed!!!!") |
| 35 | + print("build failed!!!!") |
| 36 | + print("build failed!!!!") |
| 37 | + print("build failed!!!!") |
| 38 | + continue |
34 | 39 |
|
| 40 | + os.system(f'python {speedtest_path} -n "{name}" -d 4 -t 1') |
| 41 | + os.system(f'python {speedtest_path} -n "{name}" -d 64 -t 1') |
| 42 | + os.system(f'python {speedtest_path} -n "{name}" -d 128 -t 1') |
| 43 | + os.system(f'python {speedtest_path} -n "{name}" -d 4 -t 24') |
| 44 | + os.system(f'python {speedtest_path} -n "{name}" -d 128 -t 24') |
0 commit comments