Commit e1b7990e authored by Matt Harbison's avatar Matt Harbison
Browse files

pyoxidizer: add user-site to `sys.path` on Windows

This is a port of 53221078e0de to Windows to allow pip-installed extensions to
be loaded without specifying a path.  It's a major headache to have an hg.exe on
`PATH` that needs to have the path to the extensions specified, because WSL
doesn't see the same path.

This is only for Windows for now, to match the currently shipping py2 behavior.
There is a better solution with using the `site` package, but this needs support
in PyOxidizer[1].

[1] https://github.com/indygreg/PyOxidizer/issues/430

Differential Revision: https://phab.mercurial-scm.org/D11308

--HG--
branch : stable
parent ad2c37075f46
......@@ -44,6 +44,17 @@ if extra_path is not None:
# We do not prepend the values because the Mercurial library wants to be in
# the front of the sys.path to avoid picking up other installations.
sys.path.extend(extra_path.split(os.pathsep))
# Add user site to sys.path to load extensions without the full path
if os.name == 'nt':
vi = sys.version_info
sys.path.append(
os.path.join(
os.environ['APPDATA'],
'Python',
'Python%d%d' % (vi[0], vi[1]),
'site-packages',
)
)
import hgdemandimport;
hgdemandimport.enable();
from mercurial import dispatch;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment