Advertisement
Guest User

buildVrxGrammar

a guest
Dec 17th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.16 KB | None | 0 0
  1. #!python
  2. import SCons.Action
  3. import SCons.Defaults
  4. import os
  5.  
  6. ####################################################################################################################################################
  7. # This pseudo-builder does the following :
  8. # 1 - Launch sideLibrary.jar.  This jar (created by us) convert GSL grammar to SRGS grammar format, then, compile them to binaries for verbyx engine.
  9. #     Take note that sideLibrary.jar generates the binaries in env['DEPLOY_PATH'] and copies them into env['LINKD']
  10. # 2 - Copying grammars, dictionnary and xml to LINK folder
  11. #     The binary is for verbyx speech engine
  12. ####################################################################################################################################################
  13. def buildGrammarForVrx(env, target, source):
  14.     side_binary_dir     = os.path.join(env['LINKD'], 'bin','win32')
  15.     side_library_path   = env.File(os.path.join(side_binary_dir, 'sideLibrary.jar'))
  16.  
  17.     datapack_full_output_path = os.path.join(env['LINKD'], 'data','Grammars','src',env['GRAMMAR_FOLDER_NAME'],env['LANGUAGE'], env['GRAMMAR_PRJ'])
  18.    
  19.     changeDirectory = ('cd ' + env['DEPLOY_PATH'])
  20.     andOperator = ' & '
  21.     compileGrammar = ('java -jar ' +
  22.                     str(side_library_path) +
  23.                     ' --verbyx -l ' +
  24.                     os.path.join(side_binary_dir, 'plugin.properties') +
  25.                     ' --deploy ' +
  26.                     env['DEPLOY_PATH'] + ' '
  27.                     + env['LINKD'])
  28.  
  29.     tgt = env.Command(target  = target,
  30.                       source = [source, side_library_path],
  31.                       action = ['echo (+) Building lexix datapack... (no find and no chmod) - Grammar',
  32.                                 changeDirectory + andOperator + compileGrammar,
  33.                                 'echo Done buildGrammarForVrx.'])
  34.  
  35.     for file in source:
  36.         env.Install(datapack_full_output_path, file)
  37.  
  38.     for file in env.Glob(os.path.join(env['LOCALROOT'],'sr','sra','src', env['GRAMMAR_FOLDER_NAME'],'*.xml')):
  39.         env.Install(os.path.join(env['LINKD'],'data','Grammars','src',env['GRAMMAR_FOLDER_NAME']), file)
  40.    
  41.     return tgt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement