1. Jerónimo Albi
  2. shrink

Commits

Jerónimo Albi  committed b714b4a

Changed string formating to be python 2.5 friendly

  • Participants
  • Parent commits df1501f
  • Branches python3

Comments (0)

Files changed (4)

File setup.py

View file
 CURRENT_DIR = os.path.dirname(__file__)
 README = read_file(CURRENT_DIR, "README.rst")
 CHANGELOG = read_file(CURRENT_DIR, "CHANGELOG.rst")
-LONG_DESCRIPTION = "{0}\n\n{1}".format(README, CHANGELOG)
+LONG_DESCRIPTION = "%s\n\n%s" % (README, CHANGELOG)
 AUTHORS = (
     ("Jer\xc3\xb3nimo Jos\xc3\xa9 Albi", "albi@wienfluss.net"),
 )

File shrink/command.py

View file
     cfg_file = os.path.abspath(cfg_file)
 
     if args.version:
-        print_text('Shrink {0}', get_version())
+        print_text('Shrink %s', get_version())
         sys.exit()
     elif args.example:
         # when --example-cfg is present copy example to
         # current folder and exit
         file_name = 'example_shrink.cfg'
         if os.path.isfile(file_name):
-            text = ('File {0} not copied because it already exists in '
+            text = ('File %s not copied because it already exists in '
                     'current folder')
             print_text(text, file_name)
             sys.exit(1)
 
         file_path = utils.get_data_file(file_name)
         shutil.copy(file_path, file_name)
-        print_text('Copied {0} to current folder', file_name)
+        print_text('Copied %s to current folder', file_name)
         sys.exit()
     elif not (args.sections or args.list_sections):
         #when no section name(s) is given or no section
     if args.cfg_file and not cfg_file_exists:
         # when config file argument exist but
         # file does not inform user and exit
-        print_text('File {0} does not exist' % cfg_file)
+        print_text('File %s does not exist' % cfg_file)
         sys.exit(1)
 
     try:

File shrink/compatibility.py

View file
     """
     if text:
         end = kwargs.pop('end', '\n')
-        text = text.format(*args) + end
+        if args:
+            text = (text % args) + end
+        else:
+            text = text + end
 
     sys.stdout.write(text)
 

File shrink/parser.py

View file
         try:
             cfg_parser.read(cfg_file)
         except Exception:
-            # print traceback onlu when debug flag is present
-            if self.args.debug:
-                LOG.exception('Config file is not valid')
+            # print traceback only when debug flag is present
+            LOG.exception('Config file is not valid')
 
             raise ParserError('Unable to parse config file %s' % cfg_file)