Files
IfcOpenShell/src/bonsai/scripts/get_wheels.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
982 B
Python
Raw Normal View History

2024-07-18 20:20:34 +10:00
import os
import sys
2024-09-20 11:34:05 +05:00
def find_whl_files(directory: str) -> list[str]:
2024-07-18 20:20:34 +10:00
whl_files = []
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith(".whl"):
whl_files.append(os.path.relpath(os.path.join(root, file), directory))
2024-09-20 13:16:59 +05:00
whl_files.sort()
2024-07-18 20:20:34 +10:00
return whl_files
2024-09-20 11:34:05 +05:00
def update_pyproject_toml(pyproject_path: str, whl_files: list[str]) -> None:
2024-07-18 20:20:34 +10:00
with open(pyproject_path, "a") as f:
f.write("\nwheels = [\n")
for whl in whl_files:
f.write(f' "./wheels/{whl}",\n')
f.write("]\n")
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python script.py <folder_path> <pyproject.toml_path>")
sys.exit(1)
folder_path = sys.argv[1]
pyproject_toml_path = sys.argv[2]
whl_files = find_whl_files(folder_path)
update_pyproject_toml(pyproject_toml_path, whl_files)
print("pyproject.toml has been updated with the wheel files.")