Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

refreshdyn.py 843B

1234567891011121314151617181920212223242526
  1. #-*- coding: utf-8 -*-
  2. import sys
  3. import admin
  4. def usage():
  5. print("""Usage : %s em_filename [output_filename] [translator]
  6. em_filename \tThe file where the editorial model is stored
  7. output_filename \tThe file where we should write the dynamic leapi code. If - print to stdout
  8. translator \t\tThe translator to use to read the editorial model file em_filename
  9. """ % sys.argv[0])
  10. if __name__ == '__main__':
  11. if len(sys.argv) < 2 or len(sys.argv) > 4:
  12. usage()
  13. exit(1)
  14. filename = sys.argv[1]
  15. output_file = 'lodel/leapi/dyncode.py' if len(sys.argv) < 3 else sys.argv[2]
  16. translator = 'picklefile' if len(sys.argv) < 4 else sys.argv[3]
  17. if output_file == '-':
  18. print(admin.generate_dyncode(filename, translator))
  19. else:
  20. admin.refresh_dyncode(filename, translator, output_file)