]> git.lyx.org Git - features.git/commitdiff
add python support to configure
authorJosé Matox <jamatos@lyx.org>
Fri, 15 Jul 2005 16:38:59 +0000 (16:38 +0000)
committerJosé Matox <jamatos@lyx.org>
Fri, 15 Jul 2005 16:38:59 +0000 (16:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10221 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
config/ChangeLog
config/py-compile [new file with mode: 0755]
configure.ac
lib/ChangeLog
lib/Makefile.am
lib/lyx2lyx/.cvsignore
lib/lyx2lyx/ChangeLog
lib/lyx2lyx/Makefile.am [new file with mode: 0644]

index 5448a3666e79569254f4c6c1721ee5322897e09b..219c0b78d1831d6679ed0def47807f26407a8fb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index f2ce9f3d8a042ab56e17bdcf458ac02c2be15906..c091be78f4af2cdec00b551022221a588cda7cbf 100644 (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
diff --git a/config/py-compile b/config/py-compile
new file mode 100755 (executable)
index 0000000..ca2a05c
--- /dev/null
@@ -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:
index d0a64ccdb00c4494d21fbb28eefa3e85f34c66a1..8e3de3d27a41576f2e1d3564041a4e1f5dd8a15c 100644 (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 \
index 4693c1cd3e78b2c25c6f3f5313e80487aa3cb556..772242585dc7a5de51601531ba518a3ddce30aed 100644 (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. 
index 92551f0bf7089c062a46f63c26997f99997daae0..1dc28e1782f1a06f264a3937da71e60b3e23717a 100644 (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; \
index c57ea5695009461ab8a21ea4a024d6687b1c0515..0e1d4d571b8583e504a3f1c4cf6e87f5a6acaa81 100644 (file)
@@ -1,3 +1,5 @@
 *.pyc
 *.prof
 lyx2lyxc
+Makefile
+Makefile.in
index 88b19011c082db8facb13bb8f536199b5600de19..7c63a1b3dfe2f65df8ff29dea886d7d1da1e67d6 100644 (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.
diff --git a/lib/lyx2lyx/Makefile.am b/lib/lyx2lyx/Makefile.am
new file mode 100644 (file)
index 0000000..270d498
--- /dev/null
@@ -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