Exemplo n.º 1
0
 def copyBSPDrivers(self):
     """ delete all directories under POD dir, then copy
     drivers in."""
     bspdir = self.getBSPDirectory()
     if bspdir == None:
         raise Error("Set directory before",0)
     # deleting all directory in POD dir
     sy.deleteAllDir(bspdir)
     for directory in sy.listDirectory(settings.projectpath+DRIVERSPATH+"/"):
         sy.copyDirectory(settings.projectpath+DRIVERSPATH+"/"+directory,
                          self.getBSPDirectory())
Exemplo n.º 2
0
    def loadNewInstance(self,libraryname,componentname,
                         componentversion,instancename):
        """ Load a new component from library
        """
        project = self.getParent()
        # verify component name
        if project.getName() == instancename:
          raise Error("Instance name can't be the same name as projectname",0)
        # test if component exist
        if not sy.fileExist(
                project.library.getLibraryPath(libraryname)+\
                        "/"+componentname):
            raise Error("No component with name "+\
                        libraryname+"."+componentname,0)

        #test if several componentversion
        if componentversion==None:
            if len(project.getComponentVersionList(
                            libraryname,componentname))>1:
                raise Error("Component version must be chosen :"+\
                str(project.getComponentVersionList(
                        libraryname,componentname)),0)
            else:
                try:
                    componentversion = project.getComponentVersionList(
                            libraryname,componentname)[0]
                except IndexError:
                    raise Error("No xml description of component",0)
        if instancename == None:
                instancename = componentname+\
                        "%02d"%project.getInstanceAvailability(
                                componentname)

        #copy and rename directory
        sy.copyDirectory(project.library.getLibraryPath( libraryname)+\
                "/"+componentname,settings.projectpath + COMPONENTSPATH)
        try:
            sy.renameDirectory(settings.projectpath+COMPONENTSPATH+\
                    "/"+componentname,\
                    settings.projectpath + COMPONENTSPATH+"/" + instancename)
        except Error: # if directory exist
            pass
        #Rename xml file
        sy.renameFile(settings.projectpath+COMPONENTSPATH+"/"\
                +instancename+"/"+componentversion+XMLEXT,\
                settings.projectpath+COMPONENTSPATH+"/"+instancename+"/"\
                +instancename + XMLEXT)

        #load component
        self.loadInstance(instancename)
        #Connect platform connection
        self.autoconnectPin()