Skip to content

Commit bdd0220

Browse files
committed
Use shutil
1 parent e8da5a0 commit bdd0220

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

examples/git_tester.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import os
2+
import shutil
23

34
from sys import platform
45
from pydriller import Repository
56

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"
127

138
speedtest_src_path = os.path.join("examples", "speedtest.py")
149
speedtest_copy_path = os.path.join("examples", "speedtest2.py")
15-
os.system(f"{copy_cmd} {speedtest_src_path} {speedtest_copy_path}") # the file has to be outside of git
10+
shutil.copyfile(speedtest_src_path, speedtest_copy_path) # the file has to be outside of git
1611

1712
commits = list(Repository('.', from_tag="v0.6.0").traverse_commits())
1813
print("Found commits:")
@@ -24,8 +19,9 @@
2419
name = commit.msg.replace('\n', ' ').replace('\r', ' ')
2520
print("\nProcessing", commit.hash, name)
2621

22+
if os.path.exists("build"):
23+
shutil.rmtree("build")
2724
os.system(f"git checkout {commit.hash}")
28-
os.system(f"{rm_dir_cmd} build")
2925
print("\n\n--------------------\n\n")
3026
ret = os.system("python -m pip install .")
3127
print("Install result:", ret)

0 commit comments

Comments
 (0)