chiark / gitweb /
make-secnet-sites: Put parens around print() statements
[secnet.git] / make-secnet-sites
index 5162b54e18b8dee1cb0a6421e9d2c68c112ec219..d6f9ee0aa621f359614b04b12ef376ed6fb9765c 100755 (executable)
@@ -51,6 +51,8 @@ Cendio Systems AB.
 
 """
 
+from __future__ import print_function
+
 import string
 import time
 import sys
@@ -77,7 +79,7 @@ if len(sys.argv)<2:
 else:
        if sys.argv[1]=='-u':
                if len(sys.argv)!=6:
-                       print "Wrong number of arguments"
+                       print("Wrong number of arguments")
                        sys.exit(1)
                service=1
                header=sys.argv[2]
@@ -85,26 +87,26 @@ else:
                sitesfile=sys.argv[4]
                group=sys.argv[5]
                if not os.environ.has_key("USERV_USER"):
-                       print "Environment variable USERV_USER not found"
+                       print("Environment variable USERV_USER not found")
                        sys.exit(1)
                user=os.environ["USERV_USER"]
                # Check that group is in USERV_GROUP
                if not os.environ.has_key("USERV_GROUP"):
-                       print "Environment variable USERV_GROUP not found"
+                       print("Environment variable USERV_GROUP not found")
                        sys.exit(1)
                ugs=os.environ["USERV_GROUP"]
                ok=0
                for i in string.split(ugs):
                        if group==i: ok=1
                if not ok:
-                       print "caller not in group %s"%group
+                       print("caller not in group %s"%group)
                        sys.exit(1)
        else:
                if sys.argv[1]=='-P':
                        prefix=sys.argv[2]
                        sys.argv[1:3]=[]
                if len(sys.argv)>3:
-                       print "Too many arguments"
+                       print("Too many arguments")
                        sys.exit(1)
                inputfile=sys.argv[1]
                of=sys.stdout
@@ -371,12 +373,12 @@ reserved.update(levels)
 def complain(msg):
        "Complain about a particular input line"
        global complaints
-       print ("%s line %d: "%(file,line))+msg
+       print(("%s line %d: "%(file,line))+msg)
        complaints=complaints+1
 def moan(msg):
        "Complain about something in general"
        global complaints
-       print msg;
+       print(msg);
        complaints=complaints+1
 
 root=level(['root','root'])   # All vpns are children of this node
@@ -560,8 +562,8 @@ delempty(root)
 checkconstraints(root,{},ipaddrset.complete_set())
 
 if complaints>0:
-       if complaints==1: print "There was 1 problem."
-       else: print "There were %d problems."%(complaints)
+       if complaints==1: print("There was 1 problem.")
+       else: print("There were %d problems."%(complaints))
        sys.exit(1)
 
 if service: