[Oval-commits] r395 - trunk/oval-server

Pavel Vinogradov blaze-guest at alioth.debian.org
Sun May 24 18:36:11 UTC 2009


Author: blaze-guest
Date: 2009-05-24 18:36:10 +0000 (Sun, 24 May 2009)
New Revision: 395

Modified:
   trunk/oval-server/dsa2oval.py
Log:
Update code indentaion

Modified: trunk/oval-server/dsa2oval.py
===================================================================
--- trunk/oval-server/dsa2oval.py	2009-05-02 18:53:46 UTC (rev 394)
+++ trunk/oval-server/dsa2oval.py	2009-05-24 18:36:10 UTC (rev 395)
@@ -1,12 +1,14 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python
 # -*- coding: utf-8 -*-
 #
-# (c) 2007 Pavel Vinogradov
 # (c) 2004 Javier Fernandez-Sanguino
+# (c) 2007-2009 Pavel Vinogradov
+#
 # Licensed under the GNU General Public License version 2.
 #
 # Extract data from DSA files and create OVAL queries witch can 
 # be used with the OVAL query interpreter (see http://oval.mitre.org) 
+
 import os
 import sys
 import getopt
@@ -37,10 +39,10 @@
 		
 	def printDSA (self):
 		""" Generate and print OVAL Definitions for collected DSA information 
-    
-    	Use generator from dsa2oval package for convert all DSA stored in dict
-    	to proper formated XML file.
-    	"""
+		
+		Use generator from dsa2oval package for convert all DSA stored in dict
+		to proper formated XML file.
+		"""
 		ovalBuilder = generator.OVALGenerator()
 		
 #		print "Before: ovalBuilder.printOVALDefinitions (self.dsaref)"
@@ -58,13 +60,13 @@
 		For this files called dsa.parseFile() or wml.parseFile() (from parser package)
 		for extracting DSA information.
 		Results stored in global dict dsaref
-	
+		
 		@type directory: C(string)
 		@param directory: top of parsed filesystem hierarhy
 		@type depth: C(integer)
 		@param depth: maximum recursion depth
 		"""
-				
+		
 		if depth == 0:
 			logging.log(logging.DEBUG, "Maximum depth reached at directory " + directory)
 			return (0)
@@ -72,14 +74,14 @@
 		for file in os.listdir (directory):
 			
 			path = "%s/%s" % (directory, file)
-		
+			
 			logging.log (logging.DEBUG, "Checking %s (for %s at %s)" % (file, self.dataExt, depth))
-		
+			
 			if os.access(path, os.R_OK) and os.path.isdir (path) and not os.path.islink (path) and file[0] != '.':
 				logging.log(logging.DEBUG, "Entering directory " + path)
 				self.parseDir (path, depth-1)
-		
-        	#Parse DSA data files
+			
+			#Parse DSA data files
 			if os.access(path, os.R_OK) and file.endswith(self.dataExt) and file[0] != '.' and file[0] != '#':
 				result = dsa.parseFile (path)
 				if result:
@@ -88,8 +90,8 @@
 							self.dsaref[result[0]][k] = v
 					else:
 						self.dsaref[result[0]] = result[1]
-		
-        	#Parse DSA wml descriptions
+			
+			#Parse DSA wml descriptions
 			if os.access(path, os.R_OK) and file.endswith(self.infoExt) and file[0] != '.' and file[0] != '#':
 				result = wml.parseFile(path)
 				if result:
@@ -98,7 +100,7 @@
 							self.dsaref[result[0]][k] = v
 					else:
 						self.dsaref[result[0]] = result[1]
-
+		
 		return 0
 
 	def parseFile (self, filename):
@@ -111,11 +113,11 @@
 		@param filename: path to DSA file
 		@rtype: C(int)		
 		"""
-
+		
 		(path, ext) = os.path.splitext(filename)
 		dsaFile = ''.join((path, self.dataExt))
 		wmlFile = ''.join((path, self.infoExt))
-	
+		
 		#Parse data file
 		result = dsa.parseFile (dsaFile)
 		if result:
@@ -124,7 +126,7 @@
 					self.dsaref[result[0]][k] = v
 			else:
 				self.dsaref[result[0]] = result[1]
-
+			
 			#Parse according wml file
 			result = wml.parseFile(wmlFile)
 			if result:
@@ -144,7 +146,7 @@
 	@type prog: C(string)
 	@param prog: name of executable
 	"""
-
+	
 	print """
 usage: %s [vh] [-d <directory> | -f <path to file>]
 \t-d\twhich directory use for dsa definition search
@@ -179,13 +181,13 @@
 		logging.basicConfig(level=logging.ERROR)
 	
 	walker = Walker();
-
+	
 	if opts.has_key('-f'):
 		walker.parseFile (opts['-f'])
 		walker.printDSA()
 		sys.exit(0)
-
+	
 	if opts.has_key('-d'):
 		walker.parseDir(opts['-d'], 2)
 		walker.printDSA()
-		sys.exit(0)
\ No newline at end of file
+		sys.exit(0)




More information about the Oval-commits mailing list