Ejemplo n.º 1
0
	def run(self):
		pipeline=shellcmd.Pipeline()
		pipeline.parse(self.generator.command)
		namespace=self.env.get_merged_dict()
		if self.generator.variables is not None:
			namespace.update(self.generator.variables)
		namespace.update(env=self.env,SRC=self.inputs,TGT=self.outputs)
		for cmd in pipeline.pipeline:
			if isinstance(cmd,shellcmd.Command):
				if isinstance(cmd.stdin,basestring):
					cmd.stdin=self._subst_arg(cmd.stdin,'in',namespace)
				if isinstance(cmd.stdout,basestring):
					cmd.stdout=self._subst_arg(cmd.stdout,'out',namespace)
				if isinstance(cmd.stderr,basestring):
					cmd.stderr=self._subst_arg(cmd.stderr,'out',namespace)
				for argI in xrange(len(cmd.argv)):
					cmd.argv[argI]=self._subst_arg(cmd.argv[argI],None,namespace)
				if cmd.env_vars is not None:
					env_vars=dict()
					for name,value in cmd.env_vars.iteritems():
						env_vars[name]=self._subst_arg(value,None,namespace)
					cmd.env_vars=env_vars
			elif isinstance(cmd,shellcmd.Chdir):
				cmd.dir=self._subst_arg(cmd.dir,None,namespace)
		return pipeline.run(verbose=(Options.options.verbose>0))
Ejemplo n.º 2
0
	def __str__(self):
		env=self.env
		src_str=' '.join([a.nice_path(env)for a in self.inputs])
		tgt_str=' '.join([a.nice_path(env)for a in self.outputs])
		if self.outputs:
			sep=' -> '
		else:
			sep=''
		pipeline=shellcmd.Pipeline()
		pipeline.parse(self.generator.command)
		cmd=pipeline.get_abbreviated_command()
		return'command (%s): %s%s%s\n'%(cmd,src_str,sep,tgt_str)
Ejemplo n.º 3
0
	def __str__(self):
		"string to display to the user"
		src_str = ' '.join([nice_path(a) for a in self.inputs])
		tgt_str = ' '.join([nice_path(a) for a in self.outputs])
		if self.outputs:
			sep = ' -> '
		else:
			sep = ''

		pipeline = shellcmd.Pipeline()
		pipeline.parse(self.generator.command)
		cmd = pipeline.get_abbreviated_command()
		return 'command (%s): %s%s%s\n' % (cmd, src_str, sep, tgt_str)
Ejemplo n.º 4
0
    def __str__(self):
        "string to display to the user"
        env = self.env
        src_str = ' '.join(
            [a.path_from(a.ctx.launch_node()) for a in self.inputs])
        tgt_str = ' '.join(
            [a.path_from(a.ctx.launch_node()) for a in self.outputs])
        if self.outputs:
            sep = ' -> '
        else:
            sep = ''

        pipeline = shellcmd.Pipeline()
        pipeline.parse(self.generator.command)
        cmd = pipeline.get_abbreviated_command()
        return 'command (%s): %s%s%s' % (cmd, src_str, sep, tgt_str)