Patchwork [1,of,2] debuginstall: add Python information to debuginstall output (issue4128)

login
register
mail settings
Submitter Chris Jerdonek
Date Dec. 31, 2013, 8:56 a.m.
Message ID <17bfa5d7637f2d312e6c.1388480178@stonewall.local>
Download mbox | patch
Permalink /patch/3253/
State Accepted
Commit 535283a7f5dd39cdb88379b23b880f44e449a7bb
Delegated to: Matt Mackall
Headers show

Comments

Chris Jerdonek - Dec. 31, 2013, 8:56 a.m.
# HG changeset patch
# User Chris Jerdonek <chris.jerdonek@gmail.com>
# Date 1388479036 28800
#      Tue Dec 31 00:37:16 2013 -0800
# Node ID 17bfa5d7637f2d312e6cf375d937d6de6de931d2
# Parent  4274eda143cb1025be1130ffdaaf62370a2a6961
debuginstall: add Python information to debuginstall output (issue4128)

This change adds to the output of "hg debuginstall" information about the
Python being used by Mercurial.  It adds both the path to the Python
executable (i.e. the value of sys.executable) and the version of Python
(specifically the major, minor, and micro versions).

Below is an example of what the output looks like after this change.
The marked lines are the new output lines:

    $ hg debuginstall
    checking encoding (UTF-8)...
 -->showing Python executable (/Users/chris/.virtualenvs/default/bin/python)
 -->showing Python version (2.7.6)
    checking Python lib (/Users/chris/.virtualenvs/default/lib/python2.7)...
    checking installed modules (/Users/chris/mercurial)...
    checking templates (/Users/chris/mercurial/templates)...
    checking commit editor...
    checking username...
    no problems detected

Note that we use the word "showing" without an ellipsis for the new lines
because, unlike the other lines (except for "Python lib" which will be
adjusted in a subsequent commit), no check follows the display of this
information.
Matt Mackall - March 14, 2014, 9:02 p.m.
On Tue, 2013-12-31 at 00:56 -0800, Chris Jerdonek wrote:
> # HG changeset patch
> # User Chris Jerdonek <chris.jerdonek@gmail.com>
> # Date 1388479036 28800
> #      Tue Dec 31 00:37:16 2013 -0800
> # Node ID 17bfa5d7637f2d312e6cf375d937d6de6de931d2
> # Parent  4274eda143cb1025be1130ffdaaf62370a2a6961
> debuginstall: add Python information to debuginstall output (issue4128)
> 
> This change adds to the output of "hg debuginstall" information about the
> Python being used by Mercurial.  It adds both the path to the Python
> executable (i.e. the value of sys.executable) and the version of Python
> (specifically the major, minor, and micro versions).

Queued for default, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -9,6 +9,7 @@ 
 from lock import release
 from i18n import _
 import os, re, difflib, time, tempfile, errno
+import sys
 import hg, scmutil, util, revlog, copies, error, bookmarks
 import patch, help, encoding, templatekw, discovery
 import archival, changegroup, cmdutil, hbisect
@@ -2056,7 +2057,10 @@ 
         ui.write(_(" (check that your locale is properly set)\n"))
         problems += 1
 
-    # Python lib
+    # Python
+    ui.status(_("showing Python executable (%s)\n") % sys.executable)
+    ui.status(_("showing Python version (%s)\n")
+              % ("%s.%s.%s" % sys.version_info[:3]))
     ui.status(_("checking Python lib (%s)...\n")
               % os.path.dirname(os.__file__))
 
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -1,6 +1,8 @@ 
 hg debuginstall
   $ hg debuginstall
   checking encoding (ascii)...
+  showing Python executable (*) (glob)
+  showing Python version (2.*) (glob)
   checking Python lib (*lib*)... (glob)
   checking installed modules (*mercurial)... (glob)
   checking templates (*mercurial?templates)... (glob)
@@ -11,6 +13,8 @@ 
 hg debuginstall with no username
   $ HGUSER= hg debuginstall
   checking encoding (ascii)...
+  showing Python executable (*) (glob)
+  showing Python version (2.*) (glob)
   checking Python lib (*lib*)... (glob)
   checking installed modules (*mercurial)... (glob)
   checking templates (*mercurial?templates)... (glob)