Ejemplo n.º 1
0
def get_view_dir(args_view):
    caller_dir = posixpath.abspath('.')
    view_dir = posixpath.abspath(args_view)
    os.chdir(view_dir)
    view_dir = posixpath.abspath('')
    while not dir_has_rspec(view_dir):
        os.chdir('..')
        if view_dir == posixpath.abspath(''):
            logging.userErrorExit('ctx could not find an rspec in the supplied argument or any subdirectory')
        view_dir = posixpath.abspath('')
    return view_dir
Ejemplo n.º 2
0
def getBuildConfiguration(cview, bconf, cfgFile):

    bcFilePath = cview.locateItem(bconf, 'bconf')
    bcFilename = posixpath.basename(bcFilePath)
    bcPath = posixpath.dirname(bcFilePath)

    bcDict = ctx_config.CTXConfig(bcFilePath)
    section = bcDict.get_section('config')
    if not section.has_key('CDEF'):
        logging.userErrorExit("Mandatory BC option 'CDEF' is missing.")

    cdefFilename = section['CDEF']
    cdefFilePath = cview.locateItem(cdefFilename, 'cdef')
    cdefPath = posixpath.dirname(cdefFilePath)
    bc = ctx_bc.BCFile(bcFilename, bcPath, cdefPath, cfgFile)
    return bc