changeset 8628:4dd06ab9217c

setup: handle trust warnings when determining version
author Martin Geisler <mg@lazybytes.net>
date Tue, 26 May 2009 21:13:21 +0200
parents 4c5b46f736f1
children 8e69a22f6792
files setup.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Tue May 26 21:07:41 2009 +0200
+++ b/setup.py	Tue May 26 21:13:21 2009 +0200
@@ -112,9 +112,15 @@
                                 stderr=subprocess.PIPE).communicate()
     os.environ['PYTHONPATH'] = pypath
 
+    # 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.
+    err = [e for e in err.splitlines()
+           if not e.startswith('Not trusting file')]
     if err:
         sys.stderr.write('warning: could not establish Mercurial '
-                         'version:\n%s\n' % err)
+                         'version:\n%s\n' % '\n'.join(err))
     else:
         l = out.split()
         while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags