make_java_classpath_file.py 635 B

123456789101112131415161718192021222324252627
  1. import os
  2. import sys
  3. import process_command_files as pcf
  4. def make_cp_file(args):
  5. source = args[0]
  6. destination = args[1]
  7. with open(source) as src:
  8. lines = [line.strip() for line in src if line.strip()]
  9. with open(destination, 'w') as dst:
  10. dst.write(os.pathsep.join(lines))
  11. def make_cp_file_from_args(args):
  12. destination = args[0]
  13. with open(destination, 'w') as dst:
  14. dst.write(os.pathsep.join(args[1:]))
  15. if __name__ == '__main__':
  16. args = pcf.get_args(sys.argv[1:])
  17. if sys.argv[1] != '--from-args':
  18. make_cp_file(args)
  19. else:
  20. make_cp_file_from_args(args[1:])