Patchwork D6753: contrib: simplify the genosxversion.py command to find the hg libraries

login
register
mail settings
Submitter phabricator
Date Aug. 20, 2019, 10:34 p.m.
Message ID <differential-rev-PHID-DREV-y7c7b2s3xdvh7tutngzv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41374/
State Superseded
Headers show

Comments

phabricator - Aug. 20, 2019, 10:34 p.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I forget what problem I ran into while trying to teach the makefile to use a
  non-system python.  (It might have ben missing hg-evolve and/or keyring, but
  `check_output()` was raising an error.)  This still isn't great because it will
  return non zero for something like the username not being set, even though we
  aren't asking for it.  But I suppose it's still useful to simplify.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6753

AFFECTED FILES
  contrib/genosxversion.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/genosxversion.py b/contrib/genosxversion.py
--- a/contrib/genosxversion.py
+++ b/contrib/genosxversion.py
@@ -2,14 +2,13 @@ 
 from __future__ import absolute_import, print_function
 
 import argparse
-import json
 import os
 import subprocess
 import sys
 
 # Always load hg libraries from the hg we can find on $PATH.
-hglib = json.loads(subprocess.check_output(
-    ['hg', 'debuginstall', '-Tjson']))[0]['hgmodules']
+hglib = subprocess.check_output(
+    ['hg', 'debuginstall', '-T', '{hgmodules}'])
 sys.path.insert(0, os.path.dirname(hglib))
 
 from mercurial import util