1- #!/usr/bin/env python  
1+ #!/usr/bin/env python3  
22# 
33# generator for Open MPI 
44import  sys 
55import  os 
66import  optparse 
7- import  ConfigParser 
7+ import  configparser 
88
99
1010###################################################################### 
230230
231231CHANGED=0 
232232if test -z \" `echo $PATH | grep %%{_prefix}/bin`\" ; then 
233-     PATH=\${PATH}:%%{_prefix}/bin/ 
233+     PATH=\\  ${PATH}:%%{_prefix}/bin/ 
234234    CHANGED=1 
235235fi 
236236if test -z \" `echo $LD_LIBRARY_PATH | grep %%{_libdir}`\" ; then 
237-     LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:%%{_libdir} 
237+     LD_LIBRARY_PATH=\\  ${LD_LIBRARY_PATH}:%%{_libdir} 
238238    CHANGED=1 
239239fi 
240240if test -z \" `echo $MANPATH | grep %%{_mandir}`\" ; then 
241-     MANPATH=\${MANPATH}:%%{_mandir} 
241+     MANPATH=\\  ${MANPATH}:%%{_mandir} 
242242    CHANGED=1 
243243fi 
244244if test \" $CHANGED\"  = \" 1\" ; then 
252252# uninstalled, or b) if the RPM is upgraded or uninstalled. 
253253
254254if (\" `echo $PATH | grep %%{_prefix}/bin`\" ) then 
255-     setenv PATH \${PATH}:%%{_prefix}/bin/ 
255+     setenv PATH \\  ${PATH}:%%{_prefix}/bin/ 
256256endif 
257257if (\" $?LD_LIBRARY_PATH\" ) then 
258258    if (\" `echo $LD_LIBRARY_PATH | grep %%{_libdir}`\" ) then 
259-         setenv LD_LIBRARY_PATH \${LD_LIBRARY_PATH}:%%{_libdir} 
259+         setenv LD_LIBRARY_PATH \\  ${LD_LIBRARY_PATH}:%%{_libdir} 
260260    endif 
261261endif 
262262if (\" $?MANPATH\" ) then 
263263    if (\" `echo $MANPATH | grep %%{_mandir}`\" ) then 
264-         setenv MANPATH \${MANPATH}:%%{_mandir} 
264+         setenv MANPATH \\  ${MANPATH}:%%{_mandir} 
265265    endif 
266266endif 
267267EOF 
@@ -483,7 +483,7 @@ def Validate(self):
483483    def  Dump (self , prefix = "" ):
484484        global  options 
485485        for  option  in  options :
486-             print   "%(prefix)s %(name)-15s : %(value)s"  %  {"prefix" :prefix , "name" :option , "value" :self .options [option ]}
486+             print ( "%(prefix)s %(name)-15s : %(value)s"  %  {"prefix" :prefix , "name" :option , "value" :self .options [option ]}) 
487487
488488
489489###################################################################### 
@@ -506,7 +506,7 @@ def get_package(name):
506506###################################################################### 
507507def  verbose (msg ):
508508    if  (params .verbose  or  params .debug ):
509-         print   msg 
509+         print ( msg ) 
510510
511511
512512###################################################################### 
@@ -516,7 +516,7 @@ def verbose(msg):
516516###################################################################### 
517517def  debug (msg ):
518518    if  (params .debug ):
519-         print   msg 
519+         print ( msg ) 
520520
521521
522522###################################################################### 
@@ -525,7 +525,7 @@ def debug(msg):
525525# 
526526###################################################################### 
527527def  error (msg ):
528-     print   "+++ ERROR : "  +  msg 
528+     print ( "+++ ERROR : "  +  msg ) 
529529
530530
531531###################################################################### 
@@ -549,7 +549,7 @@ def  get_compiler(name):
549549
550550def  shell_help (cmd ):
551551    for  item  in  shell_cmds .values ():
552-         print   "%(cmd)-10s - %(help)s"  %  {"cmd" :item ["name" ], "help" :item ["help" ]}
552+         print ( "%(cmd)-10s - %(help)s"  %  {"cmd" :item ["name" ], "help" :item ["help" ]}) 
553553    return  True 
554554
555555def  shell_quit (cmd ):
@@ -560,28 +560,28 @@ def shell_list(cmd):
560560
561561def  shell_list (cmd ):
562562    for  package  in  packages .keys ():
563-         print   package 
563+         print ( package ) 
564564    return  True 
565565
566566def  shell_show (cmd ):
567567    if  len (cmd ) <  2 :
568-         print   "Usage : show PACKAGE\n " 
568+         print ( "Usage : show PACKAGE\n " ) 
569569    else :
570570        if  cmd [1 ] in  packages .keys ():
571571            package  =  packages [cmd [1 ]]
572572            package .Dump ()
573573        else :
574-             print   "Invalid package : "  +  cmd [1 ]
574+             print ( "Invalid package : "  +  cmd [1 ]) 
575575    return  True 
576576
577577def  shell_drop (cmd ):
578578    if  len (cmd ) <  2 :
579-         print   "Usage : drop PACKAGE" 
579+         print ( "Usage : drop PACKAGE" ) 
580580    else :
581581        if  cmd [1 ] in  packages .keys ():
582582            packages .pop (cmd [1 ])
583583        else :
584-             print   "Package not found : "  +  cmd [1 ]
584+             print ( "Package not found : "  +  cmd [1 ]) 
585585    return  True 
586586
587587def  shell_write (cmd ):
@@ -599,8 +599,8 @@ def shell():
599599    register_shell_cmd ("show" , "Display one specific package" , shell_show )
600600    register_shell_cmd ("drop" , "Remove the specified package from the list" , shell_drop )
601601    register_shell_cmd ("write" , "Write the specfile" , shell_write )
602-     print   "ompi-spec-generator interactive shell" 
603-     print   "Type 'help' to get more information about available commands." 
602+     print ( "ompi-spec-generator interactive shell" ) 
603+     print ( "Type 'help' to get more information about available commands." ) 
604604    while  loop :
605605        try :
606606            cmd  =  raw_input ("ompi-spec-generator> " )
@@ -612,9 +612,9 @@ def shell():
612612                shell_cmd_func  =  shell_cmd ["function" ]
613613                loop  =  shell_cmd_func (cmd )
614614            else :
615-                 print   "Invalid command" 
615+                 print ( "Invalid command" ) 
616616        except  Exception :
617-             print   "\n " 
617+             print ( "\n " ) 
618618            continue 
619619
620620
@@ -627,7 +627,7 @@ def shell():
627627def  write_specfile (build_packages ):
628628    global  params 
629629    # create output file 
630-     print   "--> Create output file" 
630+     print ( "--> Create output file" ) 
631631    verbose ("     Open output file : %(filename)s"  %  {"filename" :params .output })
632632    specfile  =  open (params .output , 'w' )
633633    verbose ("     Write copyright header" )
@@ -735,12 +735,12 @@ def main():
735735    if  ( params .ompi_prefix  ==  "/opt/openmpi"  ):
736736        params .ompi_prefix  =  params .ompi_prefix  +  "/"  +  params .ompi_version 
737737
738-     print   "--> Using root "  +  params .root 
738+     print ( "--> Using root "  +  params .root ) 
739739    if  params .output  ==  None :
740740        params .output  =  params .ompi_name_prefix  +  params .ompi_name  +  "-"  +  params .ompi_version  +  ".spec" 
741741
742742    # find config files 
743-     print   "--> Search for configuration files" 
743+     print ( "--> Search for configuration files" ) 
744744    for  root , dirs , files  in  os .walk (params .root ):
745745        for  f  in  files :
746746            if  configext  !=  os .path .splitext (f )[1 ]:
@@ -750,7 +750,7 @@ def main():
750750            verbose ("     Found : "  +  cf )
751751
752752    # parse config files 
753-     print   "--> Parse config files" 
753+     print ( "--> Parse config files" ) 
754754    for  file  in  configfiles :
755755        verbose ("     Parse "  +  file )
756756        # parse configfile 
@@ -779,7 +779,7 @@ def main():
779779        return 
780780
781781    # filter packages 
782-     print   "--> Select packages" 
782+     print ( "--> Select packages" ) 
783783    build_packages  =  []
784784    # filter packages 
785785    if  params .packages  !=  None :
@@ -795,7 +795,7 @@ def main():
795795        build_packages  =  packages .values ()
796796
797797    # do sanity check on the components 
798-     print   "--> Sanity check packages" 
798+     print ( "--> Sanity check packages" ) 
799799    for  package  in  build_packages :
800800        verbose ("     Check package "  +  package .getOption ("name" ) )
801801        if  params .debug :
@@ -806,7 +806,7 @@ def main():
806806    write_specfile (build_packages )
807807
808808    # done 
809-     print   "--> Finished." 
809+     print ( "--> Finished." ) 
810810
811811
812812if  ("__main__"  ==  __name__ ):
0 commit comments