21 lines
788 B
Python
21 lines
788 B
Python
import os
|
|
import glob
|
|
|
|
pattern = 'sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))'
|
|
replacement = pattern + '\nsys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))'
|
|
|
|
# Files to update
|
|
files = glob.glob("tests/*.py") + glob.glob("simulation/*.py") + glob.glob("scripts/*.py")
|
|
|
|
for file_path in files:
|
|
if not os.path.isfile(file_path):
|
|
continue
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
if pattern in content and replacement not in content:
|
|
print(f"Updating {file_path}")
|
|
new_content = content.replace(pattern, replacement)
|
|
with open(file_path, 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|