Exemplo n.º 1
0
def getdeps(dcl_name):
    from discode_helper import getDclDir

    opened = []
    closed = []

    ret = {}

    opened.append(dcl_name)

    while len(opened) > 0:
        dcl = opened.pop()
        dcldir = getDclDir(dcl)
        if dcldir == "":
            print "DCL " + dcl_name + " not found! Aborting build..."
            sys.exit(-1)

        depset = set([])
        with open(os.path.join(dcldir, "src", "CMakeLists.txt")) as f:
            for line in f:
                match = re.search('^[\s]*DISCODE_FIND_DCL\((.*)\)', line)
                if (match):
                    depdcl = match.group(1)
                    depset.add(depdcl)
                    if not ((depdcl in closed) or (depdcl in opened)):
                        opened.append(depdcl)

        if len(depset) > 0:
            ret[dcl] = depset

        closed.append(dcl)

    return ret
Exemplo n.º 2
0
def getdeps(dcl_name):
  from discode_helper import getDclDir
  
  opened = []
  closed = []
  
  ret = {}
  
  opened.append(dcl_name)
  
  while len(opened) > 0:
    dcl = opened.pop()
    dcldir = getDclDir(dcl)
    if dcldir == "":
      print "DCL " + dcl_name + " not found! Aborting build..."
      sys.exit(-1)
        
    depset = set([])
    with open(os.path.join(dcldir, "src", "CMakeLists.txt")) as f:
      for line in f:
        match = re.search('^[\s]*DISCODE_FIND_DCL\((.*)\)', line)
        if (match):
          depdcl = match.group(1)
          depset.add(depdcl)
          if not ((depdcl in closed) or (depdcl in opened)):
            opened.append(depdcl)
           
    if len(depset) > 0:
      ret[dcl] = depset
      
    closed.append(dcl)
      
        
  return ret
Exemplo n.º 3
0
def buildDCL(dclname, args):
    from discode_helper import getDclDir

    dcldir = getDclDir(dclname)
    builddir = os.path.join(dcldir, "build")
    if not os.path.isdir(builddir):
        os.makedirs(builddir)
        subprocess.Popen("cmake ..", cwd=builddir, shell=True).wait()

    if args.release:
        subprocess.Popen("cmake . -DCMAKE_BUILD_TYPE=Release",
                         cwd=builddir,
                         shell=True).wait()

    if args.clean:
        print "Cleaning previous build..."
        subprocess.Popen('make clean', cwd=builddir, shell=True).wait()

    errs = ""
    perc = 0
    tempname = '/tmp/dclmake_build_error_log_' + str(
        calendar.timegm(time.gmtime()))
    log_file = open(tempname, 'w')
    print "Building..."
    p = subprocess.Popen('make',
                         cwd=builddir,
                         shell=True,
                         stdout=subprocess.PIPE,
                         stderr=log_file,
                         bufsize=-1)
    while p.poll() is None:
        l = p.stdout.readline()  # This blocks until it receives a newline.
        match = re.search('^\[[\s]*(.*)\%\]', l)
        if match:
            cur = int(match.group(1))
            perc = max(cur, perc)
            progbar(perc, 50)
    log_file.close()
    print ""

    log_file = open(tempname, 'r')
    if p.returncode != 0:
        print "Errors during build:"
        print log_file.read()
        return False

    if log_file.readline() != "":
        print "Warnings:"
        print log_file.read()

    print "Installing..."
    p = subprocess.Popen('make install/fast',
                         cwd=builddir,
                         shell=True,
                         stdout=subprocess.PIPE)
    while p.poll() is None:
        l = p.stdout.readline()  # This blocks until it receives a newline.

    return True
Exemplo n.º 4
0
	def generate(self):

		fullpath = os.path.abspath(os.getcwd())
		dcl_name = self.win.ui.cbDCL.currentText()
		cmp_name = self.win.ui.edName.text()
		dcl_dir = os.environ["DISCODE_DCL_DIR"]
		print dcl_dir
		
		if dcl_name=="":
			print "DCL name can't be empty!"
			return
			
		if cmp_name=="":
			print "Component name can't be empty!"
			return
		
		dir = dcl_dir+'/'+dcl_name+'/src/Components/'+cmp_name
		print dir
		if not os.path.exists(dcl_dir+'/'+dcl_name):
			print "DCL %s doesn't exist!"%(dcl_name)
			return
		if os.path.exists(dir):
			print "Component already exists! Choose different name of component."
			return
		else:
			print "Creating component", cmp_name, "in", dir
		
		dcl_path = discode_helper.getDclDir(dcl_name)
		
		self.dic = discode_helper.prepareDefaultDic(cmp_name)
		
		self.generateStreams( self.win.ui.tblStreamIn, "In")
		self.generateStreams( self.win.ui.tblStreamOut, "Out")
		self.generateEvents(cmp_name)
		self.generateProperties()
		self.generateDeps()
				
		discode_helper.createComponent(cmp_name, dcl_name, dcl_path, self.dic)
				
		#===============================================================================
		# Preparing component source files
		#===============================================================================
		 
		#os.makedirs(dir)
		 
		 
		#~ dic = {
		#~ 'TemplateComponent'  : cmp_name,
		#~ 'EXAMPLE'            : cmp_name.upper(),
		#~ 'TMPLFields'         : self.TMPLFields,
		#~ 'TMPLMethodsHeaders' : self.TMPLMethodsHeaders,
		#~ 'TMPLInitializer'    : self.TMPLInitializer,
		#~ 'TMPLConstructor'    : self.TMPLConstructor,
		#~ 'TMPLInit'           : self.TMPLInit,
		#~ 'TMPLMethodsCode'    : self.TMPLMethodsCode
		#~ }
		
		print self.dic
Exemplo n.º 5
0
def getdeps(dcl_name, runtime):
  from discode_helper import getDclDir
  
  opened = []
  closed = []
  
  ret = {}
  
  dotstr = "digraph G {\n"

  if runtime:
    dotdot = ""
    dotstr = dotstr + dcl_name + "-> {"
    opened = runtimedeps(dcl_name)
    for x in opened:
      dotstr = dotstr + dotdot + x
      dotdot = ", "
    dotstr = dotstr + "} [style=dotted];\n"

  if not dcl_name in opened:
    opened.append(dcl_name)
  
  while len(opened) > 0:
    dcl = opened.pop()
    dcldir = getDclDir(dcl)
    if dcldir == "":
      print "DCL " + dcl_name + " not found! Aborting build..."
      sys.exit(-1)
        
    depset = set([])
    with open(os.path.join(dcldir, "src", "CMakeLists.txt")) as f:
      for line in f:
        match = re.search('^[\s]*DISCODE_FIND_DCL\((.*)\)', line)
        if (match):
          depdcl = match.group(1)
          depset.add(depdcl)
          if not ((depdcl in closed) or (depdcl in opened)):
            opened.append(depdcl)
           
    if len(depset) > 0:
      ret[dcl] = depset
      
    closed.append(dcl)
      
    dotstr = dotstr + dcl + " -> {"
    dotdot = ""
    for x in depset:
      dotstr = dotstr + dotdot + x
      dotdot = ", "
    dotstr = dotstr + "}\n"
        
  dotstr = dotstr + "}"
  # print dotstr

  return ret
Exemplo n.º 6
0
def getdeps(dcl_name, runtime):
    from discode_helper import getDclDir

    opened = []
    closed = []

    ret = {}

    dotstr = "digraph G {\n"

    if runtime:
        dotdot = ""
        dotstr = dotstr + dcl_name + "-> {"
        opened = runtimedeps(dcl_name)
        for x in opened:
            dotstr = dotstr + dotdot + x
            dotdot = ", "
        dotstr = dotstr + "} [style=dotted];\n"

    if not dcl_name in opened:
        opened.append(dcl_name)

    while len(opened) > 0:
        dcl = opened.pop()
        dcldir = getDclDir(dcl)
        if dcldir == "":
            print "DCL " + dcl_name + " not found! Aborting build..."
            sys.exit(-1)

        depset = set([])
        with open(os.path.join(dcldir, "src", "CMakeLists.txt")) as f:
            for line in f:
                match = re.search('^[\s]*DISCODE_FIND_DCL\((.*)\)', line)
                if (match):
                    depdcl = match.group(1)
                    depset.add(depdcl)
                    if not ((depdcl in closed) or (depdcl in opened)):
                        opened.append(depdcl)

        if len(depset) > 0:
            ret[dcl] = depset

        closed.append(dcl)

        dotstr = dotstr + dcl + " -> {"
        dotdot = ""
        for x in depset:
            dotstr = dotstr + dotdot + x
            dotdot = ", "
        dotstr = dotstr + "}\n"

    dotstr = dotstr + "}"
    # print dotstr

    return ret
Exemplo n.º 7
0
def buildDCL(dclname, args):
  from discode_helper import getDclDir
  
  dcldir = getDclDir(dclname)
  builddir = os.path.join(dcldir, "build")
  if not os.path.isdir(builddir):
    os.makedirs(builddir)
    subprocess.Popen("cmake ..", cwd = builddir, shell=True).wait()
    
  if args.release:
    subprocess.Popen("cmake . -DCMAKE_BUILD_TYPE=Release", cwd = builddir, shell=True).wait()

  if args.clean:
    print "Cleaning previous build..."
    subprocess.Popen('make clean', cwd = builddir, shell = True).wait()

  errs = ""
  perc = 0
  tempname='/tmp/dclmake_build_error_log_' + str(calendar.timegm(time.gmtime()))
  log_file = open(tempname, 'w')
  print "Building..."
  p = subprocess.Popen('make', cwd = builddir, shell = True, stdout=subprocess.PIPE, stderr=log_file, bufsize=-1)
  while p.poll() is None:
    l = p.stdout.readline() # This blocks until it receives a newline.
    match = re.search('^\[[\s]*(.*)\%\]', l)
    if match:
      cur = int(match.group(1))
      perc = max(cur, perc)
      progbar(perc, 50)
  log_file.close()
  print ""
 
  log_file = open(tempname, 'r')
  if p.returncode != 0:
    print "Errors during build:"
    print log_file.read()
    return False
    
  if log_file.readline() != "":
    print "Warnings:"
    print log_file.read()
      
    
  print "Installing..."
  p = subprocess.Popen('make install/fast', cwd = builddir, shell = True, stdout=subprocess.PIPE)
  while p.poll() is None:
    l = p.stdout.readline() # This blocks until it receives a newline.
    
  return True
Exemplo n.º 8
0
def buildDCL(dclname, clean):
    from discode_helper import getDclDir

    dcldir = getDclDir(dclname)
    builddir = os.path.join(dcldir, "build")
    if not os.path.isdir(builddir):
        os.makedirs(builddir)
        subprocess.Popen("cmake ..", cwd=builddir, shell=True).wait()

    if clean:
        print "Cleaning previous build..."
        subprocess.Popen('make clean', cwd=builddir, shell=True).wait()

    perc = 0
    p = subprocess.Popen('make',
                         cwd=builddir,
                         shell=True,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    while p.poll() is None:
        l = p.stdout.readline()  # This blocks until it receives a newline.
        match = re.search('^\[[\s]*(.*)\%\]', l)
        if match:
            cur = int(match.group(1))
            perc = max(cur, perc)
            progbar(perc, 50)
    print ""

    if p.returncode != 0:
        print "Errors during build:"
        print p.stderr.read()
        return False

    if p.stderr.readline() != "":
        print "Warnings:"
        print p.stderr.read()

    print "Installing..."
    p = subprocess.Popen('make install/fast',
                         cwd=builddir,
                         shell=True,
                         stdout=subprocess.PIPE)
    while p.poll() is None:
        l = p.stdout.readline()  # This blocks until it receives a newline.

    return True
Exemplo n.º 9
0
def runtimedeps(dcl_name):
  from discode_helper import getDclDir
  dcldir = getDclDir(dcl_name)

  depset = []
  for fn in os.listdir(os.path.join(dcldir, "tasks")):
    if fn.endswith(".xml"): 
        #print fn
        with open(os.path.join(dcldir, "tasks", fn)) as f:
          for line in f:
            match = re.search('<.*Component.*type="(.*):.*"', line)
            if (match):
              depdcl = match.group(1)
              if depdcl == dcl_name:
                continue
              if not depdcl in depset:
                depset.append(depdcl)
    else:
        continue

  return depset
Exemplo n.º 10
0
def runtimedeps(dcl_name):
    from discode_helper import getDclDir
    dcldir = getDclDir(dcl_name)

    depset = []
    for fn in os.listdir(os.path.join(dcldir, "tasks")):
        if fn.endswith(".xml"):
            #print fn
            with open(os.path.join(dcldir, "tasks", fn)) as f:
                for line in f:
                    match = re.search('<.*Component.*type="(.*):.*"', line)
                    if (match):
                        depdcl = match.group(1)
                        if depdcl == dcl_name:
                            continue
                        if not depdcl in depset:
                            depset.append(depdcl)
        else:
            continue

    return depset
Exemplo n.º 11
0
    def generate(self):

        fullpath = os.path.abspath(os.getcwd())
        dcl_name = self.win.ui.cbDCL.currentText()
        cmp_name = self.win.ui.edName.text()
        dcl_dir = os.environ["DISCODE_DCL_DIR"]
        print dcl_dir

        if dcl_name == "":
            print "DCL name can't be empty!"
            return

        if cmp_name == "":
            print "Component name can't be empty!"
            return

        dir = dcl_dir + '/' + dcl_name + '/src/Components/' + cmp_name
        print dir
        if not os.path.exists(dcl_dir + '/' + dcl_name):
            print "DCL %s doesn't exist!" % (dcl_name)
            return
        if os.path.exists(dir):
            print "Component already exists! Choose different name of component."
            return
        else:
            print "Creating component", cmp_name, "in", dir

        dcl_path = discode_helper.getDclDir(dcl_name)

        self.dic = discode_helper.prepareDefaultDic(cmp_name)

        self.generateStreams(self.win.ui.tblStreamIn, "In")
        self.generateStreams(self.win.ui.tblStreamOut, "Out")
        self.generateEvents(cmp_name)
        self.generateProperties()
        self.generateDeps()
        self.dic['%TMPLAuthor%'] = self.win.ui.edAuthor.text()
        self.dic['%TMPLDescription%'] = self.win.ui.edDesc.toPlainText()

        discode_helper.createComponent(cmp_name, dcl_name, dcl_path, self.dic)
Exemplo n.º 12
0
	def generate(self):

		fullpath = os.path.abspath(os.getcwd())
		dcl_name = self.win.ui.cbDCL.currentText()
		cmp_name = self.win.ui.edName.text()
		dcl_dir = os.environ["DISCODE_DCL_DIR"]
		print dcl_dir
		
		if dcl_name=="":
			print "DCL name can't be empty!"
			return
			
		if cmp_name=="":
			print "Component name can't be empty!"
			return
		
		dir = dcl_dir+'/'+dcl_name+'/src/Components/'+cmp_name
		print dir
		if not os.path.exists(dcl_dir+'/'+dcl_name):
			print "DCL %s doesn't exist!"%(dcl_name)
			return
		if os.path.exists(dir):
			print "Component already exists! Choose different name of component."
			return
		else:
			print "Creating component", cmp_name, "in", dir
		
		dcl_path = discode_helper.getDclDir(dcl_name)
		
		self.dic = discode_helper.prepareDefaultDic(cmp_name)
		
		self.generateStreams( self.win.ui.tblStreamIn, "In")
		self.generateStreams( self.win.ui.tblStreamOut, "Out")
		self.generateEvents(cmp_name)
		self.generateProperties()
		self.generateDeps()
		self.dic['%TMPLAuthor%'] = self.win.ui.edAuthor.text()
		self.dic['%TMPLDescription%'] = self.win.ui.edDesc.toPlainText()
				
		discode_helper.createComponent(cmp_name, dcl_name, dcl_path, self.dic)
Exemplo n.º 13
0
def buildDCL(dclname, clean):
  from discode_helper import getDclDir
  
  dcldir = getDclDir(dclname)
  builddir = os.path.join(dcldir, "build")
  if not os.path.isdir(builddir):
    os.makedirs(builddir)
    subprocess.Popen("cmake ..", cwd = builddir, shell=True).wait()
    
  if clean:
    print "Cleaning previous build..."
    subprocess.Popen('make clean', cwd = builddir, shell = True).wait()
    
  perc = 0
  p = subprocess.Popen('make', cwd = builddir, shell = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  while p.poll() is None:
    l = p.stdout.readline() # This blocks until it receives a newline.
    match = re.search('^\[[\s]*(.*)\%\]', l)
    if match:
      cur = int(match.group(1))
      perc = max(cur, perc)
      progbar(perc, 50)
  print ""
  
  if p.returncode != 0:
    print "Errors during build:"
    print p.stderr.read()
    return False
    
  if p.stderr.readline() != "":
    print "Warnings:"
    print p.stderr.read()
      
    
  print "Installing..."
  p = subprocess.Popen('make install/fast', cwd = builddir, shell = True, stdout=subprocess.PIPE)
  while p.poll() is None:
    l = p.stdout.readline() # This blocks until it receives a newline.
    
  return True