diff -aurN automake-1.9.3.orig/lib/am/python.am automake-1.9.3/lib/am/python.am --- automake-1.9.3.orig/lib/am/python.am 2004-01-28 21:50:43.000000000 +0100 +++ automake-1.9.3/lib/am/python.am 2004-11-08 13:57:57.149780216 +0100 @@ -53,7 +53,7 @@ ## Byte-compile must be done at install time, since file times are ## encoded in the actual files. test -z "$$dlist" || \ - PYTHON=$(PYTHON) $(py_compile) --basedir "$(DESTDIR)$(%NDIR%dir)" $$dlist + PYTHON=$(PYTHON) $(py_compile) --basedir "$(DESTDIR)$(%NDIR%dir)" --destdir "$(DESTDIR)" $$dlist endif %?INSTALL% diff -aurN automake-1.9.3.orig/lib/py-compile automake-1.9.3/lib/py-compile --- automake-1.9.3.orig/lib/py-compile 2004-01-12 23:56:48.000000000 +0100 +++ automake-1.9.3/lib/py-compile 2004-11-08 14:00:18.155344112 +0100 @@ -35,16 +35,27 @@ basedir= -case "$1" in - --basedir) - basedir=$2 - if test -z "$basedir"; then - echo "$0: Missing argument to --basedir." 1>&2 - exit 1 - fi - shift 2 - ;; - -h|--h*) +loop=true +while test "x$loop" = "xtrue" +do + case "$1" in + --basedir) + basedir=$2 + if test -z "$basedir"; then + echo "$0: Missing argument to --basedir." 1>&2 + exit 1 + fi + shift 2 + ;; + --destdir) + destdir=$2 + if test -z "$destdir"; then + echo "$0: Missing argument to --destdir." 1>&2 + exit 1 + fi + shift 2 + ;; + -h|--h*) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] FILES..." @@ -53,13 +64,17 @@ Report bugs to . EOF - exit 0 - ;; - -v|--v*) - echo "py-compile $scriptversion" - exit 0 - ;; -esac + exit 0 + ;; + -v|--v*) + echo "py-compile $scriptversion" + exit 0 + ;; + *) + loop=false + ;; + esac +done if [ $# = 0 ]; then echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 @@ -69,9 +84,22 @@ # if basedir was given, then it should be prepended to filenames before # byte compilation. if [ -z "$basedir" ]; then - trans="path = file" + trans=" path = file" else - trans="path = os.path.join('$basedir', file)" + trans=" path = os.path.join('$basedir', file)" +fi + +# if destdir was given, then it should be stripped from path when storing +# the intended file name +if [ -z "$destdir" ]; then + transdfile=" dfile = path" +else + transdfile=" + if path.startswith('$destdir'): + dfile = path.split('$destdir')[1] + else: + dfile = path + " fi $PYTHON -c " @@ -80,12 +108,13 @@ files = '''$*''' print 'Byte-compiling python modules...' for file in string.split(files): - $trans +$trans +$transdfile if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): continue print file, sys.stdout.flush() - py_compile.compile(path) + py_compile.compile(path, dfile=dfile) print" || exit $? # this will fail for python < 1.5, but that doesn't matter ... @@ -95,12 +124,13 @@ files = '''$*''' print 'Byte-compiling python modules (optimized versions) ...' for file in string.split(files): - $trans +$trans +$transdfile if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): continue print file, sys.stdout.flush() - py_compile.compile(path) + py_compile.compile(path, dfile=dfile) print" 2>/dev/null || : # Local Variables: