30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import re
|
|
|
|
with open("changes.txt", "r") as file_handle:
|
|
data = file_handle.readlines()
|
|
|
|
for idx in range(0, len(data)):
|
|
data[idx] = data[idx][:-1]
|
|
|
|
if data[idx].startswith(".../"):
|
|
data[idx] = data[idx][4:]
|
|
|
|
with open("broken_changes.txt","w") as log_file_handle:
|
|
for idx, search_string in enumerate(data):
|
|
with open(f"data/{idx}/filename.txt",'w') as file_handle:
|
|
file_handle.write(search_string)
|
|
shutil.copy2("make_diff.sh", f"data/{idx}/make_diff.sh")
|
|
result = subprocess.run(['sh', 'make_diff.sh'], capture_output=True, text=True, cwd=f"data/{idx}/")
|
|
if re.search(r'FAILED', result.stdout):
|
|
print(f"FAILED in {search_string} data/{idx}")
|
|
log_file_handle.write(f"FAILED in {search_string} data/{idx}\n")
|
|
else:
|
|
if os.path.isfile(f"data/{idx}/aneksajo_patched"):
|
|
basedir = os.path.dirname(search_string)
|
|
if len(basedir) > 0:
|
|
os.makedirs(f"export/{basedir}", exist_ok=True)
|
|
shutil.copy2(f"data/{idx}/aneksajo_patched", f"export/{search_string}")
|