ubuntutools/misc: define POCKETS and DEFAULT_POCKETS

POCKETS is all valid pockets (capitalized), DEFAULT_POCKETS is all in
POCKETS except 'Backports'.
This commit is contained in:
Dan Streetman 2019-09-11 16:24:49 -04:00
parent b5ae0bdca3
commit d0aa64a51b

View File

@ -32,6 +32,9 @@ import distro_info
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
DEFAULT_POCKETS = ('Release', 'Security', 'Updates', 'Proposed')
POCKETS = DEFAULT_POCKETS + ('Backports',)
_system_distribution_chain = []
@ -141,7 +144,7 @@ def split_release_pocket(release, default='Release'):
(release, pocket) = release.rsplit('-', 1)
pocket = pocket.capitalize()
if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
if pocket not in POCKETS:
raise PocketDoesNotExistError("Pocket '%s' does not exist." % pocket)
return (release, pocket)