Skip to contentSkip to conversation

Remove tabs from xensec_gen/main.py

PATCH Applied Masaki Kanno 2 participants 2 messages Mar 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove tabs from xensec_gen/main.py

Hi,

This patch replaces tab with 4 whitespaces in xensec_gen/main.py.

Best regards,
Kan

tools/security/python/xensec_gen/main.py +113 -113
diff -r 6f2f72f39872 tools/security/python/xensec_gen/main.py
@@ -39,147 +39,147 @@ gGroup    = 'nobody'
 gGroup    = 'nobody'
 
 def usage( ):
-	print >>sys.stderr, 'Usage:  ' + sys.argv[0] + ' [OPTIONS]'
-	print >>sys.stderr, '  OPTIONS:'
-	print >>sys.stderr, '  -p, --httpport'
-	print >>sys.stderr, '     The port on which the http server is to listen'
-	print >>sys.stderr, '     (default: ' + str( gHttpPort ) + ')'
-	print >>sys.stderr, '  -d, --httpdir'
-	print >>sys.stderr, '     The directory where the http server is to serve pages from'
-	print >>sys.stderr, '     (default: ' + gHttpDir + ')'
-	print >>sys.stderr, '  -l, --logfile'
-	print >>sys.stderr, '     The file in which to log messages generated by this command'
-	print >>sys.stderr, '     (default: ' + gLogFile + ')'
-	print >>sys.stderr, '  -u, --user'
-	print >>sys.stderr, '     The user under which this command is to run.  This parameter'
-	print >>sys.stderr, '     is only used when invoked under the "root" user'
-	print >>sys.stderr, '     (default: ' + gUser + ')'
-	print >>sys.stderr, '  -g, --group'
-	print >>sys.stderr, '     The group under which this command is to run.  This parameter'
-	print >>sys.stderr, '     is only used when invoked under the "root" user'
-	print >>sys.stderr, '     (default: ' + gGroup + ')'
-	print >>sys.stderr, '  -f'
-	print >>sys.stderr, '     Run the command in the foreground.  The logfile option will be'
-	print >>sys.stderr, '     ignored and all output will be directed to stdout and stderr.'
-	print >>sys.stderr, '  -h, --help'
-	print >>sys.stderr, '     Display the command usage information'
+    print >>sys.stderr, 'Usage:  ' + sys.argv[0] + ' [OPTIONS]'
+    print >>sys.stderr, '  OPTIONS:'
+    print >>sys.stderr, '  -p, --httpport'
+    print >>sys.stderr, '     The port on which the http server is to listen'
+    print >>sys.stderr, '     (default: ' + str( gHttpPort ) + ')'
+    print >>sys.stderr, '  -d, --httpdir'
+    print >>sys.stderr, '     The directory where the http server is to serve pages from'
+    print >>sys.stderr, '     (default: ' + gHttpDir + ')'
+    print >>sys.stderr, '  -l, --logfile'
+    print >>sys.stderr, '     The file in which to log messages generated by this command'
+    print >>sys.stderr, '     (default: ' + gLogFile + ')'
+    print >>sys.stderr, '  -u, --user'
+    print >>sys.stderr, '     The user under which this command is to run.  This parameter'
+    print >>sys.stderr, '     is only used when invoked under the "root" user'
+    print >>sys.stderr, '     (default: ' + gUser + ')'
+    print >>sys.stderr, '  -g, --group'
+    print >>sys.stderr, '     The group under which this command is to run.  This parameter'
+    print >>sys.stderr, '     is only used when invoked under the "root" user'
+    print >>sys.stderr, '     (default: ' + gGroup + ')'
+    print >>sys.stderr, '  -f'
+    print >>sys.stderr, '     Run the command in the foreground.  The logfile option will be'
+    print >>sys.stderr, '     ignored and all output will be directed to stdout and stderr.'
+    print >>sys.stderr, '  -h, --help'
+    print >>sys.stderr, '     Display the command usage information'
 
 def runServer( aServerPort,
                aServerClass  = BaseHTTPServer.HTTPServer,
                aHandlerClass = CGIHTTPServer.CGIHTTPRequestHandler ):
-	serverAddress = ( '', aServerPort )
-	httpd = aServerClass( serverAddress, aHandlerClass )
-	httpd.serve_forever( )
+    serverAddress = ( '', aServerPort )
+    httpd = aServerClass( serverAddress, aHandlerClass )
+    httpd.serve_forever( )
 
 def daemonize( aHttpDir, aLogFile, aUser, aGroup, aFork = 'true' ):
-	# Do some pre-daemon activities
-	os.umask( 027 )
-	if os.getuid( ) == 0:
-		# If we are running as root, we will change that
-		uid = pwd.getpwnam( aUser )[2]
-		gid = grp.getgrnam( aGroup )[2]
+    # Do some pre-daemon activities
+    os.umask( 027 )
+    if os.getuid( ) == 0:
+        # If we are running as root, we will change that
+        uid = pwd.getpwnam( aUser )[2]
+        gid = grp.getgrnam( aGroup )[2]
 
-		if aFork == 'true':
-			# Change the owner of the log file to the user/group
-			#   under which the daemon is to run
-			flog = open( aLogFile, 'a' )
-			flog.close( )
-			os.chown( aLogFile, uid, gid )
+        if aFork == 'true':
+            # Change the owner of the log file to the user/group
+            #   under which the daemon is to run
+            flog = open( aLogFile, 'a' )
+            flog.close( )
+            os.chown( aLogFile, uid, gid )
 
-		# Change the uid/gid of the process
-		os.setgid( gid )
-		os.setuid( uid )
+        # Change the uid/gid of the process
+        os.setgid( gid )
+        os.setuid( uid )
 
-	# Change to the HTTP directory
-	os.chdir( aHttpDir )
+    # Change to the HTTP directory
+    os.chdir( aHttpDir )
 
-	if aFork == 'true':
-		# Do first fork
-		try:
-			pid = os.fork( )
-			if pid:
-				# Parent process
-				return pid
+    if aFork == 'true':
+        # Do first fork
+        try:
+            pid = os.fork( )
+            if pid:
+            # Parent process
+                return pid
 
-		except OSError, e:
-			raise Exception, e
+        except OSError, e:
+            raise Exception, e
 
-		# First child process, create a new session
-		os.setsid( )
+        # First child process, create a new session
+        os.setsid( )
 
-		# Do second fork
-		try:
-			pid = os.fork( )
-			if pid:
-				# Parent process
-				os._exit( 0 )
+        # Do second fork
+        try:
+            pid = os.fork( )
+            if pid:
+                # Parent process
+                os._exit( 0 )
 
-		except OSError, e:
-			raise Exception, e
+        except OSError, e:
+            raise Exception, e
 
-		# Reset stdin/stdout/stderr
-		fin  = open( '/dev/null',  'r' )
-		flog = open( aLogFile, 'a' )
-		os.dup2( fin.fileno( ),  sys.stdin.fileno( ) )
-		os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
-		os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
+        # Reset stdin/stdout/stderr
+        fin  = open( '/dev/null',  'r' )
+        flog = open( aLogFile, 'a' )
+        os.dup2( fin.fileno( ),  sys.stdin.fileno( ) )
+        os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
+        os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
 
 def main( ):
-	httpPort = gHttpPort
-	httpDir  = gHttpDir
-	logFile  = gLogFile
-	user     = gUser
-	group    = gGroup
-	doFork   = 'true'
+    httpPort = gHttpPort
+    httpDir  = gHttpDir
+    logFile  = gLogFile
+    user     = gUser
+    group    = gGroup
+    doFork   = 'true'
 
-	shortOpts = 'd:p:l:u:g:fh'
-	longOpts  = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=', 'help' ]
-	try:
-		opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
+    shortOpts = 'd:p:l:u:g:fh'
+    longOpts  = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=', 'help' ]
+    try:
+        opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
 
-	except getopt.GetoptError, e:
-		print >>sys.stderr, e
-		usage( )
-		sys.exit( )
+    except getopt.GetoptError, e:
+        print >>sys.stderr, e
+        usage( )
+        sys.exit( )
 
-	if len( args ) != 0:
-		print >>sys.stderr, 'Error: command arguments are not supported'
-		usage( )
-		sys.exit( )
+    if len( args ) != 0:
+        print >>sys.stderr, 'Error: command arguments are not supported'
+        usage( )
+        sys.exit( )
 
-	for opt, opt_value in opts:
-		if opt in ( '-h', '--help' ):
-			usage( )
-			sys.exit( )
+    for opt, opt_value in opts:
+        if opt in ( '-h', '--help' ):
+            usage( )
+            sys.exit( )
 
-		if opt in ( '-d', '--httpdir' ):
-			httpDir = opt_value
+        if opt in ( '-d', '--httpdir' ):
+            httpDir = opt_value
 
-		if opt in ( '-p', '--httpport' ):
-			try:
-				httpPort = int( opt_value )
-			except:
-				print >>sys.stderr, 'Error: HTTP port is not valid'
-				usage( )
-				sys.exit( )
+        if opt in ( '-p', '--httpport' ):
+            try:
+                httpPort = int( opt_value )
+            except:
+                print >>sys.stderr, 'Error: HTTP port is not valid'
+                usage( )
+                sys.exit( )
 
-		if opt in ( '-l', '--logfile' ):
-			logFile = opt_value
+        if opt in ( '-l', '--logfile' ):
+            logFile = opt_value
 
-		if opt in ( '-u', '--user' ):
-			user = opt_value
+        if opt in ( '-u', '--user' ):
+            user = opt_value
 
-		if opt in ( '-g', '--group' ):
-			group = opt_value
+        if opt in ( '-g', '--group' ):
+            group = opt_value
 
-		if opt in ( '-f' ):
-			doFork = 'false'
+        if opt in ( '-f' ):
+            doFork = 'false'
 
-	pid = daemonize( httpDir, logFile, user, group, doFork )
-	if pid > 0:
-		sys.exit( )
+    pid = daemonize( httpDir, logFile, user, group, doFork )
+    if pid > 0:
+        sys.exit( )
 
-	runServer( httpPort )
+    runServer( httpPort )
 
 if __name__ == '__main__':
-	main( )
+    main( )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw

On Mon, Mar 26, 2007 at 04:20:31PM +0900, Masaki Kanno wrote:

Content-Description: Mail message body

Quoted 5 lines

Hi,

This patch replaces tab with 4 whitespaces in xensec_gen/main.py.

Applied, thank you.

Ewan.