##// END OF EJS Templates
setup: try a non-pure version of the local Mercurial if the pure fails...
marmoute -
r52054:f816ca29 default
parent child Browse files
Show More
@@ -298,9 +298,15 b' def findhg():'
298 298 if attempt(hgcmd + check_cmd, hgenv):
299 299 return hgcommand(hgcmd, hgenv)
300 300
301 # Fall back to trying the local hg installation.
301 # Fall back to trying the local hg installation (pure python)
302 repo_hg = os.path.join(os.path.dirname(__file__), 'hg')
302 303 hgenv = localhgenv()
303 hgcmd = [sys.executable, 'hg']
304 hgcmd = [sys.executable, repo_hg]
305 if attempt(hgcmd + check_cmd, hgenv):
306 return hgcommand(hgcmd, hgenv)
307 # Fall back to trying the local hg installation (whatever we can)
308 hgenv = localhgenv(pure_python=False)
309 hgcmd = [sys.executable, repo_hg]
304 310 if attempt(hgcmd + check_cmd, hgenv):
305 311 return hgcommand(hgcmd, hgenv)
306 312
@@ -322,17 +328,18 b' def findhg():'
322 328 return None
323 329
324 330
325 def localhgenv():
331 def localhgenv(pure_python=True):
326 332 """Get an environment dictionary to use for invoking or importing
327 333 mercurial from the local repository."""
328 334 # Execute hg out of this directory with a custom environment which takes
329 335 # care to not use any hgrc files and do no localization.
330 336 env = {
331 'HGMODULEPOLICY': 'py',
332 337 'HGRCPATH': '',
333 338 'LANGUAGE': 'C',
334 339 'PATH': '',
335 340 } # make pypi modules that use os.environ['PATH'] happy
341 if pure_python:
342 env['HGMODULEPOLICY'] = 'py'
336 343 if 'LD_LIBRARY_PATH' in os.environ:
337 344 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
338 345 if 'SystemRoot' in os.environ:
General Comments 0
You need to be logged in to leave comments. Login now