Exemple #1
0
    def runnable_status(self):
        '''
		self.pars are populated in runnable_status - because this function is being
		run *before* both self.pars "consumers" - scan() and run()

		set output_dir (node) for the output
		'''

        for x in self.run_after:
            if not x.hasrun:
                return Task.ASK_LATER

        if not getattr(self, 'pars', None):
            txt = self.inputs[0].read()
            txt = re_nl.sub('', txt)
            self.pars = Utils.str_to_dict(txt)
            if not self.pars.get('OUTPUT_DIRECTORY'):
                self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld(
                ).abspath()
            if not self.pars.get('INPUT'):
                self.pars['INPUT'] = self.inputs[0].parent.abspath()

        if not getattr(self, 'output_dir', None):
            self.output_dir = self.generator.bld.root.find_dir(
                self.pars['OUTPUT_DIRECTORY'])

        self.signature()
        return Task.Task.runnable_status(self)
Exemple #2
0
	def runnable_status(self):
		'''
		self.pars are populated in runnable_status - because this function is being
		run *before* both self.pars "consumers" - scan() and run()

		set output_dir (node) for the output
		'''

		for x in self.run_after:
			if not x.hasrun:
				return Task.ASK_LATER

		if not getattr(self, 'pars', None):
			txt = self.inputs[0].read()
			txt = re_nl.sub('', txt)
			self.pars = Utils.str_to_dict(txt)
			if not self.pars.get('OUTPUT_DIRECTORY'):
				self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld().abspath()
			if not self.pars.get('INPUT'):
				self.pars['INPUT'] = self.inputs[0].parent.abspath()

		if not getattr(self, 'output_dir', None):
			self.output_dir = self.generator.bld.root.find_dir(self.pars['OUTPUT_DIRECTORY'])

		self.signature()
		return Task.Task.runnable_status(self)
Exemple #3
0
    def runnable_status(self):
        """
		self.pars are populated in runnable_status - because this function is being
		run *before* both self.pars "consumers" - scan() and run()

		set output_dir (node) for the output
		"""

        for x in self.run_after:
            if not x.hasrun:
                return Task.ASK_LATER

        if not getattr(self, "pars", None):
            txt = self.inputs[0].read()
            txt = re_nl.sub("", txt)
            self.pars = Utils.str_to_dict(txt)
            if not self.pars.get("OUTPUT_DIRECTORY"):
                self.pars["OUTPUT_DIRECTORY"] = self.inputs[0].parent.get_bld().abspath()
            if not self.pars.get("INPUT"):
                self.pars["INPUT"] = self.inputs[0].parent.abspath()

        if not getattr(self, "output_dir", None):
            bld = self.generator.bld
            # First try to find an absolute path, then find or declare a relative path
            self.output_dir = bld.root.find_dir(self.pars["OUTPUT_DIRECTORY"])
            if not self.output_dir:
                self.output_dir = bld.path.find_or_declare(self.pars["OUTPUT_DIRECTORY"])

        self.signature()
        return Task.Task.runnable_status(self)
Exemple #4
0
  def run(self):
    src = self.inputs[0]
    sbf = self.inputs[0].change_ext('.sbf').get_bld()
    sbf.parent.mkdir()
    cmd = '%s -b %s -I %s -c ./ %s' % (self.env.SIP_BIN, sbf.abspath(), src.parent.abspath(), src.abspath())
    cwd = src.parent.get_bld().abspath()
    self.generator.bld.exec_command(cmd, cwd=cwd)

    sbf_data = Utils.str_to_dict(sbf.read())
    headers = Utils.to_list(sbf_data['headers'])
    sources = Utils.to_list(sbf_data['sources'])

    src_dir = src.parent.get_bld()
    self.outputs = [src_dir.find_or_declare(x) for x in sources]
    self.generator.bld.raw_deps[self.uid()] = [self.signature()] + self.outputs
    self.add_c_tasks(self.outputs)