Skip to content

Commit

Permalink
boot-utils: Address new pylint possibly-used-before-assignment warnings
Browse files Browse the repository at this point in the history
  boot-qemu.py:148:32: E0606: Possibly using variable 'decomp_cmd' before assignment (possibly-used-before-assignment)
  utils.py:215:24: E0606: Possibly using variable 'gh_json_rel' before assignment (possibly-used-before-assignment)

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance committed May 15, 2024
1 parent 9d1c9e9 commit 1e8f7fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boot-qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def _get_kernel_ver_tuple(self, decomp_prog):
utils.check_cmd(decomp_prog)
if decomp_prog in ('gzip', ):
decomp_cmd = [decomp_prog, '-c', '-d', self.kernel]
else:
raise RuntimeError(
f"Unsupported decompression program ('{decomp_prog}')?")
decomp = subprocess.run(decomp_cmd, capture_output=True, check=True)

utils.check_cmd('strings')
Expand Down
3 changes: 3 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def prepare_initrd(architecture, rootfs_format='cpio', gh_json_file=None):

# Download the ramdisk if it is not already downloaded
if not src.exists():
# gh_json_rel cannot be unset when used here because the elif condition
# above is the same as this one, which causes the script to exit.
# pylint: disable-next=possibly-used-before-assignment
download_initrd(gh_json_rel, src)
# If it is already downloaded, check that it is up to date and download
# an update only if necessary.
Expand Down

0 comments on commit 1e8f7fd

Please sign in to comment.