Show More
@@ -298,9 +298,15 b' def findhg():' | |||||
298 | if attempt(hgcmd + check_cmd, hgenv): |
|
298 | if attempt(hgcmd + check_cmd, hgenv): | |
299 | return hgcommand(hgcmd, hgenv) |
|
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 | hgenv = localhgenv() |
|
303 | hgenv = localhgenv() | |
303 |
hgcmd = [sys.executable, |
|
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 | if attempt(hgcmd + check_cmd, hgenv): |
|
310 | if attempt(hgcmd + check_cmd, hgenv): | |
305 | return hgcommand(hgcmd, hgenv) |
|
311 | return hgcommand(hgcmd, hgenv) | |
306 |
|
312 | |||
@@ -322,17 +328,18 b' def findhg():' | |||||
322 | return None |
|
328 | return None | |
323 |
|
329 | |||
324 |
|
330 | |||
325 | def localhgenv(): |
|
331 | def localhgenv(pure_python=True): | |
326 | """Get an environment dictionary to use for invoking or importing |
|
332 | """Get an environment dictionary to use for invoking or importing | |
327 | mercurial from the local repository.""" |
|
333 | mercurial from the local repository.""" | |
328 | # Execute hg out of this directory with a custom environment which takes |
|
334 | # Execute hg out of this directory with a custom environment which takes | |
329 | # care to not use any hgrc files and do no localization. |
|
335 | # care to not use any hgrc files and do no localization. | |
330 | env = { |
|
336 | env = { | |
331 | 'HGMODULEPOLICY': 'py', |
|
|||
332 | 'HGRCPATH': '', |
|
337 | 'HGRCPATH': '', | |
333 | 'LANGUAGE': 'C', |
|
338 | 'LANGUAGE': 'C', | |
334 | 'PATH': '', |
|
339 | 'PATH': '', | |
335 | } # make pypi modules that use os.environ['PATH'] happy |
|
340 | } # make pypi modules that use os.environ['PATH'] happy | |
|
341 | if pure_python: | |||
|
342 | env['HGMODULEPOLICY'] = 'py' | |||
336 | if 'LD_LIBRARY_PATH' in os.environ: |
|
343 | if 'LD_LIBRARY_PATH' in os.environ: | |
337 | env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] |
|
344 | env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] | |
338 | if 'SystemRoot' in os.environ: |
|
345 | if 'SystemRoot' in os.environ: |
General Comments 0
You need to be logged in to leave comments.
Login now