* Strip the binaries in $PREFIX/bin/ of all debugging info.
-* Copy dt2dv.exe and dv2dt.exe to $PREFIX/bin/ and clean_dvi.py to
- $PREFIX/Resources/scripts/ These are needed to enable dvips, yap
- et al. to cope with "file names with spaces".
-
-* Add formats and converters to the $PREFIX/Resources/configure
- script so that users can use the clean_dvi script transparently.
+* Copy dt2dv.exe and dv2dt.exe to $PREFIX/bin/. These are needed to enable
+ dvips, yap et al. to cope with "file names with spaces".
* Remove all stuff generated by running configure. It makes sense on
your machine only, not for whoever is installing LyX. Specifically
# It asks whether the Qt and LyX cvs trees are up to date.
# It asks whether the Qt library has been compiled.
-# It checks that qt-mt3.dll, mingw10.dll and clean_dvi.py exist.
+# It checks that qt-mt3.dll and mingw10.dll exist.
# It compiles the dv2dt and dt2dv utilites.
# It compiles and installs LyX.
LYX_DIR="../../.."
PACKAGING_DIR="$LYX_DIR/development/Win32/packaging"
DTL_DIR="$PACKAGING_DIR/dtl"
-CLEAN_DVI_DIR="$PACKAGING_DIR"
ASPELL_INSTALL_DIR="c:/Aspell"
LYX_ASPELL_DIR="/c/Aspell" # the Autotools don't like "C:/" syntax.
DT2DV="${DTL_DIR}/dt2dv.exe"
DV2DT="${DTL_DIR}/dv2dt.exe"
-CLEAN_DVI_PY="${CLEAN_DVI_DIR}/clean_dvi.py"
# Change this to 'mv -f' when you are confident that
# the various sed scripts are working correctly.
check_files_exist()
{
- # Check that the dlls and clean_dvi.py exist
- for file in "${QT_DLL}" "${MINGW_DLL}" "${CLEAN_DVI_PY}"
+ # Check that the dlls exist
+ for file in "${QT_DLL}" "${MINGW_DLL}"
do
test -r "${file}" || {
echo "$file does not exist" >&2
+++ /dev/null
-#! /usr/bin/env python
-
-'''
-file clean_dvi.py
-This file is part of LyX, the document processor.
-Licence details can be found in the file COPYING
-or at http://www.lyx.org/about/licence.php3
-
-author Angus Leeming
-Full author contact details are available in the file CREDITS
-or at http://www.lyx.org/about/credits.php
-
-Usage:
- python clean_dvi.py infile.dvi outfile.dvi
-
-clean_dvi modifies the input .dvi file so that
-dvips and yap (a dvi viewer on Windows) can find
-any embedded PostScript files whose names are protected
-with "-quotes.
-
-It works by:
-1 translating the machine readable .dvi file to human
- readable .dtl form,
-2 manipulating any references to external files
-3 translating the .dtl file back to .dvi format.
-
-It requires dv2dt and dt2dv from the DTL dviware package
-http://www.ctan.org/tex-archive/dviware/dtl/
-'''
-
-import os, re, sys
-
-def usage(prog_name):
- return 'Usage: %s in.dvi out.dvi\n' \
- % os.path.basename(prog_name)
-
-
-def warning(message):
- sys.stderr.write(message + '\n')
-
-
-def error(message):
- sys.stderr.write(message + '\n')
- sys.exit(1)
-
-
-def manipulated_dtl(data):
- psfile_re = re.compile(r'(special1 +)([0-9]+)( +\'PSfile=")(.*)(" llx=.*)')
-
- lines = data.split('\n')
- for i in range(len(lines)):
- line = lines[i]
- match = psfile_re.match(line)
- if match != None:
- file = match.group(4)
- filelen = len(file)
- file = file.replace('"', '')
- # Don't forget to update the length of the string too...
- strlen = int(match.group(2)) - (filelen - len(file))
-
- lines[i] = '%s%d%s%s%s' \
- % ( match.group(1), strlen, match.group(3),
- file, match.group(5) )
-
- return '\n'.join(lines)
-
-
-def main(argv):
- # First establish that the expected information has
- # been input on the command line and whether the
- # required executables exist.
- if len(argv) != 3:
- error(usage(argv[0]))
-
- infile = argv[1]
- outfile = argv[2]
-
- if not os.path.exists(infile):
- error('Unable to read "%s"\n' % infile)
-
- # Convert the input .dvi file to .dtl format.
- dv2dt_call = 'dv2dt "%s"' % infile
- dv2dt_stdin, dv2dt_stdout, dv2dt_stderr = \
- os.popen3(dv2dt_call, 't')
-
- dv2dt_stdin.close()
- dv2dt_data = dv2dt_stdout.read()
- dv2dt_status = dv2dt_stdout.close()
-
- if dv2dt_status != None or len(dv2dt_data) == 0:
- dv2dt_err = dv2dt_stderr.read()
- error("Failed: %s\n%s\n" % ( dv2dt_call, dv2dt_err) )
-
- # Manipulate the .dtl file.
- dtl_data = manipulated_dtl(dv2dt_data)
- if dtl_data == None:
- error("Failed to manipulate the dtl file")
-
- # Convert this .dtl file back to .dvi format.
- dt2dv_call = 'dt2dv -si "%s"' % outfile
- dt2dv_stdin = os.popen(dt2dv_call, 'w')
- dt2dv_stdin.write(dtl_data)
-
-
-if __name__ == "__main__":
- main(sys.argv)
# qt-mt3.dll
# iconv.dll
# mingw10.dll
-# clean_dvi.py
# dv2dt.exe
# dt2dv.exe
QT_DLL="$HOME/Qt/3x-msys/bin/qt-mt3.dll"
ICONV_DLL="/j/MinGW/bin/iconv.dll"
MINGW_DLL="/j/MinGW/bin/mingwm10.dll"
-CLEAN_DVI_PY="clean_dvi.py"
DTL_DIR=dtl
DT2DV="$DTL_DIR/dt2dv.exe"
DV2DT="$DTL_DIR/dv2dt.exe"
windows_packaging()
{
- # Install the necessary .dlls and clean_dvi stuff.
+ # Install the necessary .dlls.
for file in "${QT_DLL}" "${ICONV_DLL}" "${MINGW_DLL}" "${DT2DV}" "${DV2DT}"
do
cp "${file}" "$LYX_INSTALL_DIR"/bin/. || {
}
done
- cp "${CLEAN_DVI_PY}" "$LYX_INSTALL_DIR"/Resources/scripts/. || {
- echo "Failed to copy ${CLEAN_DVI_PY} to the LyX package" >&2
- exit 1
- }
-
# Strip the executables
(
cd "${LYX_INSTALL_DIR}/bin"
done
)
- # Modify the configure script,
- # * add a dvi2 format
- # * change the latex->dvi converter to latex->dvi2
- # * add a dvi2->dvi converter
- # * fix the generated chkconfig.sed so that it works with versions of
- # sed that get confused by sed scripts with DOS line endings.
- TMP=tmp.$$
- CONFIGURE="${LYX_INSTALL_DIR}"/Resources/configure
- # Do this to make it easy to compare the before and after files.
- dos2unix "${CONFIGURE}"
- sed '
-# (Note that this sed script contains TAB characters.)
-# Append the dvi2 format after the dvi format.
-/^ *\\\\Format[ ]\{1,\}dvi[ ]\{1,\}/a\
-\\\\Format dvi2 dvi DraftDVI ""
-
-# Change the latex->dvi converter to latex->dvi2
-# and append the dvi2->dvi converter
-/^ *\\\\converter[ ]\{1,\}latex[ ]\{1,\}dvi[ ]\{1,\}/{
-s/dvi/dvi2/
-a\
-\\\\converter dvi2 dvi "python \\\$\\\$s/scripts/clean_dvi.py \\\$\\\$i \\\$\\\$o" ""
-}
-' "${CONFIGURE}" > "${TMP}"
- cmp -s "${CONFIGURE}" "${TMP}" || {
- diff -u "${CONFIGURE}" "${TMP}"
- ${MV} "${TMP}" "${CONFIGURE}"
- }
- rm -f "${TMP}"
-
# Strip the executables
(
cd "${LYX_INSTALL_DIR}/Resources"
# in install-data-hook.
dist_scripts_DATA = \
scripts/TeXFiles.sh \
+ scripts/clean_dvi.py \
scripts/convertDefault.sh \
scripts/fen2ascii.py \
scripts/fig2pdftex.sh \
def checkLatex():
''' Check latex, return lyx_check_config '''
# Find programs! Returned path is not used now
- path, LATEX = checkProg( 'a Latex2e program', ['pplatex $$i', 'latex $$i', 'latex2e $$i'],
- rc_entry = [ r'\converter latex dvi "%%" "latex"' ] )
+ if os.name == 'nt' or sys.platform == 'cygwin':
+ # Windows only: DraftDVI
+ if checkProg('DVI to DTL converter', ['dv2dt']) != ['', 'none'] and checkProg('DTL to DVI converter', ['dt2dv']) != ['', 'none']:
+ converter_entry = r'''\converter latex dvi2 "%%" "latex"
+\converter dvi2 dvi "python $$s/scripts/clean_dvi.py $$i $$o" ""'''
+ else:
+ converter_entry = r'\converter latex dvi "%%" "latex"'
+ else:
+ converter_entry = r'\converter latex dvi "%%" "latex"'
+ path, LATEX = checkProg('a Latex2e program', ['pplatex $$i', 'latex $$i', 'latex2e $$i'],
+ rc_entry = [converter_entry])
# no latex
if LATEX != 'none':
# Check if latex is usable
#
checkProg('a DVI previewer', ['xdvi', 'kdvi'],
rc_entry = [ r'\Format dvi dvi DVI D "%%" "" "document"' ])
+ if os.name == 'nt' or sys.platform == 'cygwin':
+ # Windows only: DraftDVI
+ if checkProg('DVI to DTL converter', ['dv2dt']) != ['', 'none'] and checkProg('DTL to DVI converter', ['dt2dv']) != ['', 'none']:
+ addToRC(r'\Format dvi2 dvi DraftDVI "" "" "document"')
#
checkProg('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'],
rc_entry = [ r'\Format html html HTML H "%%" "" "document"' ])
--- /dev/null
+#! /usr/bin/env python
+
+'''
+file clean_dvi.py
+This file is part of LyX, the document processor.
+Licence details can be found in the file COPYING
+or at http://www.lyx.org/about/licence.php3
+
+author Angus Leeming
+Full author contact details are available in the file CREDITS
+or at http://www.lyx.org/about/credits.php
+
+Usage:
+ python clean_dvi.py infile.dvi outfile.dvi
+
+clean_dvi modifies the input .dvi file so that
+dvips and yap (a dvi viewer on Windows) can find
+any embedded PostScript files whose names are protected
+with "-quotes.
+
+It works by:
+1 translating the machine readable .dvi file to human
+ readable .dtl form,
+2 manipulating any references to external files
+3 translating the .dtl file back to .dvi format.
+
+It requires dv2dt and dt2dv from the DTL dviware package
+http://www.ctan.org/tex-archive/dviware/dtl/
+'''
+
+import os, re, sys
+
+def usage(prog_name):
+ return 'Usage: %s in.dvi out.dvi\n' \
+ % os.path.basename(prog_name)
+
+
+def warning(message):
+ sys.stderr.write(message + '\n')
+
+
+def error(message):
+ sys.stderr.write(message + '\n')
+ sys.exit(1)
+
+
+def manipulated_dtl(data):
+ psfile_re = re.compile(r'(special1 +)([0-9]+)( +\'PSfile=")(.*)(" llx=.*)')
+
+ lines = data.split('\n')
+ for i in range(len(lines)):
+ line = lines[i]
+ match = psfile_re.match(line)
+ if match != None:
+ file = match.group(4)
+ filelen = len(file)
+ file = file.replace('"', '')
+ # Don't forget to update the length of the string too...
+ strlen = int(match.group(2)) - (filelen - len(file))
+
+ lines[i] = '%s%d%s%s%s' \
+ % ( match.group(1), strlen, match.group(3),
+ file, match.group(5) )
+
+ return '\n'.join(lines)
+
+
+def main(argv):
+ # First establish that the expected information has
+ # been input on the command line and whether the
+ # required executables exist.
+ if len(argv) != 3:
+ error(usage(argv[0]))
+
+ infile = argv[1]
+ outfile = argv[2]
+
+ if not os.path.exists(infile):
+ error('Unable to read "%s"\n' % infile)
+
+ # Convert the input .dvi file to .dtl format.
+ dv2dt_call = 'dv2dt "%s"' % infile
+ dv2dt_stdin, dv2dt_stdout, dv2dt_stderr = \
+ os.popen3(dv2dt_call, 't')
+
+ dv2dt_stdin.close()
+ dv2dt_data = dv2dt_stdout.read()
+ dv2dt_status = dv2dt_stdout.close()
+
+ if dv2dt_status != None or len(dv2dt_data) == 0:
+ dv2dt_err = dv2dt_stderr.read()
+ error("Failed: %s\n%s\n" % ( dv2dt_call, dv2dt_err) )
+
+ # Manipulate the .dtl file.
+ dtl_data = manipulated_dtl(dv2dt_data)
+ if dtl_data == None:
+ error("Failed to manipulate the dtl file")
+
+ # Convert this .dtl file back to .dvi format.
+ dt2dv_call = 'dt2dv -si "%s"' % outfile
+ dt2dv_stdin = os.popen(dt2dv_call, 'w')
+ dt2dv_stdin.write(dtl_data)
+
+
+if __name__ == "__main__":
+ main(sys.argv)