setup: ignore 'not importing' warnings during version detection stable
authorSteve Borho <steve@borho.org>
Sat, 05 Dec 2009 14:18:31 -0600
branchstable
changeset 10120 fb890a546d44
parent 10117 98867145f4b5
child 10122 0ddbc0299742
setup: ignore 'not importing' warnings during version detection Python will issue an ImportWarning when seeing 'import locale' if there is a locale/ directory present without a __init__.py file. The warning is silent by default, but it somehow shows up anyway on Windows when setup.py executed hg. The warning causes runcmd to panic since it sees output on stderr. This patch ignores warnings on stderr about not importing a package.
setup.py
--- a/setup.py	Wed Dec 23 12:04:17 2009 +0000
+++ b/setup.py	Sat Dec 05 14:18:31 2009 -0600
@@ -104,9 +104,11 @@
     # If root is executing setup.py, but the repository is owned by
     # another user (as in "sudo python setup.py install") we will get
     # trust warnings since the .hg/hgrc file is untrusted. That is
-    # fine, we don't want to load it anyway.
+    # fine, we don't want to load it anyway.  Python may warn about
+    # a missing __init__.py in mercurial/locale, we also ignore that.
     err = [e for e in err.splitlines()
-           if not e.startswith('Not trusting file')]
+           if not e.startswith('Not trusting file') \
+              and not e.startswith('warning: Not importing')]
     if err:
         return ''
     return out