コード例 #1
0
ファイル: literate.py プロジェクト: mattharrison/rubber3k
	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
ファイル: fig2dev.py プロジェクト: dspinellis/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:]
        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
ファイル: ps2pdf.py プロジェクト: zhipeng-jia/rubber
 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
ファイル: fig2dev.py プロジェクト: zhipeng-jia/rubber
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
ファイル: shell.py プロジェクト: dspinellis/rubber
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])