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:
parent
9b576bf976
commit
16ac225013
@ -234,6 +234,12 @@ class CompsWrapper(object):
|
|||||||
return [pkg.name for pkg in grp.packages]
|
return [pkg.name for pkg in grp.packages]
|
||||||
raise KeyError('No such group %r' % group)
|
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):
|
def validate(self):
|
||||||
"""Check that no package name contains whitespace, and raise a
|
"""Check that no package name contains whitespace, and raise a
|
||||||
RuntimeError if there is a problem.
|
RuntimeError if there is a problem.
|
||||||
|
19
tests/fixtures/comps-env.xml
vendored
19
tests/fixtures/comps-env.xml
vendored
@ -99,27 +99,8 @@
|
|||||||
</grouplist>
|
</grouplist>
|
||||||
</environment>
|
</environment>
|
||||||
<langpacks>
|
<langpacks>
|
||||||
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
|
||||||
<match install="aspell-%s" name="aspell"/>
|
<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="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-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>
|
</langpacks>
|
||||||
</comps>
|
</comps>
|
||||||
|
19
tests/fixtures/comps-formatted.xml
vendored
19
tests/fixtures/comps-formatted.xml
vendored
@ -113,27 +113,8 @@
|
|||||||
</grouplist>
|
</grouplist>
|
||||||
</environment>
|
</environment>
|
||||||
<langpacks>
|
<langpacks>
|
||||||
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
|
||||||
<match install="aspell-%s" name="aspell"/>
|
<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="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-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>
|
</langpacks>
|
||||||
</comps>
|
</comps>
|
||||||
|
19
tests/fixtures/comps-group.xml
vendored
19
tests/fixtures/comps-group.xml
vendored
@ -79,27 +79,8 @@
|
|||||||
</grouplist>
|
</grouplist>
|
||||||
</environment>
|
</environment>
|
||||||
<langpacks>
|
<langpacks>
|
||||||
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
|
||||||
<match install="aspell-%s" name="aspell"/>
|
<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="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-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>
|
</langpacks>
|
||||||
</comps>
|
</comps>
|
||||||
|
19
tests/fixtures/comps.xml
vendored
19
tests/fixtures/comps.xml
vendored
@ -126,28 +126,9 @@
|
|||||||
<!-- LANGPACKS -->
|
<!-- LANGPACKS -->
|
||||||
|
|
||||||
<langpacks>
|
<langpacks>
|
||||||
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
|
||||||
<match install="aspell-%s" name="aspell"/>
|
<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="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-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>
|
</langpacks>
|
||||||
|
|
||||||
<!-- CATEGORIES -->
|
<!-- CATEGORIES -->
|
||||||
|
@ -48,6 +48,17 @@ class CompsWrapperTest(unittest.TestCase):
|
|||||||
sorted(comps.get_packages('text-internet')),
|
sorted(comps.get_packages('text-internet')),
|
||||||
sorted(['dummy-elinks', 'dummy-tftp']))
|
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):
|
def test_get_packages_for_non_existing_group(self):
|
||||||
comps = CompsWrapper(COMPS_FILE)
|
comps = CompsWrapper(COMPS_FILE)
|
||||||
with self.assertRaises(KeyError):
|
with self.assertRaises(KeyError):
|
||||||
|
Loading…
Reference in New Issue
Block a user