Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

62 lines
1.6KB

  1. #!/usr/bin/env python3
  2. import argparse
  3. from pathlib import Path
  4. from typing import List, NamedTuple, Iterable
  5. import shutil
  6. import subprocess
  7. import sys
  8. from dds_ci import cli, proc
  9. ROOT = Path(__file__).parent.parent.absolute()
  10. def dds_build(exe: Path, *, toolchain: str, more_flags: proc.CommandLine = ()):
  11. new_exe = ROOT / '_dds.bootstrap-test.exe'
  12. shutil.copy2(exe, new_exe)
  13. try:
  14. proc.check_run(new_exe, 'build', (f'--toolchain={toolchain}'), more_flags)
  15. finally:
  16. new_exe.unlink()
  17. def self_build(exe: Path,
  18. *,
  19. toolchain: str,
  20. lmi_path: Path = None,
  21. cat_path: Path = Path('_build/catalog.db'),
  22. cat_json_path: Path = Path('catalog.json'),
  23. dds_flags: proc.CommandLine = ()):
  24. # Copy the exe to another location, as windows refuses to let a binary be
  25. # replaced while it is executing
  26. proc.check_run(
  27. exe,
  28. 'catalog',
  29. 'import',
  30. f'--catalog={cat_path}',
  31. f'--json={cat_json_path}',
  32. )
  33. dds_build(
  34. exe,
  35. toolchain=toolchain,
  36. more_flags=[
  37. ('-I', lmi_path) if lmi_path else (),
  38. f'--repo-dir={ROOT}/_build/ci-repo',
  39. f'--catalog={cat_path}',
  40. *dds_flags,
  41. ],
  42. )
  43. def main(argv: List[str]) -> int:
  44. parser = argparse.ArgumentParser()
  45. cli.add_tc_arg(parser)
  46. cli.add_dds_exe_arg(parser)
  47. args = parser.parse_args(argv)
  48. self_build(Path(args.exe), toolchain=args.toolchain, dds_flags=['--full'])
  49. return 0
  50. if __name__ == "__main__":
  51. sys.exit(main(sys.argv[1:]))