Blob Blame History Raw
From abe0b0a9b650b1d55c2482d10ad8898f0efc00ea Mon Sep 17 00:00:00 2001
From: Ondrej Nosek <onosek@redhat.com>
Date: Tue, 24 Mar 2020 02:05:19 +0100
Subject: [PATCH] Repair compatible formatting for Python 2.6

Signed-off-by: Ondrej Nosek <onosek@redhat.com>
---
 pyrpkg/__init__.py | 12 ++++++------
 pyrpkg/utils.py    |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
index 50f3302..791b66b 100644
--- a/pyrpkg/__init__.py
+++ b/pyrpkg/__init__.py
@@ -1358,14 +1358,14 @@ class Commands(object):
         target_dir = tempfile.mkdtemp(suffix="extract-srpm", prefix="rpkg")
         try:
             try:
-                self.log.debug("Extracting srpm '{}', destination '{}'".format(
+                self.log.debug("Extracting srpm '{0}', destination '{1}'".format(
                     srpm, target_dir
                 ))
                 # method 'is_lookaside_eligible_file' will access extracted
                 # files to detect its encoding (binary or not)
                 _, _ = extract_srpm(srpm, target_dir)
             except Exception as e:
-                self.log.error("Extraction of srpm has failed {}".format(e))
+                self.log.error("Extraction of srpm has failed {0}".format(e))
                 raise
 
             # Cycle through the srpm content and decide where to upload files
@@ -1633,8 +1633,8 @@ class Commands(object):
         namespace = repo.split("/")[0] if "/" in repo else "rpms"
         # Has current namespace its own clone config?
         selected_clone_config = None
-        if hasattr(self, "clone_config_{}".format(namespace)):
-            selected_clone_config = getattr(self, "clone_config_{}".format(namespace))
+        if hasattr(self, "clone_config_{0}".format(namespace)):
+            selected_clone_config = getattr(self, "clone_config_{0}".format(namespace))
 
         # Valid configuration is non-empty string
         if selected_clone_config:
@@ -1875,10 +1875,10 @@ class Commands(object):
                 os.remove(file)
 
         try:
-            self.log.debug("Extracting srpm '{}'".format(srpm))
+            self.log.debug("Extracting srpm '{0}'".format(srpm))
             output, err = extract_srpm(srpm)
         except Exception as e:
-            self.log.error("Extraction of srpm has failed {}".format(e))
+            self.log.error("Extraction of srpm has failed {0}".format(e))
             raise
         if output:
             self.log.debug(output)
diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
index d1b79b9..1a50a3e 100644
--- a/pyrpkg/utils.py
+++ b/pyrpkg/utils.py
@@ -251,9 +251,9 @@ def extract_srpm(srpm_path, target_dir=None):
     directory if not specified
     """
     if not os.path.isfile(srpm_path):
-        raise IOError("Input file doesn't exist: {}".format(srpm_path))
+        raise IOError("Input file doesn't exist: {0}".format(srpm_path))
     if target_dir and not os.path.isdir(target_dir):
-        raise IOError("Target directory doesn't exist: {}".format(target_dir))
+        raise IOError("Target directory doesn't exist: {0}".format(target_dir))
 
     # rpm2cpio <srpm> | cpio -iud --quiet
     cmd = ['rpm2cpio', srpm_path]
@@ -272,7 +272,7 @@ def is_lookaside_eligible_file(file_name, dir_path=None):
     """
     file_path = os.path.join(dir_path or "", file_name)
     if not os.path.isfile(file_path):
-        raise IOError("Input file doesn't exist: {}".format(file_path))
+        raise IOError("Input file doesn't exist: {0}".format(file_path))
 
     p = subprocess.Popen(
         # parameter '-b' causes brief output - without filename in the output
@@ -284,7 +284,7 @@ def is_lookaside_eligible_file(file_name, dir_path=None):
     )
     output, errors = p.communicate()
     if errors:
-        raise RuntimeError("Mime encoding detection of the file '{}' has failed: {}".format(
+        raise RuntimeError("Mime encoding detection of the file '{0}' has failed: {1}".format(
             file_path,
             errors
         ))
-- 
2.21.1