]> granicus.if.org Git - python/commitdiff
bpo-30871: pythoninfo: add expat and _decimal (#3121)
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 17 Aug 2017 20:13:11 +0000 (22:13 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Aug 2017 20:13:11 +0000 (22:13 +0200)
* bpo-30871: pythoninfo: add expat and _decimal

* Remove _decimal.__version__

The string is hardcoded, not really interesting.

Lib/test/pythoninfo.py

index 03081b6dddccde4b77da1c0a218d8cfce8c757a7..e05411353319d8b42e7807095e880fc923a2d3fc 100644 (file)
@@ -345,6 +345,26 @@ def collect_zlib(info_add):
     copy_attributes(info_add, zlib, 'zlib.%s', attributes)
 
 
+def collect_expat(info_add):
+    try:
+        from xml.parsers import expat
+    except ImportError:
+        return
+
+    attributes = ('EXPAT_VERSION',)
+    copy_attributes(info_add, expat, 'expat.%s', attributes)
+
+
+def collect_decimal(info_add):
+    try:
+        import _decimal
+    except ImportError:
+        return
+
+    attributes = ('__libmpdec_version__',)
+    copy_attributes(info_add, _decimal, '_decimal.%s', attributes)
+
+
 def collect_info(info):
     error = False
     info_add = info.add
@@ -365,6 +385,8 @@ def collect_info(info):
         collect_time,
         collect_tkinter,
         collect_zlib,
+        collect_expat,
+        collect_decimal,
     ):
         try:
             collect_func(info_add)