File: doris_config.py

package info (click to toggle)
doris 5.0.3~beta%2Bdfsg-19
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 6,944 kB
  • sloc: cpp: 43,560; python: 8,213; csh: 3,636; sh: 2,527; ansic: 649; makefile: 337; xml: 208
file content (30 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'''
	GrsConfig defines paths that are local to the source tree.
	They are copied into DorisParameters for use in Doris python scripts
'''

import xml.etree.ElementTree as ET
import sys, os

class DorisConfig(object):

    def __init__(self):

        # xml_file = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'install/doris_config.xml')
        xml_file = os.environ.get('DORIS_CONFIG_FILE', os.path.expanduser('~/.doris_config.xml'))
        if not os.path.isfile(xml_file):
            xml_file = '/etc/doris_config.xml'
        tree = ET.parse(xml_file)
        settings = tree.getroot()

        self.source_path = settings.find('.source_path').text
        self.doris_path = settings.find('.doris_path').text
        self.cpxfiddle_path = settings.find('.cpxfiddle_path').text

        self.job_handler_script = self.source_path + "/doris_stack/main_code/jobHandlerScript"
        self.function_path = self.source_path + "/doris_stack/functions/"
        self.main_code_path = self.source_path + "/doris_stack/main_code/"

        # Extend path
        sys.path.extend([self.function_path])
        sys.path.extend([self.main_code_path])