1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
#
3
3
# generator for Open MPI
4
4
import sys
5
5
import os
6
6
import optparse
7
- import ConfigParser
7
+ import configparser
8
8
9
9
10
10
######################################################################
230
230
231
231
CHANGED=0
232
232
if test -z \" `echo $PATH | grep %%{_prefix}/bin`\" ; then
233
- PATH=\${PATH}:%%{_prefix}/bin/
233
+ PATH=\\ ${PATH}:%%{_prefix}/bin/
234
234
CHANGED=1
235
235
fi
236
236
if 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}
238
238
CHANGED=1
239
239
fi
240
240
if test -z \" `echo $MANPATH | grep %%{_mandir}`\" ; then
241
- MANPATH=\${MANPATH}:%%{_mandir}
241
+ MANPATH=\\ ${MANPATH}:%%{_mandir}
242
242
CHANGED=1
243
243
fi
244
244
if test \" $CHANGED\" = \" 1\" ; then
252
252
# uninstalled, or b) if the RPM is upgraded or uninstalled.
253
253
254
254
if (\" `echo $PATH | grep %%{_prefix}/bin`\" ) then
255
- setenv PATH \${PATH}:%%{_prefix}/bin/
255
+ setenv PATH \\ ${PATH}:%%{_prefix}/bin/
256
256
endif
257
257
if (\" $?LD_LIBRARY_PATH\" ) then
258
258
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}
260
260
endif
261
261
endif
262
262
if (\" $?MANPATH\" ) then
263
263
if (\" `echo $MANPATH | grep %%{_mandir}`\" ) then
264
- setenv MANPATH \${MANPATH}:%%{_mandir}
264
+ setenv MANPATH \\ ${MANPATH}:%%{_mandir}
265
265
endif
266
266
endif
267
267
EOF
@@ -483,7 +483,7 @@ def Validate(self):
483
483
def Dump (self , prefix = "" ):
484
484
global options
485
485
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 ]})
487
487
488
488
489
489
######################################################################
@@ -506,7 +506,7 @@ def get_package(name):
506
506
######################################################################
507
507
def verbose (msg ):
508
508
if (params .verbose or params .debug ):
509
- print msg
509
+ print ( msg )
510
510
511
511
512
512
######################################################################
@@ -516,7 +516,7 @@ def verbose(msg):
516
516
######################################################################
517
517
def debug (msg ):
518
518
if (params .debug ):
519
- print msg
519
+ print ( msg )
520
520
521
521
522
522
######################################################################
@@ -525,7 +525,7 @@ def debug(msg):
525
525
#
526
526
######################################################################
527
527
def error (msg ):
528
- print "+++ ERROR : " + msg
528
+ print ( "+++ ERROR : " + msg )
529
529
530
530
531
531
######################################################################
@@ -549,7 +549,7 @@ def get_compiler(name):
549
549
550
550
def shell_help (cmd ):
551
551
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" ]})
553
553
return True
554
554
555
555
def shell_quit (cmd ):
@@ -560,28 +560,28 @@ def shell_list(cmd):
560
560
561
561
def shell_list (cmd ):
562
562
for package in packages .keys ():
563
- print package
563
+ print ( package )
564
564
return True
565
565
566
566
def shell_show (cmd ):
567
567
if len (cmd ) < 2 :
568
- print "Usage : show PACKAGE\n "
568
+ print ( "Usage : show PACKAGE\n " )
569
569
else :
570
570
if cmd [1 ] in packages .keys ():
571
571
package = packages [cmd [1 ]]
572
572
package .Dump ()
573
573
else :
574
- print "Invalid package : " + cmd [1 ]
574
+ print ( "Invalid package : " + cmd [1 ])
575
575
return True
576
576
577
577
def shell_drop (cmd ):
578
578
if len (cmd ) < 2 :
579
- print "Usage : drop PACKAGE"
579
+ print ( "Usage : drop PACKAGE" )
580
580
else :
581
581
if cmd [1 ] in packages .keys ():
582
582
packages .pop (cmd [1 ])
583
583
else :
584
- print "Package not found : " + cmd [1 ]
584
+ print ( "Package not found : " + cmd [1 ])
585
585
return True
586
586
587
587
def shell_write (cmd ):
@@ -599,8 +599,8 @@ def shell():
599
599
register_shell_cmd ("show" , "Display one specific package" , shell_show )
600
600
register_shell_cmd ("drop" , "Remove the specified package from the list" , shell_drop )
601
601
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." )
604
604
while loop :
605
605
try :
606
606
cmd = raw_input ("ompi-spec-generator> " )
@@ -612,9 +612,9 @@ def shell():
612
612
shell_cmd_func = shell_cmd ["function" ]
613
613
loop = shell_cmd_func (cmd )
614
614
else :
615
- print "Invalid command"
615
+ print ( "Invalid command" )
616
616
except Exception :
617
- print "\n "
617
+ print ( "\n " )
618
618
continue
619
619
620
620
@@ -627,7 +627,7 @@ def shell():
627
627
def write_specfile (build_packages ):
628
628
global params
629
629
# create output file
630
- print "--> Create output file"
630
+ print ( "--> Create output file" )
631
631
verbose (" Open output file : %(filename)s" % {"filename" :params .output })
632
632
specfile = open (params .output , 'w' )
633
633
verbose (" Write copyright header" )
@@ -735,12 +735,12 @@ def main():
735
735
if ( params .ompi_prefix == "/opt/openmpi" ):
736
736
params .ompi_prefix = params .ompi_prefix + "/" + params .ompi_version
737
737
738
- print "--> Using root " + params .root
738
+ print ( "--> Using root " + params .root )
739
739
if params .output == None :
740
740
params .output = params .ompi_name_prefix + params .ompi_name + "-" + params .ompi_version + ".spec"
741
741
742
742
# find config files
743
- print "--> Search for configuration files"
743
+ print ( "--> Search for configuration files" )
744
744
for root , dirs , files in os .walk (params .root ):
745
745
for f in files :
746
746
if configext != os .path .splitext (f )[1 ]:
@@ -750,7 +750,7 @@ def main():
750
750
verbose (" Found : " + cf )
751
751
752
752
# parse config files
753
- print "--> Parse config files"
753
+ print ( "--> Parse config files" )
754
754
for file in configfiles :
755
755
verbose (" Parse " + file )
756
756
# parse configfile
@@ -779,7 +779,7 @@ def main():
779
779
return
780
780
781
781
# filter packages
782
- print "--> Select packages"
782
+ print ( "--> Select packages" )
783
783
build_packages = []
784
784
# filter packages
785
785
if params .packages != None :
@@ -795,7 +795,7 @@ def main():
795
795
build_packages = packages .values ()
796
796
797
797
# do sanity check on the components
798
- print "--> Sanity check packages"
798
+ print ( "--> Sanity check packages" )
799
799
for package in build_packages :
800
800
verbose (" Check package " + package .getOption ("name" ) )
801
801
if params .debug :
@@ -806,7 +806,7 @@ def main():
806
806
write_specfile (build_packages )
807
807
808
808
# done
809
- print "--> Finished."
809
+ print ( "--> Finished." )
810
810
811
811
812
812
if ("__main__" == __name__ ):
0 commit comments