comparison setup.py @ 15388:eb6c0d47c3d5 stable

setup: set whole env for running hg even if .hg doesn't exist (issue3073) The issue was partially fixed by b357a972d6cd, but there were missing variables to run build_hgextindex.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 31 Oct 2011 00:42:32 +0900
parents b357a972d6cd
children c3a6ec304055
comparison
equal deleted inserted replaced
15387:87248de09135 15388:eb6c0d47c3d5
131 return '' 131 return ''
132 return out 132 return out
133 133
134 version = '' 134 version = ''
135 135
136 env = {'HGRCPATH': '', 'LANGUAGE': 'C'} 136 # Execute hg out of this directory with a custom environment which
137 # includes the pure Python modules in mercurial/pure. We also take
138 # care to not use any hgrc files and do no localization.
139 pypath = ['mercurial', os.path.join('mercurial', 'pure')]
140 env = {'PYTHONPATH': os.pathsep.join(pypath),
141 'HGRCPATH': '',
142 'LANGUAGE': 'C'}
143 if 'LD_LIBRARY_PATH' in os.environ:
144 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
145 if 'SystemRoot' in os.environ:
146 # Copy SystemRoot into the custom environment for Python 2.6
147 # under Windows. Otherwise, the subprocess will fail with
148 # error 0xc0150004. See: http://bugs.python.org/issue3440
149 env['SystemRoot'] = os.environ['SystemRoot']
137 150
138 if os.path.isdir('.hg'): 151 if os.path.isdir('.hg'):
139 # Execute hg out of this directory with a custom environment which
140 # includes the pure Python modules in mercurial/pure. We also take
141 # care to not use any hgrc files and do no localization.
142 pypath = ['mercurial', os.path.join('mercurial', 'pure')]
143 env['PYTHONPATH'] = os.pathsep.join(pypath)
144 if 'LD_LIBRARY_PATH' in os.environ:
145 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
146 if 'SystemRoot' in os.environ:
147 # Copy SystemRoot into the custom environment for Python 2.6
148 # under Windows. Otherwise, the subprocess will fail with
149 # error 0xc0150004. See: http://bugs.python.org/issue3440
150 env['SystemRoot'] = os.environ['SystemRoot']
151 cmd = [sys.executable, 'hg', 'id', '-i', '-t'] 152 cmd = [sys.executable, 'hg', 'id', '-i', '-t']
152 l = runhg(cmd, env).split() 153 l = runhg(cmd, env).split()
153 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags 154 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
154 l.pop() 155 l.pop()
155 if len(l) > 1: # tag found 156 if len(l) > 1: # tag found