Skip to content

Commit 516144a

Browse files
praiskupxsuchy
authored andcommitted
package_manager: fix linter issues
The rename of methods makes linter thing these are new issues: - Ignore the f"" warning, as f-string is not optimal for this use-case. - Use RuntimeError instead of the generic Exception. It is still too generic and mock prints stack trace if it happens, but package_manager.py probably deserves it's own exception (#1477).
1 parent 0c41fd9 commit 516144a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mock/py/mockbuild/package_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _package_manager_from_string(name):
3434
return Dnf
3535
if name == 'microdnf':
3636
return MicroDnf
37-
raise Exception('Unrecognized package manager "{}"'.format(name))
37+
raise RuntimeError(f'Unrecognized package manager "{name}"')
3838

3939

4040
def _package_manager_exists(pm_class, config_opts, chroot=None):
@@ -84,6 +84,7 @@ def _package_manager_class_fallback(config_opts, buildroot, fallback):
8484
return pm_class
8585

8686
if not bootstrap:
87+
# pylint: disable=consider-using-f-string
8788
print("""WARNING! WARNING! WARNING!
8889
You are building package for distribution which uses {0}. However your system
8990
does not support {0}. You can continue with {1}, which will likely succeed,
@@ -97,7 +98,7 @@ def _package_manager_class_fallback(config_opts, buildroot, fallback):
9798

9899
return pm_class
99100

100-
raise Exception(f"No package from {fallbacks[desired]} found, desired {desired}")
101+
raise RuntimeError(f"No package from {fallbacks[desired]} found, desired {desired}")
101102

102103

103104
def package_manager(buildroot, bootstrap_buildroot, fallback):

0 commit comments

Comments
 (0)