diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-02-08 02:01:13 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-02-08 12:45:55 -0800 |
commit | df5e3aad0149419ef6c40adee85fbf3ec9aa1edc (patch) | |
tree | c8308b69bcf9dbb7986e89cf10031bf32ab3f3c6 | |
parent | 4bb602539fc3e87961d06c447a7d7e1adf9252c5 (diff) | |
download | portage-df5e3aad0149419ef6c40adee85fbf3ec9aa1edc.tar.gz portage-df5e3aad0149419ef6c40adee85fbf3ec9aa1edc.tar.bz2 portage-df5e3aad0149419ef6c40adee85fbf3ec9aa1edc.zip |
repoman.herdbase: tolerate expat ImportError
We tolerate global scope import failures for optional modules, so that
ImportModulesTestCase can succeed (or possibly alert us about
unexpected import failures).
-rw-r--r-- | pym/portage/tests/lint/test_import_modules.py | 1 | ||||
-rw-r--r-- | pym/repoman/herdbase.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/pym/portage/tests/lint/test_import_modules.py b/pym/portage/tests/lint/test_import_modules.py index 81ffedec4..8d257c5a6 100644 --- a/pym/portage/tests/lint/test_import_modules.py +++ b/pym/portage/tests/lint/test_import_modules.py @@ -11,7 +11,6 @@ class ImportModulesTestCase(TestCase): def testImportModules(self): expected_failures = frozenset(( - 'repoman.herdbase', # requires python with xml support )) for mod in self._iter_modules(PORTAGE_PYM_PATH): diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py index 4808d3ca3..64b59e636 100644 --- a/pym/repoman/herdbase.py +++ b/pym/repoman/herdbase.py @@ -1,11 +1,18 @@ # -*- coding: utf-8 -*- # repoman: Herd database analysis -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later import errno import xml.etree.ElementTree -from xml.parsers.expat import ExpatError +try: + from xml.parsers.expat import ExpatError +except ImportError: + # This means that python is built without xml support. + # We tolerate global scope import failures for optional + # modules, so that ImportModulesTestCase can succeed (or + # possibly alert us about unexpected import failures). + pass from portage.exception import FileNotFound, ParseError, PermissionDenied __all__ = [ |