with_pathsep_resolve.py 588 B

12345678910111213141516171819202122232425
  1. import sys
  2. import os
  3. import subprocess
  4. import platform
  5. # NOTE: legacy, only for "devtools/ya/jbuild"
  6. def fix_args(args):
  7. just_replace_it = False
  8. for arg in args:
  9. if arg == '--fix-path-sep':
  10. just_replace_it = True
  11. continue
  12. if just_replace_it:
  13. arg = arg.replace('::', os.pathsep)
  14. just_replace_it = False
  15. yield arg
  16. if __name__ == '__main__':
  17. res = list(fix_args(sys.argv[1:]))
  18. if platform.system() == 'Windows':
  19. sys.exit(subprocess.Popen(res).wait())
  20. else:
  21. os.execv(res[0], res)