Raise DistroUnsupported for unsupported distros

This commit is contained in:
Matthew Howle
2021-09-24 14:38:42 -04:00
parent c84e47111e
commit bfdbe6d78f

View File

@@ -535,6 +535,8 @@ def list_packages(distro):
raise HistoryFileNotFoundError() raise HistoryFileNotFoundError()
elif distro in DEB_FAMILY: elif distro in DEB_FAMILY:
packages = list_packages_dpkg() packages = list_packages_dpkg()
else:
raise DistroUnsupported(distro)
return packages return packages
@@ -559,7 +561,8 @@ def package_full(d, distro):
if release: if release:
package.extend(['-', release]) package.extend(['-', release])
return ''.join(package) return ''.join(package)
return '{name}'.format(**d) # need a better default raise DistroUnsupported(distro)
def package_name(d, distro): def package_name(d, distro):
@@ -568,7 +571,7 @@ def package_name(d, distro):
return '{name}.{arch}'.format(**d) return '{name}.{arch}'.format(**d)
elif distro in DEB_FAMILY: elif distro in DEB_FAMILY:
return '{name}:{arch}'.format(**d) return '{name}:{arch}'.format(**d)
return '{name}'.format(**d) raise DistroUnsupported(distro)
def is_valid_input(d): def is_valid_input(d):