[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/emerge/bin/Package
From:       Ralf Habacker <Ralf.Habacker () freenet ! de>
Date:       2009-08-07 15:58:01
Message-ID: 1249660681.443182.22663.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1008477 by habacker:

added high level 'run system command' method, which adds debug printing and exit code \
checking under user control

 M  +16 -1     PackageBase.py  


--- trunk/kdesupport/emerge/bin/Package/PackageBase.py #1008476:1008477
@@ -184,4 +184,19 @@
 
         if ( not ok ):
             utils.die( "command %s failed" % command )
-        return True
\ No newline at end of file
+        return True
+        
+    def system( self, command, errorMessage="" ):
+        """convencience function for running system commands. 
+        This method prints a debug message and then runs a system command. 
+        If the system command returns with errors the methos prints an error 
+        message and exits if @ref self.subinfo.options.exitOnErrors  is true"""
+        
+        utils.debug( command,1 )
+        if utils.system( command ) == 0:
+            return True
+        if self.subinfo.options.exitOnErrors:
+            utils.die( "while running %s cmd: %s" % (errorMessage , command) )
+        else:
+            utils.error( "while running %s cmd: %s" % (errorMessage , command) )
+        return False


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic