new_format_converter.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 
6 
7 """ Entry point of the converter
8 .. module:: converter
9 """
10 
11 import sys
12 import os
13 import distutils.dir_util
14 
15 import converter.choregraphe_project_importer as crg_importer
16 import converter.xar_format_generator as xar_format_generator
17 
18 
19 def main():
20  """ Entry point of the xar converter
21  """
22  param = []
23  if len(sys.argv) not in range(2, 4):
24  sys.stderr.write("Incorrect number of arguments" + os.linesep)
25  sys.exit(1)
26  param.append(sys.argv[1])
27  if (len(sys.argv) == 3):
28  param.append(sys.argv[2])
29  else:
30  param.append("objects")
31 
32  abspath = os.path.abspath(param[0])
33  dest_dir = os.path.abspath(param[1])
34 
35  root = crg_importer.import_behavior(abspath)
36 
37  if not root:
38  sys.stderr.write("Incorrect format, file must be in format_version 4"
39  + os.linesep)
40  sys.exit(6)
41 
42  xar_gen = xar_format_generator.XarFormatGenerator(root)
43 
44  distutils.dir_util.mkpath(dest_dir)
45  xar_gen.export_to_xar(dest_dir)
46 
47 if __name__ == "__main__":
48  main()
new_format_converter.main
def main()
Definition: new_format_converter.py:19
converter.choregraphe_project_importer
Definition: choregraphe_project_importer.py:1
converter.xar_format_generator
Definition: xar_format_generator.py:1


naoqi_libqicore
Author(s): Aldebaran
autogenerated on Wed Sep 14 2022 02:22:41