#! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-2013 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
# Test the '--destdir' option of the 'py-compile' script,
required=python
-. ./defs || Exit 1
+. test-init.sh
cp "$am_scriptdir/py-compile" . \
|| fatal_ "failed to fetch auxiliary script py-compile"
echo 'def bar (): return "bar"' > $destdir/sub/bar.py
./py-compile --destdir $destdir foo.py sub/bar.py
-ls -l $destdir $destdir/sub # For debugging.
-ls . sub | grep '\.py[co]$' && Exit 1
-test -f $destdir/foo.pyc
-test -f $destdir/foo.pyo
-test -f $destdir/sub/bar.pyc
-test -f $destdir/sub/bar.pyo
-strings $destdir/*.py[co] $destdir/sub/*.py[co] || : # For debugging.
-$FGREP $destdir $destdir/*.py[co] $destdir/sub/*.py[co] && Exit 1
+
+find $destdir # For debugging.
+st=0
+for x in c o; do
+ for b in foo sub/bar; do
+ f=$(pyc_location -p "$destdir/$b.py$x")
+ test -f "$f"
+ strings "$f" || : # For debugging.
+ $FGREP $destdir $f && { echo BAD: $f; st=1; }
+ done
+done
+exit $st
: