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

bonivart at users.sourceforge.net bonivart at users.sourceforge.net
Thu May 28 09:29:42 CEST 2009


Revision: 5080
          http://gar.svn.sourceforge.net/gar/?rev=5080&view=rev
Author:   bonivart
Date:     2009-05-28 07:29:42 +0000 (Thu, 28 May 2009)

Log Message:
-----------
cswclassutils: added cswpycompile

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/Makefile
    csw/mgar/pkg/cswclassutils/trunk/checksums
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype

Added Paths:
-----------
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswpycompile

Property Changed:
----------------
    csw/mgar/pkg/cswclassutils/trunk/


Property changes on: csw/mgar/pkg/cswclassutils/trunk
___________________________________________________________________
Modified: svn:externals
   - gar https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/v1

   + gar https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/v2


Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-27 21:50:22 UTC (rev 5079)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-28 07:29:42 UTC (rev 5080)
@@ -1,5 +1,5 @@
 GARNAME = cswclassutils
-GARVERSION = 1.9
+GARVERSION = 1.10
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities
@@ -17,7 +17,7 @@
 WORKSRC = $(WORKDIR)
 SPKG_SOURCEURL = http://www.opencsw.org
 
-CASLIST = cswcpsampleconf cswpreserveconf cswinitsmf cswusergroup
+CASLIST = cswcpsampleconf cswpreserveconf cswinitsmf cswusergroup cswpycompile
 
 install-custom:
 	@echo " ==> Installing $(GARNAME) (custom)"

Modified: csw/mgar/pkg/cswclassutils/trunk/checksums
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/checksums	2009-05-27 21:50:22 UTC (rev 5079)
+++ csw/mgar/pkg/cswclassutils/trunk/checksums	2009-05-28 07:29:42 UTC (rev 5080)
@@ -1,2 +1,2 @@
 38e0bf6e204e003254ed246df2b4e1f9  download/CSWcswclassutils.gspec
-2779acb0e9549f5e3de16759f59d2e53  download/CSWcswclassutils.prototype
+854d77b21b177b15fd2aac39339a0c8c  download/CSWcswclassutils.prototype

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW	2009-05-27 21:50:22 UTC (rev 5079)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW	2009-05-28 07:29:42 UTC (rev 5080)
@@ -35,6 +35,14 @@
   users, groups, gcos, home directory and shell. You can also decide if you want
   the home directories to be created and/or removed during install/remove.
 
+- cswpycompile
+
+  This class takes care of creating/removing python's normal and optimized
+  bytecode files.  Set all *.py files' class = pycompile to activate.
+  Example:
+  # use prototype filters to set the class
+  PROTOTYPE_FILTER = awk '$$$$3 ~/.*\.py$$$$/ { $$$$2 = "pycompile" } { print }'
+
 Read more on the wiki: http://wiki.opencsw.org/cswclassutils-package.
 
 -- 

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswpycompile	2009-05-28 07:29:42 UTC (rev 5080)
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# i.pycompile - Class action script for compiling pyo and pyc files
+#
+# $Id: i.pycompile 5069 2009-05-27 17:36:24Z valholla $
+#
+# Written by Mike Watters
+#
+# 2009-05-25 First Release
+#
+
+# Force Path for the script to use
+PATH=/usr/bin:/usr/sbin:/opt/csw/bin
+
+PY_PREFIX=${PKG_INSTALL_ROOT}/opt/csw
+PY_BINDIR=${PY_PREFIX}/bin
+PY_LIBDIR=${PY_PREFIX}/lib/python
+
+#DEBUG = 1  # Uncomment to enable debug
+if [ "${DEBUG}" ]; then
+    echo PACKAGE: $PKGINST
+fi
+
+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}
+
+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}
+ 
+exit 0

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype	2009-05-27 21:50:22 UTC (rev 5079)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype	2009-05-28 07:29:42 UTC (rev 5080)
@@ -15,6 +15,8 @@
 f none /usr/sadm/install/scripts/r.cswcpsampleconf 0555 root sys
 f none /usr/sadm/install/scripts/i.cswpreserveconf 0555 root sys
 f none /usr/sadm/install/scripts/r.cswpreserveconf 0555 root sys
+f none /usr/sadm/install/scripts/i.cswpycompile 0555 root sys
+f none /usr/sadm/install/scripts/r.cswpycompile 0555 root sys
 d none /opt/csw/share 0755 root bin
 d none /opt/csw/share/doc 0755 root bin
 d none /opt/csw/share/doc/cswclassutils 0755 root bin

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswpycompile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswpycompile	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswpycompile	2009-05-28 07:29:42 UTC (rev 5080)
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# r.pycompile - Class action script for removing pyo and pyc files
+#
+# $Id: r.pycompile 5019 2009-05-23 04:00:12Z valholla $
+#
+# Written by Mike Watters
+#
+#   2009-05-25 First Release
+#
+
+# Force Path for the script to use
+PATH=/usr/bin:/usr/sbin:/opt/csw/bin
+DEBUG=      # clear to disable debug, set to anything to enable
+
+if [ "${DEBUG}" ]; then
+    echo PACKAGE: $PKGINST
+fi
+
+echo "Removing pyo and pyc files for package <$PKGINST> ..."
+pkgchk -v $PKGINST 2>&1 |grep \.py$ | xargs -i rm -f {}c {}o
+
+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