Skip to content

Commit 259fb78

Browse files
committed
SwiftBuildSupport.py: Python 3 compatibility fixes
This change allows me to get `update-checkout` and `build-script` running with Python 3.
1 parent 7576a91 commit 259fb78

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

utils/SwiftBuildSupport.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
from __future__ import print_function
1212

13-
import ConfigParser
13+
try:
14+
import ConfigParser # Python 2
15+
except ImportError:
16+
import configparser as ConfigParser # Python 3
17+
1418
import os
1519
import pipes
1620
import subprocess
@@ -132,7 +136,7 @@ def _get_preset_options_impl(config, substitutions, preset_name):
132136
for o in config.options(section_name):
133137
try:
134138
a = config.get(section_name, o)
135-
except ConfigParser.InterpolationMissingOptionError, e:
139+
except ConfigParser.InterpolationMissingOptionError as e:
136140
# e.reference contains the correctly formatted option
137141
missing_opts.append(e.reference)
138142
continue

0 commit comments

Comments
 (0)