comps: Add get_langpacks function

This also simplifies the test data by removing a lot of the langpacks.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-07-17 13:11:13 +02:00
parent 9b576bf976
commit 16ac225013
6 changed files with 17 additions and 76 deletions

View File

@ -234,6 +234,12 @@ class CompsWrapper(object):
return [pkg.name for pkg in grp.packages]
raise KeyError('No such group %r' % group)
def get_langpacks(self):
langpacks = {}
for pack in self.comps.langpacks:
langpacks[pack] = self.comps.langpacks[pack]
return langpacks
def validate(self):
"""Check that no package name contains whitespace, and raise a
RuntimeError if there is a problem.

View File

@ -99,27 +99,8 @@
</grouplist>
</environment>
<langpacks>
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
<match install="aspell-%s" name="aspell"/>
<match install="autocorr-%s" name="autocorr-en"/>
<match install="calligra-l10n-%s" name="calligra-core"/>
<match install="childsplay-alphabet_sounds_%s" name="childsplay"/>
<match install="dummy-release-notes-%s" name="dummy-release-notes"/>
<match install="eclipse-nls-%s" name="eclipse-platform"/>
<match install="firefox-langpack-%s" name="firefox"/>
<match install="gcompris-sound-%s" name="gcompris"/>
<match install="gimp-help-%s" name="gimp-help"/>
<match install="hunspell-%s" name="hunspell"/>
<match install="hyphen-%s" name="hyphen"/>
<match install="kde-l10n-%s" name="kdelibs"/>
<match install="kde-i18n-%s" name="kdelibs3"/>
<match install="libreoffice-langpack-%s" name="libreoffice-core"/>
<match install="man-pages-%s" name="man-pages"/>
<match install="moodle-%s" name="moodle"/>
<match install="mythes-%s" name="mythes"/>
<match install="nqc-doc-%s" name="nqc-doc"/>
<match install="openoffice.org-langpack-%s" name="openoffice.org-core"/>
<match install="tesseract-langpack-%s" name="tesseract"/>
<match install="tkgate-%s" name="tkgate"/>
</langpacks>
</comps>

View File

@ -113,27 +113,8 @@
</grouplist>
</environment>
<langpacks>
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
<match install="aspell-%s" name="aspell"/>
<match install="autocorr-%s" name="autocorr-en"/>
<match install="calligra-l10n-%s" name="calligra-core"/>
<match install="childsplay-alphabet_sounds_%s" name="childsplay"/>
<match install="dummy-release-notes-%s" name="dummy-release-notes"/>
<match install="eclipse-nls-%s" name="eclipse-platform"/>
<match install="firefox-langpack-%s" name="firefox"/>
<match install="gcompris-sound-%s" name="gcompris"/>
<match install="gimp-help-%s" name="gimp-help"/>
<match install="hunspell-%s" name="hunspell"/>
<match install="hyphen-%s" name="hyphen"/>
<match install="kde-l10n-%s" name="kdelibs"/>
<match install="kde-i18n-%s" name="kdelibs3"/>
<match install="libreoffice-langpack-%s" name="libreoffice-core"/>
<match install="man-pages-%s" name="man-pages"/>
<match install="moodle-%s" name="moodle"/>
<match install="mythes-%s" name="mythes"/>
<match install="nqc-doc-%s" name="nqc-doc"/>
<match install="openoffice.org-langpack-%s" name="openoffice.org-core"/>
<match install="tesseract-langpack-%s" name="tesseract"/>
<match install="tkgate-%s" name="tkgate"/>
</langpacks>
</comps>

View File

@ -79,27 +79,8 @@
</grouplist>
</environment>
<langpacks>
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
<match install="aspell-%s" name="aspell"/>
<match install="autocorr-%s" name="autocorr-en"/>
<match install="calligra-l10n-%s" name="calligra-core"/>
<match install="childsplay-alphabet_sounds_%s" name="childsplay"/>
<match install="dummy-release-notes-%s" name="dummy-release-notes"/>
<match install="eclipse-nls-%s" name="eclipse-platform"/>
<match install="firefox-langpack-%s" name="firefox"/>
<match install="gcompris-sound-%s" name="gcompris"/>
<match install="gimp-help-%s" name="gimp-help"/>
<match install="hunspell-%s" name="hunspell"/>
<match install="hyphen-%s" name="hyphen"/>
<match install="kde-l10n-%s" name="kdelibs"/>
<match install="kde-i18n-%s" name="kdelibs3"/>
<match install="libreoffice-langpack-%s" name="libreoffice-core"/>
<match install="man-pages-%s" name="man-pages"/>
<match install="moodle-%s" name="moodle"/>
<match install="mythes-%s" name="mythes"/>
<match install="nqc-doc-%s" name="nqc-doc"/>
<match install="openoffice.org-langpack-%s" name="openoffice.org-core"/>
<match install="tesseract-langpack-%s" name="tesseract"/>
<match install="tkgate-%s" name="tkgate"/>
</langpacks>
</comps>

View File

@ -126,28 +126,9 @@
<!-- LANGPACKS -->
<langpacks>
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
<match install="aspell-%s" name="aspell"/>
<match install="autocorr-%s" name="autocorr-en"/>
<match install="calligra-l10n-%s" name="calligra-core"/>
<match install="childsplay-alphabet_sounds_%s" name="childsplay"/>
<match install="eclipse-nls-%s" name="eclipse-platform"/>
<match install="firefox-langpack-%s" name="firefox"/>
<match install="gcompris-sound-%s" name="gcompris"/>
<match install="gimp-help-%s" name="gimp-help"/>
<match install="hunspell-%s" name="hunspell"/>
<match install="hyphen-%s" name="hyphen"/>
<match install="kde-l10n-%s" name="kdelibs"/>
<match install="kde-i18n-%s" name="kdelibs3"/>
<match install="libreoffice-langpack-%s" name="libreoffice-core"/>
<match install="man-pages-%s" name="man-pages"/>
<match install="moodle-%s" name="moodle"/>
<match install="mythes-%s" name="mythes"/>
<match install="nqc-doc-%s" name="nqc-doc"/>
<match install="openoffice.org-langpack-%s" name="openoffice.org-core"/>
<match install="tesseract-langpack-%s" name="tesseract"/>
<match install="tkgate-%s" name="tkgate"/>
<match install="dummy-release-notes-%s" name="dummy-release-notes"/>
</langpacks>
<!-- CATEGORIES -->

View File

@ -48,6 +48,17 @@ class CompsWrapperTest(unittest.TestCase):
sorted(comps.get_packages('text-internet')),
sorted(['dummy-elinks', 'dummy-tftp']))
def test_get_langpacks(self):
comps = CompsWrapper(COMPS_FILE)
self.assertEqual(
comps.get_langpacks(),
{
"aspell": "aspell-%s",
"firefox": "firefox-langpack-%s",
"kdelibs": "kde-l10n-%s",
}
)
def test_get_packages_for_non_existing_group(self):
comps = CompsWrapper(COMPS_FILE)
with self.assertRaises(KeyError):