# Full author contact details are available in file CREDITS.
from __future__ import print_function
-import glob, logging, os, re, shutil, subprocess, sys, stat, io
+import glob, logging, os, re, shutil, subprocess, sys, stat
# set up logging
logging.basicConfig(level = logging.DEBUG,
\Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format literate nw NoWeb N "" "%%" "document,menu=export" ""
\Format sweave Rnw "Sweave" S "" "%%" "document,menu=export" ""
+\Format sweave-ja Rnw "Sweave (Japanese)" S "" "%%" "document,menu=export" ""
\Format r R "R/S code" "" "" "%%" "document,menu=export" ""
\Format knitr Rnw "Rnw (knitr)" "" "" "%%" "document,menu=export" ""
+\Format knitr-ja Rnw "Rnw (knitr, Japanese)" "" "" "%%" "document,menu=export" ""
\Format lilypond ly "LilyPond music" "" "" "%%" "vector" "text/x-lilypond"
\Format lilypond-book lytex "LilyPond book (LaTeX)" "" "" "%%" "document,menu=export" ""
+\Format lilypond-book-ja lytex "LilyPond book (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format latex tex "LaTeX (plain)" L "" "%%" "document,menu=export" "text/x-tex"
\Format luatex tex "LaTeX (LuaTeX)" "" "" "%%" "document,menu=export" ""
\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document,menu=export" ""
checkProg('a Sweave -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxsweave.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter sweave latex "%%" "needauth"
\converter sweave pdflatex "%%" "needauth"
+\converter sweave-ja platex "%%" "needauth"
\converter sweave xetex "%%" "needauth"
\converter sweave luatex "%%" "needauth"
\converter sweave dviluatex "%%" "needauth"'''])
checkProg('a knitr -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter knitr latex "%%" "needauth"
\converter knitr pdflatex "%%" "needauth"
+\converter knitr-ja platex "%%" "needauth"
\converter knitr xetex "%%" "needauth"
\converter knitr luatex "%%" "needauth"
\converter knitr dviluatex "%%" "needauth"'''])
#
checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'],
- rc_entry = [ r'\converter sweave r "%%" "needauth"' ])
+ rc_entry = [ r'\converter sweave r "%%" "needauth"',
+ r'\converter sweave-ja r "%%" "needauth"' ])
#
checkProg('a knitr -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r tangle'],
- rc_entry = [ r'\converter knitr r "%%" "needauth"' ])
+ rc_entry = [ r'\converter knitr r "%%" "needauth"',
+ r'\converter knitr-ja r "%%" "needauth"' ])
#
checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex',
'htmltolatex -input $$i -output $$o', 'htmltolatex.jar -input $$i -output $$o'],
# Only define a converter from pdf6 for graphics
checkProg('a PDF to EPS converter', ['pdftops -eps -f 1 -l 1 $$i $$o'],
rc_entry = [ r'\converter pdf6 eps "%%" ""' ])
+ # Define a converter from pdf6 to png for Macs where pdftops is missing.
+ # The converter utility sips allows to force the dimensions of the resulting
+ # png image. The value of 800 pixel for the width is arbitrary and not
+ # related to the current screen resolution or width.
+ # There is no converter parameter for this information.
+ checkProg('a PDF to PNG converter',
+ ['sips --resampleWidth 800 --setProperty format png $$i --out $$o'],
+ rc_entry = [ r'\converter pdf6 png "%%" ""' ])
# Create one converter for a PDF produced using TeX fonts and one for a
# PDF produced using non-TeX fonts. This does not produce non-unique
# conversion paths, since a given document either uses TeX fonts or not.
\converter fig ppm "fig2dev -L ppm $$i $$o" ""
\converter fig svg "fig2dev -L svg $$i $$o" ""
\converter fig png "fig2dev -L png $$i $$o" ""
-\converter svg pdftex "python -tt $$s/scripts/svg2pdftex.py $$i $$o" ""
-\converter svg pstex "python -tt $$s/scripts/svg2pstex.py $$i $$o" ""
\converter fig pdftex "python -tt $$s/scripts/fig2pdftex.py $$i $$o" ""
\converter fig pstex "python -tt $$s/scripts/fig2pstex.py $$i $$o" ""''')
#
+ checkProg('a SVG -> PDFTeX converter', [inkscape_name],
+ rc_entry = [ r'\converter svg pdftex "python -tt $$s/scripts/svg2pdftex.py %% $$i $$o" ""'],
+ path = [inkscape_path])
+ #
+ checkProg('a SVG -> PSTeX converter', [inkscape_name],
+ rc_entry = [ r'\converter svg pstex "python -tt $$s/scripts/svg2pstex.py %% $$i $$o" ""'],
+ path = [inkscape_path])
+ #
checkProg('a TIFF -> PS converter', ['tiff2ps $$i > $$o'],
rc_entry = [ r'\converter tiff eps "%%" ""'])
#
# The eps2->eps converter then fixes the bounding box by cropping.
# Although unoconv can convert to png and pdf as well, do not define
# odg->png and odg->pdf converters, since the bb would be too large as well.
- checkProg('an OpenDocument -> EPS converter', ['libreoffice -headless -nologo -convert-to eps $$i', 'unoconv -f eps --stdout $$i > $$o'],
+ checkProg('an OpenDocument -> EPS converter', ['libreoffice --headless --nologo --convert-to eps $$i', 'unoconv -f eps --stdout $$i > $$o'],
rc_entry = [ r'\converter odg eps2 "%%" ""'])
#
checkProg('a SVG (compressed) -> SVG converter', ['gunzip -c $$i > $$o'],
rc_entry = [ r'''\converter svg png "%%" "",
\converter svgz png "%%" ""'''],
path = ['', inkscape_path])
-
+ #
+ checkProg('Gnuplot', ['gnuplot'],
+ rc_entry = [ r'''\Format gnuplot "gp, gnuplot" "Gnuplot" "" "" "" "vector" "text/plain"
+\converter gnuplot pdf6 "python -tt $$s/scripts/gnuplot2pdf.py $$i $$o" "needauth"''' ])
#
# gnumeric/xls/ods to tex
checkProg('a spreadsheet -> latex converter', ['ssconvert'],
# this, use different output folders for eps and pdf outputs.
addToRC(r'\converter lilypond-book latex "lilypond-book --safe --lily-output-dir=ly-eps $$i" ""')
addToRC(r'\converter lilypond-book pdflatex "lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$i" ""')
+ addToRC(r'\converter lilypond-book-ja platex "lilypond-book --safe --pdf --latex-program=platex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book xetex "lilypond-book --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book luatex "lilypond-book --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book dviluatex "lilypond-book --safe --latex-program=dvilualatex --lily-output-dir=ly-eps $$i" ""')
'splitindex.class'], rc_entry = [ r'\splitindex_command "%%"' ])
checkProg('a nomenclature processor', ['makeindex'],
rc_entry = [ r'\nomencl_command "makeindex -s nomencl.ist"' ])
+ checkProg('a python-pygments driver command', ['pygmentize'],
+ rc_entry = [ r'\pygmentize_command "%%"' ])
## FIXME: OCTAVE is not used anywhere
# path, OCTAVE = checkProg('Octave', ['octave'])
## FIXME: MAPLE is not used anywhere
# Construct the list of classes to test for.
# build the list of available layout files and convert it to commands
# for chkconfig.ltx
- declare = re.compile(r'^\s*#\s*\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
- category = re.compile(r'^\s*#\s*\\DeclareCategory{(.*)}\s*$')
- empty = re.compile(r'^\s*$')
+ declare = re.compile(b'^\\s*#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
+ category = re.compile(b'^\\s*#\\s*\\\\DeclareCategory{(.*)}\\s*$')
+ empty = re.compile(b'^\\s*$')
testclasses = list()
for file in (glob.glob( os.path.join('layouts', '*.layout') )
+ glob.glob( os.path.join(srcdir, 'layouts', '*.layout' ) ) ):
if not os.path.isfile(file):
continue
classname = file.split(os.sep)[-1].split('.')[0]
- decline = ""
- catline = ""
- if os.name == 'nt':
- enco = sys.getfilesystemencoding()
- else:
- enco="utf8"
- for line in io.open(file, encoding=enco).readlines():
- if not empty.match(line) and line[0] != '#':
- if decline == "":
+ decline = b""
+ catline = b""
+ for line in open(file, 'rb').readlines():
+ if not empty.match(line) and line[0] != b'#'[0]:
+ if decline == b"":
logger.warning("Failed to find valid \Declare line "
"for layout file `%s'.\n\t=> Skipping this file!" % file)
nodeclaration = True
# A class, but no category declaration. Just break.
break
if declare.search(line) != None:
- decline = "\\TestDocClass{%s}{%s}" % (classname, line[1:].strip())
+ decline = b"\\TestDocClass{%s}{%s}" \
+ % (classname.encode('ascii'), line[1:].strip())
testclasses.append(decline)
elif category.search(line) != None:
- catline = ("\\DeclareCategory{%s}{%s}"
- % (classname, category.search(line).groups()[0]))
+ catline = (b"\\DeclareCategory{%s}{%s}"
+ % (classname.encode('ascii'),
+ category.search(line).groups()[0]))
testclasses.append(catline)
- if catline == "" or decline == "":
+ if catline == b"" or decline == b"":
continue
break
if nodeclaration:
continue
testclasses.sort()
- cl = open('chklayouts.tex', 'w')
+ cl = open('chklayouts.tex', 'wb')
for line in testclasses:
- cl.write(line + '\n')
+ cl.write(line + b'\n')
cl.close()
#
# we have chklayouts.tex, then process it
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
- lyxrc_fileformat = 21
+ lyxrc_fileformat = 23
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''