comparison setup.py @ 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
comparison
equal deleted inserted replaced
8627:4c5b46f736f1 8628:4dd06ab9217c
110 110
111 out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, 111 out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE,
112 stderr=subprocess.PIPE).communicate() 112 stderr=subprocess.PIPE).communicate()
113 os.environ['PYTHONPATH'] = pypath 113 os.environ['PYTHONPATH'] = pypath
114 114
115 # If root is executing setup.py, but the repository is owned by
116 # another user (as in "sudo python setup.py install") we will get
117 # trust warnings since the .hg/hgrc file is untrusted. That is
118 # fine, we don't want to load it anyway.
119 err = [e for e in err.splitlines()
120 if not e.startswith('Not trusting file')]
115 if err: 121 if err:
116 sys.stderr.write('warning: could not establish Mercurial ' 122 sys.stderr.write('warning: could not establish Mercurial '
117 'version:\n%s\n' % err) 123 'version:\n%s\n' % '\n'.join(err))
118 else: 124 else:
119 l = out.split() 125 l = out.split()
120 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags 126 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
121 l.pop() 127 l.pop()
122 if l: 128 if l: