[csw-devel] SF.net SVN: gar:[6868] csw/mgar/pkg/cswclassutils/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Thu Oct 15 00:42:38 CEST 2009


Revision: 6868
          http://gar.svn.sourceforge.net/gar/?rev=6868&view=rev
Author:   bdwalton
Date:     2009-10-14 22:42:38 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
cswclassutils: rework python compilation so only package specific files are compiled

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/Makefile
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-10-14 20:29:08 UTC (rev 6867)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-10-14 22:42:38 UTC (rev 6868)
@@ -1,5 +1,5 @@
 GARNAME = cswclassutils
-GARVERSION = 1.22
+GARVERSION = 1.23
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile	2009-10-14 20:29:08 UTC (rev 6867)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile	2009-10-14 22:42:38 UTC (rev 6868)
@@ -7,6 +7,7 @@
 # Written by Mike Watters
 #
 # 2009-05-25 First Release
+# 2009-10-14 Update to only compile package specific files (Ben Walton)
 #
 
 # Force Path for the script to use
@@ -20,34 +21,51 @@
 if [ "${DEBUG}" ]; then
     echo PACKAGE: $PKGINST
 fi
+
+TMPPY=/tmp/pycomp.$$.`date +%Y%m%d%H%M%S`.py
+
+cat <<EOF > $TMPPY
+import py_compile
+
+pyfiles = [
+EOF
+
+echo "Installing class <cswpycompile> ..."
+
 while read src dest; do
     if [ "$DEBUG" ]; then
         echo SRC: $src DEST: $dest
     fi
 
     /usr/bin/cp -p $src $dest || exit 2
+    echo $dest
+
+    echo "	\"$dest\"," >> $TMPPY
 done
 
+cat <<EOF >> $TMPPY
+	]
+
+for f in pyfiles:
+	try:
+		py_compile.compile(f, doraise=True)
+	except PyCompileError:
+		print "Error compiling: %s" % f
+
+EOF
+
 if [ ! -f ${PY_BINDIR}/python -a ! -x ${PY_BINDIR}/python ]; then
     echo "Could not find or execute ${PY_BINDIR}/python"
     echo "Check your Python installation."
     exit 2
 fi
     
-if [ ! -f ${PY_LIBDIR}/compileall.py ]; then
-    echo "Could not find ${PY_LIBDIR}/compileall.py"
-    echo "Check your Python installation."
-    exit 2
-fi
-
 echo "Compiling py files to normal bytecode ..."
-# Compile .py libraries to .pyc files
-${PY_BINDIR}/python -Wi -tt ${PY_LIBDIR}/compileall.py \
-    -d ${PY_LIBDIR} -x 'bad_coding|badsyntax' ${PY_LIBDIR}
+${PY_BINDIR}/python -Wi -tt $TMPPY
 
 echo "Compiling py files to optimized bytecode ..."
-# Compile .py libraries to .pyo files
-${PY_BINDIR}/python -Wi -tt -O ${PY_LIBDIR}/compileall.py \
-    -d ${PY_LIBDIR} -x 'bad_coding|badsyntax' ${PY_LIBDIR}
- 
+${PY_BINDIR}/python -Wi -tt -O $TMPPY
+
+rm $TMPPY
+
 exit 0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list