add python support to configure

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10221 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2005-07-15 16:38:59 +00:00
parent c95df1c147
commit dc3e0ae6e0
9 changed files with 195 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2005-07-15 José Matos <jamatos@lyx.org>
* configure.ac: Add support for python, and add Makefile to
lyx2lyx.
2005-07-14 Angus Leeming <leeming@lyx.org>
* Makefile.am (EXTRA_DIST): add the new README and INSTALL files

View File

@ -1,3 +1,7 @@
2005-07-15 José Matos <jamatos@lyx.org>
* py-compile: new file to byte-compile python scripts.
2005-07-15 <lgb@tandberg.net>
* lyxinclude.m4 (lyx_pch_comp): add profiling switch

146
config/py-compile Executable file
View File

@ -0,0 +1,146 @@
#!/bin/sh
# py-compile - Compile a Python program
scriptversion=2005-02-02.22
# Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
if [ -z "$PYTHON" ]; then
PYTHON=python
fi
basedir=
destdir=
files=
while test $# -ne 0; do
case "$1" in
--basedir)
basedir=$2
if test -z "$basedir"; then
echo "$0: Missing argument to --basedir." 1>&2
exit 1
fi
shift
;;
--destdir)
destdir=$2
if test -z "$destdir"; then
echo "$0: Missing argument to --destdir." 1>&2
exit 1
fi
shift
;;
-h|--h*)
cat <<\EOF
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
Byte compile some python scripts FILES. Use --destdir to specify any
leading directory path to the FILES that you don't want to include in the
byte compiled file. Specify --basedir for any additional path information you
do want to be shown in the byte compiled file.
Example:
py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "py-compile $scriptversion"
exit $?
;;
*)
files="$files $1"
;;
esac
shift
done
if test -z "$files"; then
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
fi
# if basedir was given, then it should be prepended to filenames before
# byte compilation.
if [ -z "$basedir" ]; then
pathtrans="path = file"
else
pathtrans="path = os.path.join('$basedir', file)"
fi
# if destdir was given, then it needs to be prepended to the filename to
# byte compile but not go into the compiled file.
if [ -z "$destdir" ]; then
filetrans="filepath = path"
else
filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
fi
$PYTHON -c "
import sys, os, string, py_compile
files = '''$files'''
print 'Byte-compiling python modules...'
for file in string.split(files):
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
print file,
sys.stdout.flush()
py_compile.compile(filepath, filepath + 'c', path)
print" || exit $?
# this will fail for python < 1.5, but that doesn't matter ...
$PYTHON -O -c "
import sys, os, string, py_compile
files = '''$files'''
print 'Byte-compiling python modules (optimized versions) ...'
for file in string.split(files):
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
print file,
sys.stdout.flush()
py_compile.compile(filepath, filepath + 'o', path)
print" 2>/dev/null || :
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -38,6 +38,9 @@ if test "x$KPSEWHICH" = xkpsewhich ; then
fi
AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
# Check for installed python
AM_PATH_PYTHON(1.5.2,, :)
# Work around a problem in automake 1.4: when invoking install-strip,
# INSTALL_PROGRAM is changed to 'install -s', and since
# INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
@ -410,6 +413,7 @@ AC_CONFIG_FILES([Makefile m4/Makefile \
development/lyx.spec \
lib/Makefile \
lib/doc/Makefile \
lib/lyx2lyx/Makefile \
intl/Makefile \
po/Makefile.in \
sourcedoc/Doxyfile \

View File

@ -1,3 +1,8 @@
2005-07-15 José Matos <jamatos@lyx.org>
* Makefile.am: remove lyx2lyx references, place it only as a
subdirectory.
2005-07-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* configure.m4: typo.

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/config/common.am
DISTCLEANFILES += texput.log textclass.lst packages.lst lyxrc.defaults
SUBDIRS = doc reLyX
SUBDIRS = doc reLyX lyx2lyx
EXTRA_DIST = \
configure.m4 \
@ -833,26 +833,6 @@ dist_layouts_DATA =\
layouts/g-brief2.layout \
layouts/svglobal.layout
lyx2lyxdir = $(pkgdatadir)/lyx2lyx
# We cannot use dist_lyx2lyx_SCRIPTS for lyx2lyx, since a possible
# version-suffix would get appended to the names. So we use dist_scripts_DATA
# and chmod manually in install-data-hook.
dist_lyx2lyx_DATA = \
lyx2lyx/lyx2lyx \
lyx2lyx/parser_tools.py \
lyx2lyx/LyX.py \
lyx2lyx/lyx_0_12.py \
lyx2lyx/lyx_1_0_0.py \
lyx2lyx/lyx_1_0_1.py \
lyx2lyx/lyx_1_1_4.py \
lyx2lyx/lyx_1_1_5.py \
lyx2lyx/lyx_1_1_6.py \
lyx2lyx/lyx_1_1_6fix3.py \
lyx2lyx/lyx_1_2.py \
lyx2lyx/lyx_1_3.py \
lyx2lyx/lyx_1_4.py \
lyx2lyx/profiling.py
scriptsdir = $(pkgdatadir)/scripts
# We cannot use dist_scripts_SCRIPTS, since a possible version-suffix would
# get appended to the names. So we use dist_scripts_DATA and chmod manually
@ -941,7 +921,6 @@ install-data-local: install-xfonts
uninstall-local: uninstall-xfonts
install-data-hook:
$(CHMOD) 755 $(DESTDIR)$(pkgdatadir)/lyx2lyx/lyx2lyx
$(CHMOD) 755 $(DESTDIR)$(pkgdatadir)/configure
for i in $(dist_scripts_DATA); do \
$(CHMOD) 755 $(DESTDIR)$(pkgdatadir)/$$i; \

View File

@ -1,3 +1,5 @@
*.pyc
*.prof
lyx2lyxc
Makefile
Makefile.in

View File

@ -1,3 +1,8 @@
2005-07-15 José Matos <jamatos@lyx.org>
* Makefile.am: new file for correct dealing with python scripts.
* .cvsignore: ignore Makefile(.in) files.
2005-07-12 José Matos <jamatos@lyx.org>
* lyx_1_4.py (add_to_preamble): Make it more robust.

23
lib/lyx2lyx/Makefile.am Normal file
View File

@ -0,0 +1,23 @@
include $(top_srcdir)/config/common.am
CLEANFILES += *.pyc *.pyo
lyx2lyxdir = $(pkgdatadir)/lyx2lyx
# We cannot use dist_lyx2lyx_SCRIPTS for lyx2lyx, since a possible
# version-suffix would get appended to the names. So we use dist_scripts_DATA
# and chmod manually in install-data-hook.
dist_lyx2lyx_PYTHON = \
lyx2lyx \
parser_tools.py \
LyX.py \
lyx_0_12.py \
lyx_1_0_0.py \
lyx_1_0_1.py \
lyx_1_1_4.py \
lyx_1_1_5.py \
lyx_1_1_6.py \
lyx_1_1_6fix3.py \
lyx_1_2.py \
lyx_1_3.py \
lyx_1_4.py \
profiling.py