public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/, pym/portage/tests/lint/
Date: Tue,  8 Feb 2011 10:02:18 +0000 (UTC)	[thread overview]
Message-ID: <8e6c622174ca5fb8ae1789687954e4335f7a0a2e.zmedico@gentoo> (raw)

commit:     8e6c622174ca5fb8ae1789687954e4335f7a0a2e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  8 10:01:13 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb  8 10:01:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8e6c6221

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).

---
 pym/portage/tests/lint/test_import_modules.py |    1 -
 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 81ffede..8d257c5 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 4808d3c..64b59e6 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__ = [



                 reply	other threads:[~2011-02-08 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e6c622174ca5fb8ae1789687954e4335f7a0a2e.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox