Skip to content

Commit

Permalink
Portable Python script across Python version
Browse files Browse the repository at this point in the history
ConfigParser module has been renamed as configparser in Python3

Differential Revision: https://reviews.llvm.org/D55200

llvm-svn: 349449
  • Loading branch information
serge-sans-paille-qb committed Dec 18, 2018
1 parent c5d97e3 commit 73cf752
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions clang/tools/scan-view/share/ScanView.py
Expand Up @@ -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.
Expand Down Expand Up @@ -126,7 +129,7 @@ def __init__(self, address, handler, root, reporters, options):
self.load_config()

def load_config(self):
self.config = ConfigParser.RawConfigParser()
self.config = configparser.RawConfigParser()

# Add defaults
self.config.add_section('ScanView')
Expand Down
7 changes: 5 additions & 2 deletions clang/utils/check_cfc/check_cfc.py
Expand Up @@ -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
Expand Down Expand Up @@ -318,7 +321,7 @@ def perform_check(self, arguments, my_env):
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')
Expand Down

0 comments on commit 73cf752

Please sign in to comment.