check_releases.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2021-2024 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. # --------------------------------------------------------------------------------------------------
  12. # Returns the latest released versions for every Taipy package that is compatible with the target
  13. # version (major and minor numbers match).
  14. # The target package's version is set to the target version.
  15. #
  16. # Invoked from the workflow in publish.yml.
  17. # --------------------------------------------------------------------------------------------------
  18. import os
  19. import sys
  20. from common import PACKAGES
  21. def usage() -> None:
  22. print(f"Usage: {sys.argv[0]} <root_path> <version>") # noqa: T201
  23. print(" Checks that all <package>-<version> archives exist in <root_path>.") # noqa: T201
  24. if __name__ == "__main__":
  25. if len(sys.argv) < 3:
  26. usage()
  27. raise ValueError("Missing arguments.")
  28. _path = sys.argv[1]
  29. _version = sys.argv[2]
  30. for package in [f"taipy-{_version}.tar.gz"] + [f"taipy-{p}-{_version}.tar.gz" for p in PACKAGES]:
  31. if not os.path.exists(os.path.join(_path, package)):
  32. print(f"Package {package} does not exist") # noqa: T201
  33. sys.exit(1)