jack2 codebase
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.

57 lines
1.8KB

  1. #! /usr/bin/env python
  2. # per rosengren 2011
  3. from os import environ, path
  4. from waflib import TaskGen, Utils
  5. def options(opt):
  6. grp = opt.add_option_group('Oracle ProC Options')
  7. grp.add_option('--oracle_home', action='store', default=environ.get('PROC_ORACLE'), help='Path to Oracle installation home (has bin/lib)')
  8. grp.add_option('--tns_admin', action='store', default=environ.get('TNS_ADMIN'), help='Directory containing server list (TNS_NAMES.ORA)')
  9. grp.add_option('--connection', action='store', default='dummy-user/dummy-password@dummy-server', help='Format: user/password@server')
  10. def configure(cnf):
  11. env = cnf.env
  12. if not env.PROC_ORACLE:
  13. env.PROC_ORACLE = cnf.options.oracle_home
  14. if not env.PROC_TNS_ADMIN:
  15. env.PROC_TNS_ADMIN = cnf.options.tns_admin
  16. if not env.PROC_CONNECTION:
  17. env.PROC_CONNECTION = cnf.options.connection
  18. cnf.find_program('proc', var='PROC', path_list=env.PROC_ORACLE + path.sep + 'bin')
  19. def proc(tsk):
  20. env = tsk.env
  21. gen = tsk.generator
  22. bld = gen.bld
  23. inc_nodes = gen.to_incnodes(Utils.to_list(getattr(gen,'includes',[])) + env['INCLUDES'])
  24. # FIXME the if-else construct will not work in python 2
  25. cmd = (
  26. [env.PROC] +
  27. ['SQLCHECK=SEMANTICS'] +
  28. (['SYS_INCLUDE=(' + ','.join(env.PROC_INCLUDES) + ')']
  29. if env.PROC_INCLUDES else []) +
  30. ['INCLUDE=(' + ','.join(
  31. [i.bldpath() for i in inc_nodes]
  32. ) + ')'] +
  33. ['userid=' + env.PROC_CONNECTION] +
  34. ['INAME=' + tsk.inputs[0].bldpath()] +
  35. ['ONAME=' + tsk.outputs[0].bldpath()]
  36. )
  37. exec_env = {
  38. 'ORACLE_HOME': env.PROC_ORACLE,
  39. 'LD_LIBRARY_PATH': env.PROC_ORACLE + path.sep + 'lib',
  40. }
  41. if env.PROC_TNS_ADMIN:
  42. exec_env['TNS_ADMIN'] = env.PROC_TNS_ADMIN
  43. return tsk.exec_command(cmd, env=exec_env)
  44. TaskGen.declare_chain(
  45. name = 'proc',
  46. rule = proc,
  47. ext_in = '.pc',
  48. ext_out = '.c',
  49. )