示例#1
0
	def __init__ (self, set, target, source):
		assert target[-4:] == '.tex'
		base = target[:-4]
		Shell.__init__(self, set,
			["cweave", source, target],
			[target, base + ".idx", base + ".scn"],
			[source])
示例#2
0
文件: ps2pdf.py 项目: skapfer/rubber
 def __init__ (self, document, context):
     env = document.env
     if env.final.products[0][-3:] != '.ps':
          msg.error(_("I can't use ps2pdf when not producing a PS"))
          rubber.util.abort_generic_error ()
     ps = env.final.products[0]
     pdf = ps[:-2] + 'pdf'
     cmd = ['ps2pdf']
     cmd.extend([ps, pdf])
     dep = Shell (env.depends, cmd)
     dep.add_product (pdf)
     dep.add_source (ps)
     env.final = dep
示例#3
0
def convert(source, target, context, set):
    if target[-2:] != '_t':

        # Here we assume the target has an extension of a standard form, i.e.
        # its requested type can be deduced from the part of its name after
        # the last dot. We also assume that this extension is the name of the
        # appropriate language (it works fine in the cases where the module is
        # used, that is for eps, pdf and png).

        language = target[target.rfind('.') + 1:]
        return Shell(set, ['fig2dev', '-L', language, source, target],
                     [target], [source])

    else:

        # Here we assume that the target has the form BASE.EXT_t, where EXT is
        # eps, pdf, pstex or pdftex. In this case we call fig2dev in such a
        # way that BASE.EXT_t refers to graphics file BASE and not BASE.EXT.
        # This way, the source will compile independently of the engine.

        the_dot = target.rfind('.')
        base_name = target[:the_dot]
        extension = target[the_dot + 1:]
        image_reference = base_name[base_name.rfind('/') + 1:]

        if 'graphics_suffixes' in context:
            if '.pdf' in context['graphics_suffixes']:
                language = 'pdftex'
                image_file = base_name + '.pdf'
            else:
                language = 'pstex'
                image_file = base_name + '.eps'
        elif extension in ('pdftex_t', 'pdf_t'):
            language = 'pdftex'
            image_file = base_name + '.pdf'
        else:
            language = 'pstex'
            image_file = base_name + '.eps'

        Shell(set, ['fig2dev', '-L', language, source, image_file],
              [image_file], [source])
        return Shell(set, [
            'fig2dev', '-L', language + '_t', '-p', image_reference, source,
            target
        ], [target], [source, image_file])
示例#4
0
def setup(doc, context):
    env = doc.env
    if env.final.products[0][-3:] != '.ps':
        msg.error(_("I can't use ps2pdf when not producing a PS"))
        sys.exit(2)
    ps = env.final.products[0]
    pdf = ps[:-2] + 'pdf'
    cmd = ['ps2pdf']
    for opt in doc.vars['paper'].split():
        cmd.append('-sPAPERSIZE=' + opt)
    cmd.extend([ps, pdf])
    dep = Shell(doc.env.depends, cmd, [pdf], [ps])
    env.final = dep
示例#5
0
 def __init__(self, document, opt):
     ps = document.env.final.primary_product()
     if not ps.endswith('.ps'):
         raise rubber.GenericError(_("ps2pdf cannot produce PS"))
     pdf = ps[:-2] + 'pdf'
     dep = Shell(('ps2pdf', ps, pdf))
     dep.add_product(pdf)
     dep.add_source(ps)
     document.env.final = dep
示例#6
0
 def __init__(self, document, context):
     env = document.env
     if env.final.products[0][-3:] != '.ps':
         msg.error(_("I can't use ps2pdf when not producing a PS"))
         rubber.util.abort_generic_error()
     ps = env.final.products[0]
     pdf = ps[:-2] + 'pdf'
     cmd = ['ps2pdf']
     for opt in document.vars['paper'].split():
         cmd.append('-sPAPERSIZE=' + opt)
     cmd.extend([ps, pdf])
     dep = Shell(env.depends, cmd)
     dep.add_product(pdf)
     dep.add_source(ps)
     env.final = dep
示例#7
0
文件: cweb.py 项目: dspinellis/rubber
def convert(source, target, context, set):
    base = target[:-4]
    return Shell(set, ["cweave", source, target],
                 [target, base + ".idx", base + ".scn"], [source])
示例#8
0
def convert(source, target, context, set):
    result = Shell(set, parse_line(context['command'], context))
    result.add_product(target)
    result.add_source(source)
    return result
示例#9
0
def convert(source, target, context, env):
    # The source path is embedded by fig2dev into the target,
    # causing problem with LaTeX and non-ASCII characters.
    # Always give a relative path.

    if target[-2:] != '_t':

        # Here we assume the target has an extension of a standard form, i.e.
        # its requested type can be deduced from the part of its name after
        # the last dot. We also assume that this extension is the name of the
        # appropriate language (it works fine in the cases where the module is
        # used, that is for eps, pdf and png).

        language = target[target.rfind('.') + 1:]
        result = Shell(('fig2dev', '-L', language, source, target))
        result.add_product(target)
        result.add_source(source)
        return result

    else:

        # Here we assume that the target has the form BASE.EXT_t, where EXT is
        # eps, pdf, pstex or pdftex. In this case we call fig2dev in such a
        # way that BASE.EXT_t refers to graphics file BASE and not BASE.EXT.
        # This way, the source will compile independently of the engine.

        the_dot = target.rfind('.')
        base_name = target[:the_dot]
        extension = target[the_dot + 1:]
        image_reference = base_name[base_name.rfind('/') + 1:]

        if '.pdf' in env.graphics_suffixes:
            language = 'pdftex'
            image_file = base_name + '.pdf'
        else:
            language = 'pstex'
            image_file = base_name + '.eps'

        temp = Shell(('fig2dev', '-L', language, source, image_file))
        temp.add_product(image_file)
        temp.add_source(source)

        result = Shell(('fig2dev', '-L', language + '_t', '-p',
                        image_reference, source, target))
        result.add_product(target)
        result.add_source(source)
        result.add_source(image_file)
        return result
示例#10
0
文件: fig2dev.py 项目: skapfer/rubber
def convert (source, target, context, set):
	if target[-2:] != '_t':

		# Here we assume the target has an extension of a standard form, i.e.
		# its requested type can be deduced from the part of its name after
		# the last dot. We also assume that this extension is the name of the
		# appropriate language (it works fine in the cases where the module is
		# used, that is for eps, pdf and png).

		language = target[target.rfind('.')+1:]
		result = Shell (set, ['fig2dev', '-L', language, source, target])
		result.add_product (target)
		result.add_source (source)
		return result

	else:

		# Here we assume that the target has the form BASE.EXT_t, where EXT is
		# eps, pdf, pstex or pdftex. In this case we call fig2dev in such a
		# way that BASE.EXT_t refers to graphics file BASE and not BASE.EXT.
		# This way, the source will compile independently of the engine.

		the_dot = target.rfind('.')
		base_name = target[:the_dot]
		extension = target[the_dot+1:]
		image_reference = base_name[base_name.rfind('/')+1:]

		if 'graphics_suffixes' in context:
			if '.pdf' in context['graphics_suffixes']:
				language = 'pdftex'
				image_file = base_name + '.pdf'
			else:
				language = 'pstex'
				image_file = base_name + '.eps'
		elif extension in ('pdftex_t', 'pdf_t'):
			language = 'pdftex'
			image_file = base_name + '.pdf'
		else:
			language = 'pstex'
			image_file = base_name + '.eps'

		temp = Shell (set, ['fig2dev', '-L', language, source, image_file])
		temp.add_product (image_file)
		temp.add_source (source)

		result = Shell (set, ['fig2dev', '-L', language + '_t',
				      '-p', image_reference, source, target])
		result.add_product (target)
		result.add_source (source)
		result.add_source (image_file)
		return result
示例#11
0
文件: shell.py 项目: skapfer/rubber
def convert (source, target, context, set):
	result = Shell (set, parse_line(context['command'], context))
	result.add_product (target)
	result.add_source (source)
	return result
示例#12
0
def convert(source, target, context, set):
    return Shell(set, parse_line(context['command'], context), [target],
                 [source])
示例#13
0
 def __init__(self, set, target, source):
     assert target[-4:] == '.tex'
     base = target[:-4]
     Shell.__init__(self, set, ["cweave", source, target],
                    [target, base + ".idx", base + ".scn"], [source])