changeset 45397:148d177a4f2d stable

genosxversion: don't give up if we can't find a path to hg libraries This doesn't work if you have a PyOxidized hg on $PATH, but everything is fine if you just ignore that problem. Differential Revision: https://phab.mercurial-scm.org/D8975
author Augie Fackler <augie@google.com>
date Tue, 01 Sep 2020 10:33:10 -0400
parents fc8299319ffe
children d58a205d0672
files contrib/genosxversion.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/genosxversion.py	Wed Sep 02 01:30:56 2020 +0200
+++ b/contrib/genosxversion.py	Tue Sep 01 10:33:10 2020 -0400
@@ -6,9 +6,14 @@
 import subprocess
 import sys
 
-# Always load hg libraries from the hg we can find on $PATH.
-hglib = subprocess.check_output(['hg', 'debuginstall', '-T', '{hgmodules}'])
-sys.path.insert(0, os.path.dirname(hglib))
+try:
+    # Always load hg libraries from the hg we can find on $PATH.
+    hglib = subprocess.check_output(['hg', 'debuginstall', '-T', '{hgmodules}'])
+    sys.path.insert(0, os.path.dirname(hglib))
+except subprocess.CalledProcessError:
+    # We're probably running with a PyOxidized Mercurial, so just
+    # proceed and hope it works out okay.
+    pass
 
 from mercurial import util