[PATCH] D55200: Python 2/3 compat - config parser

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 00:28:38 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL349449: Portable Python script across Python version (authored by serge_sans_paille, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55200?vs=178013&id=178607#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55200/new/

https://reviews.llvm.org/D55200

Files:
  cfe/trunk/tools/scan-view/share/ScanView.py
  cfe/trunk/utils/check_cfc/check_cfc.py


Index: cfe/trunk/tools/scan-view/share/ScanView.py
===================================================================
--- cfe/trunk/tools/scan-view/share/ScanView.py
+++ cfe/trunk/tools/scan-view/share/ScanView.py
@@ -16,7 +16,10 @@
 import itertools
 
 import Reporter
-import ConfigParser
+try:
+    import configparser
+except ImportError:
+    import ConfigParser as configparser
 
 ###
 # Various patterns matched or replaced by server.
@@ -126,7 +129,7 @@
         self.load_config()
 
     def load_config(self):
-        self.config = ConfigParser.RawConfigParser()
+        self.config = configparser.RawConfigParser()
 
         # Add defaults
         self.config.add_section('ScanView')
Index: cfe/trunk/utils/check_cfc/check_cfc.py
===================================================================
--- cfe/trunk/utils/check_cfc/check_cfc.py
+++ cfe/trunk/utils/check_cfc/check_cfc.py
@@ -56,7 +56,10 @@
 import subprocess
 import sys
 import tempfile
-import ConfigParser
+try:
+    import configparser
+except ImportError:
+    import ConfigParser as configparser
 import io
 
 import obj_diff
@@ -318,7 +321,7 @@
     for c in checks:
         default_config += "{} = false\n".format(c)
 
-    config = ConfigParser.RawConfigParser()
+    config = configparser.RawConfigParser()
     config.readfp(io.BytesIO(default_config))
     scriptdir = get_main_dir()
     config_path = os.path.join(scriptdir, 'check_cfc.cfg')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55200.178607.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181218/d1063f92/attachment.bin>


More information about the llvm-commits mailing list