예제 #1
0
	def run (self):
		msg.progress(_("running: %s") % ' '.join(self.command))
		process = Popen(self.command, stdin=devnull(), stdout=self.stdout)
		if process.wait() != 0:
			msg.error(_("execution of %s failed") % self.command[0])
			return False
		return True
예제 #2
0
 def run(self):
     msg.progress(_("running: %s") % ' '.join(self.command))
     process = Popen(self.command, stdin=devnull(), stdout=self.stdout)
     if process.wait() != 0:
         msg.error(_("execution of %s failed") % self.command[0])
         return False
     return True
예제 #3
0
    def prepare_source(self, filename):
        """
		Dump the standard input in a file, and set up that file
		the same way we would normally process LaTeX sources.
		"""
        assert filename.endswith("-")  # filename is ignored

        try:
            # Make a temporary on-disk copy of the standard input,
            # in the current working directory.
            # The name will have the form "rubtmpXXX.tex.
            with tempfile.NamedTemporaryFile(suffix='.tex',
                                             prefix='rubtmp',
                                             dir='.',
                                             delete=False) as srcfile:
                # note the tempfile name so we can remove it later
                self.pipe_tempfile = srcfile.name
                # copy stdin into the tempfile
                msg.progress(_("saving the input in %s") % self.pipe_tempfile)
                shutil.copyfileobj(sys.stdin, srcfile)
        except IOError:
            msg.error(
                _("cannot create temporary file for the main LaTeX source"))
            rubber.util.abort_generic_error()

        return super(Pipe, self).prepare_source(self.pipe_tempfile)
예제 #4
0
 def parse_kpse():
     for line in process.stderr.readlines():
         line = line.rstrip()
         match = re_kpse.match(line)
         if not match:
             continue
         cmd = match.group("cmd")
         if self.kpse_msg.has_key(cmd):
             msg.progress(match.expand(self.kpse_msg[cmd]))
         else:
             msg.progress(_("kpathsea running %s") % cmd)
예제 #5
0
 def parse_kpse ():
     for line in process.stderr.readlines():
         line = line.rstrip()
         match = re_kpse.match(line)
         if not match:
             continue
         cmd = match.group("cmd")
         if self.kpse_msg.has_key(cmd):
             msg.progress(match.expand(self.kpse_msg[cmd]))
         else:
             msg.progress(_("kpathsea running %s") % cmd)
예제 #6
0
	def run (self):
		# check if the input file exists. if not, refuse to run.
		if not os.path.exists (self.sources[0]):
			msg.info (_("input file for %s does not yet exist, deferring")
				% self.tool, pkg="biblio")
			return True

		# command might have been updated in the mean time, so get it now
		self.environ["BIBINPUTS"] = ":".join (self.bib_paths)
		self.environ["BSTINPUTS"] = ":".join (self.bst_paths)
		command = self.build_command ()

		msg.progress (_("running: %s") % " ".join (command))
		process = subprocess.Popen (command, stdin = self.devnull,
			stdout = self.devnull, env = self.environ)
		if process.wait() != 0:
			msg.error (_("There were errors running %s.") % self.tool, pkg="biblio")
			return False
		return True
예제 #7
0
파일: cmdline.py 프로젝트: skapfer/rubber
	def prepare_source (self, filename):
		"""
		Dump the standard input in a file, and set up that file
		the same way we would normally process LaTeX sources.
		"""
		assert filename.endswith ("-")  # filename is ignored

		try:
			# Make a temporary on-disk copy of the standard input,
			# in the current working directory.
			# The name will have the form "rubtmpXXX.tex.
			with tempfile.NamedTemporaryFile (suffix='.tex', prefix='rubtmp', dir='.', delete=False) as srcfile:
				# note the tempfile name so we can remove it later
				self.pipe_tempfile = srcfile.name
				# copy stdin into the tempfile
				msg.progress (_("saving the input in %s") % self.pipe_tempfile)
				shutil.copyfileobj (sys.stdin, srcfile)
		except IOError:
			msg.error (_("cannot create temporary file for the main LaTeX source"))
			rubber.util.abort_generic_error ()

		return super (Pipe, self).prepare_source (self.pipe_tempfile)