rust/hgcli/pyoxidizer.bzl
branchstable
changeset 47880 769cd5703b2c
parent 47865 95af358fcdfe
child 47884 07f3f154e03a
--- 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;