Example #1
0
    def get_module_path_hash(self, target):
        ## retrieve the branch ID from the registry
        branch = bldreg.get_value('build', 'branch')

        ## find the BIF file for this branch
        branch_list = branchlist.BranchList()
        bif_file = branch_list.file(branch)
        if not bif_file:
            e = err.Error()
            e.Set("Cannot find bif file=\"%s\"." % (bif_file))
            raise err.error, e

        ## parse the BIF/XML file and get information for this build
        bif_data = bif.load_bif_data(bif_file, branch_list)

        ## feed the BIF information to a dependancy list, and set
        ## the dependancy list's targets
        depend = dependlist.DependList(bif_data, target)

        ## this takes it's best shot at returning a list of all the
        ## subdirectory names checked out by this target
        module_list = depend.distribution_list() + depend.checkout_list()

        base_path = ushell.posix_path(bldreg.get_value('build', 'path'))

        module_path_hash = {}
        for module in module_list:
            module_path_hash[module.id] = ushell.join(base_path, module.name)

        return module_path_hash
Example #2
0
    def get_module_path_hash(self, target):
        ## retrieve the branch ID from the registry
        branch = bldreg.get_value('build', 'branch')

        ## find the BIF file for this branch
        branch_list = branchlist.BranchList()
        bif_file = branch_list.file(branch)
        if not bif_file:
            e = err.Error()
            e.Set("Cannot find bif file=\"%s\"." % (bif_file))
            raise err.error, e

        ## parse the BIF/XML file and get information for this build
        bif_data = bif.load_bif_data(bif_file, branch_list)

        ## feed the BIF information to a dependancy list, and set
        ## the dependancy list's targets
        depend = dependlist.DependList(bif_data, target)

        ## this takes it's best shot at returning a list of all the
        ## subdirectory names checked out by this target
        module_list = depend.distribution_list() + depend.checkout_list()
        
        base_path = ushell.posix_path(bldreg.get_value('build', 'path'))

        module_path_hash = {}
        for module in module_list:
            module_path_hash[module.id] = ushell.join(base_path, module.name)

        return module_path_hash
Example #3
0
    def __load_target_hash(self):
        try:
            key_list = bldreg.section_key_list('targets')
        except KeyError:
            return

        ## figure out the base absolute path
        base_path = ushell.posix_path(bldreg.get_value('build', 'path'))

        self.__target_hash = {}

        for key in key_list:
            target_path = ushell.join(
                base_path, ushell.posix_path(bldreg.get_value('targets', key)))
            
            self.__target_hash[key] = target_path
Example #4
0
def convertFileToRelativePath(src_root_path, full_path):
    ##
    ##  If given a full path, the drive letter and full path
    ##  will be changed to a path reletive to the top level
    ##  source directory
    ##
    rel_path = ''

    ##
    ##  Strip off the base path and make it relative
    ##
    base_path = bldreg.get_value('build', 'path')

    tmpPath = string.split(full_path, base_path)

    ##
    ##  Check if there was a full path or just a filename
    ##
    if len(tmpPath) == 1:
        ##
        ##  Set the return value to the filename
        ##
        rel_path = str(tmpPath[0])
    else:
        ##
        ##  The full path has been removed.  The remaining path
        ##  is relative to the root path.  Add in the relative path
        ##  to the current directory
        ##
        tmpPath[0] = src_root_path
        tmpPath[1] = "." + tmpPath[1]
        rel_path = os.path.normpath(os.path.join(src_root_path, tmpPath[-1]))

    return rel_path
Example #5
0
    def __load_target_hash(self):
        try:
            key_list = bldreg.section_key_list('targets')
        except KeyError:
            return

        ## figure out the base absolute path
        base_path = ushell.posix_path(bldreg.get_value('build', 'path'))

        self.__target_hash = {}

        for key in key_list:
            target_path = ushell.join(
                base_path, ushell.posix_path(bldreg.get_value('targets', key)))

            self.__target_hash[key] = target_path
Example #6
0
    def copy_to_copydir(self, path):
        ## build the copy directory path
        if self.settings.get('copy_path'):
            base_path = bldreg.get_value('build', 'path')
            copy_path = os.path.join(base_path, self.settings['copy_path'])
            print copy_path
            copy_path = ushell.posix_path(copy_path)
            print copy_path
        else:
            self.error('no copy_path set')
            return

        ## make the copy_path directory
        if not ushell.isdir(copy_path):
            ushell.mkdir(copy_path)
        
        ushell.cp(path, copy_path)
Example #7
0
def convertPathToRelativePath(cwd_path, full_path):
    ##
    ##  If given a full path, the drive letter and full path
    ##  will be changed to a path reletive to the top level
    ##  source directory
    ##
    rel_path = ''

    ##
    ##  Strip off the base path and make it relative
    ##
    base_path = bldreg.get_value('build', 'path')
    tmpPath = string.split(full_path, base_path)

    rel_path = "%s%s" % (cwd_path, tmpPath[-1])

    return rel_path
Example #8
0
    def copy_to_copydir(self, path):
        ## build the copy directory path
        if self.settings.get('copy_path'):
            base_path = bldreg.get_value('build', 'path')
            copy_path = os.path.join(base_path, self.settings['copy_path'])
            print copy_path
            copy_path = ushell.posix_path(copy_path)
            print copy_path
        else:
            self.error('no copy_path set')
            return

        ## make the copy_path directory
        if not ushell.isdir(copy_path):
            ushell.mkdir(copy_path)

        ushell.cp(path, copy_path)
Example #9
0
 def process_checkins(self, dir):
     import bldreg
     print "Processing distribution checkins"
     for file in bldreg.section_key_list("distribute"):
         apply(self.checkin, (os.path.join(dir, file), ) +
               bldreg.get_value("distribute",file))
Example #10
0
def WriteDLLTab(platform, project, plugin_list):
    """Write the dlltab.cpp file, and include it in the project source list.
    The dlltab.cpp file defines a global function table used by
    pnmisc/dllaccess.cpp for loading staticly linked plugins."""

    externsection = []
    tablesection = []
    dlltypesection = []


    includes = [ ]
    
    header1 = """
/* This file is generated automatically.  Please do not edit. */
"""
    
    structs = """

typedef struct DLLMAP {
        const char * dllName;
        const char * entryPoint;
        int          pluginType;
        void *       funcptr;
} DLLMAP;

extern const DLLMAP g_dllMap [];

typedef struct DLLTYPEMAP {
        const char * dllName;
        int          pluginType;
} DLLTYPEMAP;

extern const DLLTYPEMAP g_dllTypeMap[];

    """

    for target in plugin_list:
        ## retrieve the dll type from the registry
        try:
            dll_type = bldreg.get_value('dll_type', target)
        except KeyError:
            umake_lib.fatal('cannot find [dll_type] for target %s in registry' % (target))
    
        if dll_type == 'codec':
            my_type = 'DLLTYPE_CODEC'
        elif dll_type == 'common':
            my_type = 'DLLTYPE_COMMON'
        else:
            my_type = 'DLLTYPE_PLUGIN'

        dlltypesection.append('\t{ "%s", %s },' % (target, my_type))


        ## retrieve the dll entrypoints from the registry
        try:
            exported_functions = bldreg.get_value('export', target)
        except KeyError:
            umake_lib.fatal('cannot find exported functions for target %s in registry' % (target))

        exported_function_list = string.split(exported_functions, ',')

        for symbol in exported_function_list:
            tmp =  bldreg.get("export_protos",
                              target+"::"+symbol,
                              ["", None, None])

            if type(tmp) == types.StringType:
                tmp = [ tmp, None, None ]

            args, include, path = tmp

            if include and include not in includes:
                includes.append(include)

            if path:
                project.AddModuleIncludes(path)
                
            externsection.append('STDAPI entrypoint_for_%s_%s (%s);' % (target, symbol, args))
            
            tablesection.append(
                '\t{"%s", "%s", %s, (void*)entrypoint_for_%s_%s},' % (
                    target, symbol, my_type, target, symbol))

        ## add the static target to the library list
        try:
            target_lib = bldreg.get_value('targets', target)
        except KeyError:
            umake_lib.fatal('cannot rfind [targets] path for target %s in registry' % (target))

        handle = bldreg.get("file_to_handle", target_lib, None)
        if handle:
            project.AddModuleLibraries(handle)
        else:
            umake_lib.warning("codegen couldn't find which module created '%s'" % target_lib)
            target_lib = os.path.join(project.src_root_path, target_lib)
            project.AddLibraries(target_lib)
            

    ## FIXME: these should not be hardcoded!
    includes.append("dllacces.h")
    includes.append("dllpath.h")

    dlltab = open("dlltab.cpp", "w")
    def emit(x = "", tab = dlltab) :
        tab.write(x + "\n")
                        
    emit(header1)
    for i in includes:
        emit('#include "%s"' % i)
    emit(structs) 
    emit()
    emit(string.joinfields(externsection, "\n"))
    emit()
    emit()
    emit("const DLLTYPEMAP g_dllTypeMap[] = {")
    emit(string.joinfields(dlltypesection, "\n"))
    emit("\t{NULL, 0}\n};")
    emit("const DLLMAP g_dllMap[] = {")
    emit(string.joinfields(tablesection, "\n"))
    emit("\t{NULL, NULL, 0, NULL}\n};\n")

    ## have dlltab.cpp automagicly added to the source list
    project.AddSources("dlltab.cpp")
Example #11
0
 def process_checkins(self, dir):
     import bldreg
     print "Processing distribution checkins"
     for file in bldreg.section_key_list("distribute"):
         apply(self.checkin, (os.path.join(dir, file), ) +
               bldreg.get_value("distribute", file))