File Fix-code-to-be-python3-compliant.patch of Package adios

From: Egbert Eich <eich@suse.com>
Date: Tue Feb 16 17:12:05 2021 +0100
Subject: Fix code to be python3 compliant.
Patch-mainline: Not yet
Git-commit: 9379de3b97c245b238f1b0290cdd435b78bb4c68
References: 

Signed-off-by: Egbert Eich <eich@suse.com>
---
 utils/skel/bin/skel              |  8 ++++----
 utils/skel/bin/skel_extract.py   |  8 ++++----
 utils/skel/lib/adios.py          |  8 ++++----
 utils/skel/lib/skel_bpls.py      |  4 ++--
 utils/skel/lib/skel_bpy.py       | 26 +++++++++++++-------------
 utils/skel/lib/skel_makefile.py  | 12 ++++++------
 utils/skel/lib/skel_params.py    | 10 +++++-----
 utils/skel/lib/skel_replay.py    | 10 +++++-----
 utils/skel/lib/skel_settings.py  |  6 +++---
 utils/skel/lib/skel_source.py    | 16 ++++++++--------
 utils/skel/lib/skel_submit.py    | 10 +++++-----
 utils/skel/lib/skel_suite.py     |  4 ++--
 utils/skel/lib/skel_test_plan.py |  2 +-
 utils/skel/lib/skel_xml.py       |  6 +++---
 utils/skel/lib/skelconf.py       |  2 +-
 15 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/utils/skel/bin/skel b/utils/skel/bin/skel
index 9e37214..f74c73c 100755
--- a/utils/skel/bin/skel
+++ b/utils/skel/bin/skel
@@ -58,7 +58,7 @@ def main(argv=None):
 
     # Look for skel help (or no args), and print the list of subcommands...
     if (len(sys.argv) == 1) or (sys.argv[1] == 'help' and len(sys.argv) == 2):
-        print parser.description 
+        print (parser.description)
         return 0
 
     # install does not require a project, so let's just check for it directly
@@ -83,8 +83,8 @@ def main(argv=None):
         elif sys.argv[2] == 'xml':
             sys.argv = ["skel", "xml", "junk", "-h"]
         else:
-            print "Unknown help topic" 
-            print parser.description 
+            print ("Unknown help topic")
+            print (parser.description)
             exit(1)
 
     #args = parse_command_line()
@@ -154,7 +154,7 @@ def main(argv=None):
         return 0
 
     # Unrecognized subcommand, print the help message
-    print parser.description
+    print (parser.description)
     return 0
 
 
diff --git a/utils/skel/bin/skel_extract.py b/utils/skel/bin/skel_extract.py
index 54bfaf5..8a7c755 100755
--- a/utils/skel/bin/skel_extract.py
+++ b/utils/skel/bin/skel_extract.py
@@ -46,7 +46,7 @@ def extract (skel_output, dest, select, ranks):
     # check the selected fields
     for field in selected_fields:
         if not field in keys:
-            print 'Invalid selection, field ' + field
+            print ('Invalid selection, field ' + field)
             return
 
     #Print the header
@@ -112,7 +112,7 @@ def extract_R (skel_output, select, ranks, iteration):
     # check the selected fields
     for field in selected_fields:
         if not field in keys:
-            print 'Invalid selection, field ' + field
+            print ('Invalid selection, field ' + field)
             return
 
     #Print the header
@@ -153,13 +153,13 @@ def extract_R (skel_output, select, ranks, iteration):
 def parse_iteration (filename):
     #assume filename ends with .xml
     if not filename.endswith (".xml"):
-        print "Warning: filename does not meet expectations, should end with .xml"
+        print ("Warning: filename does not meet expectations, should end with .xml")
 
     filename = filename [:-4]
 
     iteration = filename.rsplit ("_", 1)[1]
 
-    print iteration
+    print (iteration)
 
     return iteration
 
diff --git a/utils/skel/lib/adios.py b/utils/skel/lib/adios.py
index 0aed80d..da39623 100644
--- a/utils/skel/lib/adios.py
+++ b/utils/skel/lib/adios.py
@@ -12,7 +12,7 @@ class adiosConfig:
         doc = xml.dom.minidom.parse (config_file_name)
         nodes = doc.childNodes
         if (nodes.length != 1):
-            print 'malformed adios config file, should contain only a single adios-config element'
+            print ('malformed adios config file, should contain only a single adios-config element')
             raise SystemExit
         self.config_node = nodes[0]
 
@@ -47,7 +47,7 @@ class adiosConfig:
 
     def get_buffer (self):
         #return the buffer info
-        print 'implement get_buffer'
+        print ('implement get_buffer')
 
     def get_host_language (self):
         return self.host_language
@@ -200,7 +200,7 @@ class fortranFormatter:
     @staticmethod
     def get_write_line (var):
         retval = '\n  call adios_write (adios_handle, "' + var.get_fullpath() + '", ' + var.get_gwrite() + ', adios_error)'  
-        #print retval
+        #print (retval)
         return retval
 
     @staticmethod
@@ -281,7 +281,7 @@ class cFormatter:
             var_prefix = '&'
 
         retval = '\nadios_write (adios_handle, "' + var.get_fullpath() + '", ' + var_prefix + var.get_gwrite() + ');'  
-        #print retval
+        #print (retval)
         return retval
 
     @staticmethod
diff --git a/utils/skel/lib/skel_bpls.py b/utils/skel/lib/skel_bpls.py
index 3b67f88..299881a 100755
--- a/utils/skel/lib/skel_bpls.py
+++ b/utils/skel/lib/skel_bpls.py
@@ -55,7 +55,7 @@ class bpls:
 
 
     def get_dims (self, var):
-        print "getting dims for %s" % var
+        print ("getting dims for %s" % var)
         if var not in self.vars.keys():
             return None
         return self.vars[var]['dims']
@@ -73,7 +73,7 @@ def main(argv=None):
     b = bpls (test)
 
     for var in b.get_vars():
-        print '%s    %s' % (var, b.get_dims (var) ) 
+        print ('%s    %s' % (var, b.get_dims (var) ))
         
 
 if __name__ == "__main__":
diff --git a/utils/skel/lib/skel_bpy.py b/utils/skel/lib/skel_bpy.py
index b1a520c..be7c186 100755
--- a/utils/skel/lib/skel_bpy.py
+++ b/utils/skel/lib/skel_bpy.py
@@ -11,7 +11,7 @@ class skel_bpy:
         stream = file (filename, 'r')
         self.doc = yaml.load(stream)
 
-        #print self.doc
+        #print (self.doc)
 
         if self.get_language().lower() == "fortran":
             flip = True
@@ -22,7 +22,7 @@ class skel_bpy:
         for v in self.doc['variables']:
             name = v ['name']
             self.vars [name] = var (name, v, flip)
-            #print "Added variable %s\n" % name
+            #print ("Added variable %s\n" % name)
 
     def get_num_procs (self):
         return self.doc['procs']
@@ -74,7 +74,7 @@ class var:
 
         if self.is_scalar():
             # This is a scalar
-            #print "%s is a scalar" % name
+            #print ("%s is a scalar" % name)
             return
 
         # If we're writing fortran, we need to flip the order of the dimensions, as they were reported by the C API
@@ -108,12 +108,12 @@ class var:
 
             # Sanity check
             if len(dp) != len(gd):
-                print 'Dimensional mismatch, exiting'
+                print ('Dimensional mismatch, exiting')
                 exit(13)
             for i in range(len(dp)):
                 #divides evenly
                 if gd[i] % dp[i] != 0:
-                    print 'irregular decomposition not supported, exiting'
+                    print ('irregular decomposition not supported, exiting')
                     exit(17)
 
             # Calculate individual blocks
@@ -150,13 +150,13 @@ class var:
                                     end2 = (k+1) * self.vardict['dims'][2] - 1
                                     self.vardict['decomposition'].append([[start0,end0],[start1,end1],[start2,end2]])
                                 else:
-                                    print "Failed sanity check, more than 3 dimensions specified"
+                                    print ("Failed sanity check, more than 3 dimensions specified")
                                     exit (13) 
                         
         # Case 3, no decomposition given
         else:
             #What to do here? PANIC!
-            print "No decomposition found, exiting."
+            print ("No decomposition found, exiting.")
             exit(11)
 
 
@@ -171,7 +171,7 @@ class var:
         return self.vardict['type']
 
     def get_lang_type (self, lang):
-        #print "getting type for lang"
+        #print ("getting type for lang")
         if lang == 'C' or lang == 'c':
             return self.get_c_type()
         else:
@@ -316,7 +316,7 @@ class var:
     # This gives the size of one element of this type
     def get_unit_size (self):
 
-        #print "Checking size of %s\n" % self.get_type()
+        #print ("Checking size of %s\n" % self.get_type())
 
         type = self.get_type()
 
@@ -358,7 +358,7 @@ class var:
         if size is not None:
             return "%i" % size
         else:
-            print "Unknown type: %s in get_unit_size()" % self.get_type()
+            print ("Unknown type: %s in get_unit_size()" % self.get_type())
             sys.exit()
 
 
@@ -435,14 +435,14 @@ class var:
 
 def main(argv=None):
     b = skel_bpy ("test.yaml")
-    print "Num Procs is %d\n" % b.get_num_procs()
+    print ("Num Procs is %d\n" % b.get_num_procs())
 
     vardict = b.get_vars()
-    print vardict
+    print (vardict)
 
     for vname in vardict:
         v = vardict [vname]
-        print "%s: %s, %s\n" % (v.get_name(), v.get_type(), v.get_dims() )
+        print ("%s: %s, %s\n" % (v.get_name(), v.get_type(), v.get_dims() ))
 
 
 if __name__ == "__main__":
diff --git a/utils/skel/lib/skel_makefile.py b/utils/skel/lib/skel_makefile.py
index 3085d98..8283f4c 100644
--- a/utils/skel/lib/skel_makefile.py
+++ b/utils/skel/lib/skel_makefile.py
@@ -38,7 +38,7 @@ def generate_makefiles_with_args (parent_parser):
     try:
         config = adios.adiosConfig (args.project + '_skel.xml')
     except (IOError):
-        print "XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
+        print ("XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")
         return 1
 
 
@@ -49,8 +49,8 @@ def generate_makefiles_with_args (parent_parser):
         try:
             params = skelconf.skelConfig (args.project + '_params.xml')
         except (IOError):
-            print "Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,"
-            print "then check that " + args.project + "_params.xml exists."
+            print ("Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,")
+            print ("then check that " + args.project + "_params.xml exists.")
             return
 
         generate_makefiles (params, config)
@@ -65,7 +65,7 @@ def generate_makefile_from_yaml (args):
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     skel_file = open (outfilename, 'w')
@@ -201,10 +201,10 @@ def main(argv=None):
 
     lang = config.get_host_language ()
     if 'c' == lang or 'C' == lang:
-        print 'generating C flavored Makefile'
+        print ('generating C flavored Makefile')
         generate_makefiles_c (params)
     else:
-        print 'generating fortran flavored Makefile'
+        print ('generating fortran flavored Makefile')
         generate_makefiles_fortran (params)
 
 
diff --git a/utils/skel/lib/skel_params.py b/utils/skel/lib/skel_params.py
index 08ac257..ad7754b 100644
--- a/utils/skel/lib/skel_params.py
+++ b/utils/skel/lib/skel_params.py
@@ -35,7 +35,7 @@ def generate_param_file_with_args (parent_parser):
     try:
         config = adios.adiosConfig (args.project + '_skel.xml')
     except (IOError):
-        print "XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
+        print ("XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")
         return 1
 
  
@@ -43,13 +43,13 @@ def generate_param_file_with_args (parent_parser):
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     try:
         config = adios.adiosConfig (args.project + '_skel.xml')
     except (IOError):
-        print "Error reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
+        print ("Error reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")
         return 1
 
     generate_param_file (args.project, outfilename, config, args.group, args.bpls)
@@ -60,7 +60,7 @@ def generate_param_file (app, outfile, config, groupname, bplsfile=None):
     param_file = open (outfile, 'w')
 
     if bplsfile is not None:
-        print "Using bpls data in %s" % bplsfile
+        print ("Using bpls data in %s" % bplsfile)
         bpdata = skel_bpls.bpls (open (bplsfile, 'r') )
 
     #Write the file header
@@ -164,7 +164,7 @@ def main(argv=None):
 
     # Only proceed if outfilename does not already exist.
     if os.path.exists (outfilename):
-        print "%s exists, aborting. Delete the file or use '-f' to overwrite."
+        print ("%s exists, aborting. Delete the file or use '-f' to overwrite.")
         return 999
 
     generate_param_file (args.project, outfilename, config, args.group)
diff --git a/utils/skel/lib/skel_replay.py b/utils/skel/lib/skel_replay.py
index dbde945..188bfd6 100644
--- a/utils/skel/lib/skel_replay.py
+++ b/utils/skel/lib/skel_replay.py
@@ -45,15 +45,15 @@ def do_replay_with_args (parent_parser):
         do_replay_from_yaml (args)
         return
 
-    print "No bp file or yaml file specified, exiting"
+    print ("No bp file or yaml file specified, exiting")
     return
 
 #    else:
 #        try:
 #            params = skelconf.skelConfig (args.project + '_params.xml')
 #        except (IOError):
-#            print "Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,"
-#            print "then check that " + args.project + "_params.xml exists."
+#            print ("Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,")
+#            print ("then check that " + args.project + "_params.xml exists.")
 #            return
 
 #        generate_makefiles (params, config)
@@ -62,7 +62,7 @@ def do_replay_with_args (parent_parser):
 
 
 def do_replay_from_bpfile (args):
-    print "Replaying using %s" % args.bpfile
+    print ("Replaying using %s" % args.bpfile)
     
     # First, call skeldump to get the yamlfile
     sdcmd = "skeldump %s > %s.yaml" % (args.bpfile, args.project)
@@ -76,7 +76,7 @@ def do_replay_from_bpfile (args):
 
 
 def do_replay_from_yaml (args):
-    print "Replaying using %s" % args.yamlfile
+    print ("Replaying using %s" % args.yamlfile)
 
     replay_file_name = "%s_replay.sh" % args.project
     replay_file = open (replay_file_name, "w")
diff --git a/utils/skel/lib/skel_settings.py b/utils/skel/lib/skel_settings.py
index 4f172c0..6eda7f6 100644
--- a/utils/skel/lib/skel_settings.py
+++ b/utils/skel/lib/skel_settings.py
@@ -20,8 +20,8 @@ class skel_settings:
                 continue
             split_line = line.split('=')
             if not len (split_line) == 2:
-                print 'Malformed configuration line: ' + line
-                print 'Ignoring'
+                print ('Malformed configuration line: ' + line)
+                print ('Ignoring')
                 continue
             self.settings_dict[split_line[0]] = split_line[1]
 
@@ -55,7 +55,7 @@ def create_settings_dir_if_needed():
     if not os.path.exists (skel_settings_dir_name):
         bindir = os.path.dirname (sys.argv[0])
         shutil.copytree (bindir + '/../etc/skel', skel_settings_dir_name)
-        print 'Created ' + skel_settings_dir_name
+        print ('Created ' + skel_settings_dir_name)
 
 
 def main(argv=None):
diff --git a/utils/skel/lib/skel_source.py b/utils/skel/lib/skel_source.py
index 6806d5b..93389dd 100644
--- a/utils/skel/lib/skel_source.py
+++ b/utils/skel/lib/skel_source.py
@@ -27,7 +27,7 @@ def generate_c_write (outfile, config, params, test):
     outfile = outfile.replace ('.c', '_write.c')
     measure = test.get_measure()
 
-    #print 'opening ' + outfile
+    #print ('opening ' + outfile)
     c_file = open (outfile, 'w')
 
     # Look at all of the groups, Generate the code when we find the requested group
@@ -662,7 +662,7 @@ def pparse_command_line (parent_parser):
 
 
 def create_source_from_yaml (args, config):
-    #print "Using yaml file"
+    #print ("Using yaml file")
 
     # Determine the target language
     if config.host_language == "C" or config.host_language =="c":
@@ -676,14 +676,14 @@ def create_source_from_yaml (args, config):
 
     # Determine outfile name
 
-    #print bpy.get_group_name()
+    #print (bpy.get_group_name())
 
     extension = '_skel_' + bpy.get_group_name()
     outfilename = args.project + extension + filetype
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     skel_file = open (outfilename, 'w')
@@ -707,7 +707,7 @@ def create_sources_with_args (parent_parser):
     try:
         config = adios.adiosConfig (args.project + '_skel.xml')
     except (IOError):
-        print "XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
+        print ("XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")
         return 1
 
 
@@ -715,7 +715,7 @@ def create_sources_with_args (parent_parser):
         create_source_from_yaml(args, config)
     else:
         if args.noxml:
-            print "NOXML generation only supported with yaml input. Generating XML based code."
+            print ("NOXML generation only supported with yaml input. Generating XML based code.")
         create_source_from_xml (args, config)
 
 
@@ -724,8 +724,8 @@ def create_source_from_xml (args, config):
     try:
         params = skelconf.skelConfig (args.project + '_params.xml')
     except (IOError):
-        print "Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,"
-        print "then check that " + args.project + "_params.xml exists."
+        print ("Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,")
+        print ("then check that " + args.project + "_params.xml exists.")
         return  
 
     # Determine the target language
diff --git a/utils/skel/lib/skel_submit.py b/utils/skel/lib/skel_submit.py
index 7a57626..a6b2412 100644
--- a/utils/skel/lib/skel_submit.py
+++ b/utils/skel/lib/skel_submit.py
@@ -114,7 +114,7 @@ def submit_line_template_replace (template_line, params, batch, test, settings):
 
 
 def generate_submit_scripts_from_yaml (args):
-    #print "Generating submission script using yaml file"
+    #print ("Generating submission script using yaml file")
 
     bpy = skel_bpy.skel_bpy (args.yamlfile)
 
@@ -123,7 +123,7 @@ def generate_submit_scripts_from_yaml (args):
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     skel_file = open (outfilename, 'w')
@@ -154,7 +154,7 @@ def generate_submit_scripts_with_args (parent_parser):
     try:
         config = adios.adiosConfig (args.project + '_skel.xml')
     except (IOError):
-        print "XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
+        print ("XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")
         return 1
 
 
@@ -164,8 +164,8 @@ def generate_submit_scripts_with_args (parent_parser):
         try:
             params = skelconf.skelConfig (args.project + '_params.xml')
         except (IOError):
-            print "Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,"
-            print "then check that " + args.project + "_params.xml exists."
+            print ("Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,")
+            print ("then check that " + args.project + "_params.xml exists.")
             return 1
 
         generate_submit_scripts_from_xml (params)
diff --git a/utils/skel/lib/skel_suite.py b/utils/skel/lib/skel_suite.py
index 8dd6e4f..e21040a 100644
--- a/utils/skel/lib/skel_suite.py
+++ b/utils/skel/lib/skel_suite.py
@@ -35,7 +35,7 @@ def pparse_command_line (parent_parser):
 def gen_suite_with_args (parent_parser):
     args = pparse_command_line (parent_parser)
 
-    print "Generating test suite using %s" % args.yamlfile
+    print ("Generating test suite using %s" % args.yamlfile)
 
     suite_gen_file_name = "%s_gen_suite.sh" % args.project
     suite_gen_file = open (suite_gen_file_name, "w")
@@ -60,7 +60,7 @@ def gen_suite_with_args (parent_parser):
     os.chmod (suite_gen_file_name, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR)
 
     # Run it
-    #print "Run ./%s [disabled]" % suite_gen_file_name
+    #print ("Run ./%s [disabled]" % suite_gen_file_name)
     subprocess.check_call ("./%s" % suite_gen_file_name)
 
 
diff --git a/utils/skel/lib/skel_test_plan.py b/utils/skel/lib/skel_test_plan.py
index 0fc8ab8..ef6dcef 100755
--- a/utils/skel/lib/skel_test_plan.py
+++ b/utils/skel/lib/skel_test_plan.py
@@ -59,7 +59,7 @@ class test:
 def main(argv=None):
     b = skel_test_plan ("test_plan.yaml")
 
-    print b.get_tests()
+    print (b.get_tests())
 
 
 if __name__ == "__main__":
diff --git a/utils/skel/lib/skel_xml.py b/utils/skel/lib/skel_xml.py
index dd8d143..fdca00b 100644
--- a/utils/skel/lib/skel_xml.py
+++ b/utils/skel/lib/skel_xml.py
@@ -62,13 +62,13 @@ def create_skel_xml (parent_parser):
 
 
 def create_from_yaml (project,args):
-    #print "using yaml file"
+    #print ("using yaml file")
 
     outfilename = project + '_skel.xml'
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     skel_file = open (outfilename, 'w')
@@ -91,7 +91,7 @@ def create_from_xml (project, args):
 
     # Only proceed if outfilename does not already exist, or if -f was used
     if os.path.exists (outfilename) and not args.force:
-        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
+        print ("%s exists, aborting. Delete the file or use -f to overwrite." % outfilename)
         return 999
 
     skel_file = open (outfilename, 'w')
diff --git a/utils/skel/lib/skelconf.py b/utils/skel/lib/skelconf.py
index 2cda422..93a537a 100644
--- a/utils/skel/lib/skelconf.py
+++ b/utils/skel/lib/skelconf.py
@@ -10,7 +10,7 @@ class skelConfig:
 
         nodes = doc.childNodes
         if (nodes.length != 1):
-            print 'malformed param file, should contain only a single skel-config element'
+            print ('malformed param file, should contain only a single skel-config element')
             raise SystemExit
         self.config_node = nodes[0]
 
openSUSE Build Service is sponsored by