Mercurial > public > mercurial-scm > hg-stable
diff rust/hgcli/pyoxidizer.bzl @ 47865:769cd5703b2c stable
hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
This variable is created by the system and *should* be available, but
test-lfs-bundle.t has a test where it is explicitly unset. It wasn't caught
before because prior to 95af358fcdfe, it was limited to the py2exe binary. As a
precaution, fix both that and the pyoxidizer case that was causing the test to
fail.
Differential Revision: https://phab.mercurial-scm.org/D11354
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 26 Aug 2021 11:04:14 -0400 |
parents | 95af358fcdfe |
children | 07f3f154e03a |
line wrap: on
line diff
--- a/rust/hgcli/pyoxidizer.bzl Thu Aug 26 09:49:09 2021 +0200 +++ b/rust/hgcli/pyoxidizer.bzl Thu Aug 26 11:04:14 2021 -0400 @@ -47,14 +47,16 @@ # 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', + appdata = os.environ.get('APPDATA') + if appdata: + sys.path.append( + os.path.join( + appdata, + 'Python', + 'Python%d%d' % (vi[0], vi[1]), + 'site-packages', + ) ) - ) import hgdemandimport; hgdemandimport.enable(); from mercurial import dispatch;