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
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
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
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
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
def convert(source, target, context, set): result = Shell(set, parse_line(context['command'], context)) result.add_product(target) result.add_source(source) return result
def convert (source, target, context, set): result = Shell (set, parse_line(context['command'], context)) result.add_product (target) result.add_source (source) return result