Skip to content
Snippets Groups Projects
Commit f816ca29 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

setup: try a non-pure version of the local Mercurial if the pure fails

Things like `zstd` can make the pure version fails.
parent 3c5b66d0
No related branches found
No related tags found
1 merge request!715small improvement to setup.py
......@@ -298,5 +298,6 @@
if attempt(hgcmd + check_cmd, hgenv):
return hgcommand(hgcmd, hgenv)
# Fall back to trying the local hg installation.
# Fall back to trying the local hg installation (pure python)
repo_hg = os.path.join(os.path.dirname(__file__), 'hg')
hgenv = localhgenv()
......@@ -302,5 +303,10 @@
hgenv = localhgenv()
hgcmd = [sys.executable, 'hg']
hgcmd = [sys.executable, repo_hg]
if attempt(hgcmd + check_cmd, hgenv):
return hgcommand(hgcmd, hgenv)
# Fall back to trying the local hg installation (whatever we can)
hgenv = localhgenv(pure_python=False)
hgcmd = [sys.executable, repo_hg]
if attempt(hgcmd + check_cmd, hgenv):
return hgcommand(hgcmd, hgenv)
......@@ -322,9 +328,9 @@
return None
def localhgenv():
def localhgenv(pure_python=True):
"""Get an environment dictionary to use for invoking or importing
mercurial from the local repository."""
# Execute hg out of this directory with a custom environment which takes
# care to not use any hgrc files and do no localization.
env = {
......@@ -326,10 +332,9 @@
"""Get an environment dictionary to use for invoking or importing
mercurial from the local repository."""
# Execute hg out of this directory with a custom environment which takes
# care to not use any hgrc files and do no localization.
env = {
'HGMODULEPOLICY': 'py',
'HGRCPATH': '',
'LANGUAGE': 'C',
'PATH': '',
} # make pypi modules that use os.environ['PATH'] happy
......@@ -332,7 +337,9 @@
'HGRCPATH': '',
'LANGUAGE': 'C',
'PATH': '',
} # make pypi modules that use os.environ['PATH'] happy
if pure_python:
env['HGMODULEPOLICY'] = 'py'
if 'LD_LIBRARY_PATH' in os.environ:
env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
if 'SystemRoot' in os.environ:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment