From dbcf7db1f62f22da8b02907210aaca2ec95ab9ae Mon Sep 17 00:00:00 2001 From: Ritesh Raj Sarraf Date: Tue, 4 Jun 2024 15:22:36 +0530 Subject: [PATCH] Order the check for len(self.opts) --- apt_offline_core/AptOfflineCoreLib.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/apt_offline_core/AptOfflineCoreLib.py b/apt_offline_core/AptOfflineCoreLib.py index 36d6baf..ffa9518 100644 --- a/apt_offline_core/AptOfflineCoreLib.py +++ b/apt_offline_core/AptOfflineCoreLib.py @@ -723,17 +723,19 @@ def __init__(self, gpgv=None, keyring=None, Simulate=False): ) self.opts.extend(["--keyring", eachGPG]) - if len(self.opts) == 1: - log.err( - "No valid keyring paths found in: %s\n" - % (", ".join(self.defaultPaths)) - ) - if keyring: for eachFile in os.listdir(keyring): extraKeyringFile = os.path.join(keyring, eachFile) log.verbose("extraKeyringFile is %s" % extraKeyringFile) - self.opts.extend(["--keyring", extraKeyringFile, "--ignore-time-conflict"]) + self.opts.extend( + ["--keyring", extraKeyringFile, "--ignore-time-conflict"] + ) + + if len(self.opts) == 1: + log.err( + "No valid keyring paths found in: %s\n" % ( + ", ".join(self.defaultPaths)) + ) def DearmorSig(self, asciiSig): gpgCmd = [] @@ -2216,8 +2218,10 @@ def displayBugs(self, dataType=None): sys.exit(1) def verifyAptFileIntegrity(self, FileList): - self.AptSecure = APTVerifySigs(keyring=InstallerInstance.extra_keyring, - Simulate=InstallerInstance.Bool_TestWindows) + self.AptSecure = APTVerifySigs( + keyring=InstallerInstance.extra_keyring, + Simulate=InstallerInstance.Bool_TestWindows, + ) self.lFileList = FileList self.lFileList.sort()