update_setup_requirements.py 992 B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import sys
  3. from typing import Dict
  4. BASE_PATH = "./tools/packages"
  5. def __build_taipy_package_line(line: str, version: str) -> str:
  6. return f"{line.strip()} @ https://github.com/Avaiga/taipy/releases/download/{version}/{version}.tar.gz\n"
  7. def update_setup_requirements(package: str, versions: Dict) -> None:
  8. _path = os.path.join(BASE_PATH, package, "setup.requirements.txt")
  9. lines = []
  10. with open(_path, mode="r") as req:
  11. for line in req:
  12. if v := versions.get(line.strip()):
  13. line = __build_taipy_package_line(line, v)
  14. lines.append(line)
  15. with open(_path, 'w') as file:
  16. file.writelines(lines)
  17. if __name__ == "__main__":
  18. _package = sys.argv[1]
  19. _versions = {
  20. "taipy-config": sys.argv[2],
  21. "taipy-core": sys.argv[3],
  22. "taipy-gui": sys.argv[4],
  23. "taipy-rest": sys.argv[5],
  24. "taipy-templates": sys.argv[6],
  25. }
  26. update_setup_requirements(_package, _versions)