Commit 2b504733f45906c4ea4252f3a2ea60c73d41cc16
1 parent
3cc46b26
Don't use .format() in csinfo
The str.format() function does not exist for before Python 2.6, so don't use it!
Showing
1 changed file
with
15 additions
and
15 deletions
cscripts/csinfo.py
| ... | ... | @@ -261,19 +261,19 @@ def csinfo_setup_info(): |
| 261 | 261 | print('\nGammalib / ctools setup info:\n') |
| 262 | 262 | |
| 263 | 263 | # Print package versions |
| 264 | - print(' Gammalib version ................ {0}'.format(gammalib_version)) | |
| 265 | - print(' ctools version ................ {0}'.format(ctools_version)) | |
| 266 | - print(' cscripts version ................ {0}'.format(cscripts_version)) | |
| 267 | - print(' $GAMMALIB environment variable ... {0}'.format(gammalib_env)) | |
| 268 | - print(' $CTOOLS environment variable ... {0}'.format(ctools_env)) | |
| 269 | - print(' Python executable ................ {0}'.format(sys.executable)) | |
| 270 | - print(' gammalib Python module .......... {0}'.format(gammalib_path)) | |
| 271 | - print(' ctools Python module .......... {0}'.format(ctools_path)) | |
| 272 | - print(' cscripts Python module .......... {0}'.format(cscripts_path)) | |
| 273 | - print(' GAMMALIB CFLAGS ................. {0}'.format(get_pkg_config_info('cflags', 'gammalib'))) | |
| 274 | - print(' CTOOLS CFLAGS ................. {0}'.format(get_pkg_config_info('cflags', 'ctools'))) | |
| 275 | - print(' GAMMALIB LIBS ................. {0}'.format(get_pkg_config_info('libs', 'gammalib'))) | |
| 276 | - print(' CTOOLS LIBS ................. {0}'.format(get_pkg_config_info('libs', 'ctools'))) | |
| 264 | + print(' Gammalib version ................ %s' % gammalib_version) | |
| 265 | + print(' ctools version ................ %s' % ctools_version) | |
| 266 | + print(' cscripts version ................ %s' % cscripts_version) | |
| 267 | + print(' $GAMMALIB environment variable ... %s' % gammalib_env) | |
| 268 | + print(' $CTOOLS environment variable ... %s' % ctools_env) | |
| 269 | + print(' Python executable ................ %s' % sys.executable) | |
| 270 | + print(' gammalib Python module .......... %s' % gammalib_path) | |
| 271 | + print(' ctools Python module .......... %s' % ctools_path) | |
| 272 | + print(' cscripts Python module .......... %s' % cscripts_path) | |
| 273 | + print(' GAMMALIB CFLAGS ................. %s' % get_pkg_config_info('cflags', 'gammalib')) | |
| 274 | + print(' CTOOLS CFLAGS ................. %s' % get_pkg_config_info('cflags', 'ctools')) | |
| 275 | + print(' GAMMALIB LIBS ................. %s' % get_pkg_config_info('libs', 'gammalib')) | |
| 276 | + print(' CTOOLS LIBS ................. %s' % get_pkg_config_info('libs', 'ctools')) | |
| 277 | 277 | print('') |
| 278 | 278 | |
| 279 | 279 | # Return |
| ... | ... | @@ -300,7 +300,7 @@ def get_pkg_config_info(info, library): |
| 300 | 300 | Information string, 'Not available' if pkg-config is not installed |
| 301 | 301 | """ |
| 302 | 302 | # Set pkg-config command |
| 303 | - cmd = 'pkg-config --{0} {1}'.format(info, library) | |
| 303 | + cmd = 'pkg-config --%s %s' % (info, library) | |
| 304 | 304 | |
| 305 | 305 | # Execute command |
| 306 | 306 | out = get_command_output(cmd) |
| ... | ... | @@ -355,7 +355,7 @@ def csinfo(argv): |
| 355 | 355 | elif cmd == 'info': |
| 356 | 356 | csinfo_setup_info() |
| 357 | 357 | else: |
| 358 | - print('\nERROR: invalid command: `{0}`'.format(cmd)) | |
| 358 | + print('\nERROR: invalid command: "%s"' % cmd) | |
| 359 | 359 | csinfo_print_help() |
| 360 | 360 | sys.exit(-1) |
| 361 | 361 | ... | ... |