[Fusionforge-commits] r14252 - in trunk: . src src/utils

Roland Mas lolando at fusionforge.org
Fri Aug 26 14:35:52 CEST 2011


Author: lolando
Date: 2011-08-26 14:35:52 +0200 (Fri, 26 Aug 2011)
New Revision: 14252

Modified:
   trunk/
   trunk/src/fusionforge.spec
   trunk/src/utils/list-enabled-plugins.sh
Log:
Use Python rather than awk/sed to parse *.ini files

Modified: trunk/src/fusionforge.spec
===================================================================
--- trunk/src/fusionforge.spec	2011-08-26 12:17:20 UTC (rev 14251)
+++ trunk/src/fusionforge.spec	2011-08-26 12:35:52 UTC (rev 14252)
@@ -63,6 +63,8 @@
  
 # BuildRequires: sed, perl
 
+BuildRequires: python
+
 Provides: gforge = %{version}
 
 %description

Modified: trunk/src/utils/list-enabled-plugins.sh
===================================================================
--- trunk/src/utils/list-enabled-plugins.sh	2011-08-26 12:17:20 UTC (rev 14251)
+++ trunk/src/utils/list-enabled-plugins.sh	2011-08-26 12:35:52 UTC (rev 14252)
@@ -23,10 +23,16 @@
 	if [ ! -e $dir/etc/$plugin.ini ] ; then
 	    enabled="$enabled $plugin"
 	else
-	    if [ -x /usr/bin/confget ] ; then
+	    if [ -x /usr/aubin/confget ] ; then
 		status=$(confget -f $dir/etc/$plugin.ini plugin_status | sed -r 's/[ \t]*;.*//g')
 	    else
-		status=$(awk -d= '/^[ \t]*plugin_status[ \t]*=/ { print $2 }' $dir/etc/$plugin.ini | sed -r 's/[ ^t]*;.*//g')
+		status=$(python 2>/dev/null <<EOF
+import ConfigParser
+config = ConfigParser.ConfigParser()
+config.read("plugins/$plugin/etc/$plugin.ini")
+print config.get("$plugin","plugin_status").strip()
+EOF
+) || status=error		
 	    fi
 	    # confget returns litteral semi-colons after values, so get rid of comments
 	    if [ "$status" = "valid" ] ; then




More information about the Fusionforge-commits mailing list