Skip to content

Commit 1c7f6a5

Browse files
thefourtheyeMylesBorins
authored andcommitted
build: make configure.py compatible with python 3
This patch replaces the following 1. Usage of `filter` with `None` to remove falsy items. 2. Usage of `map` to create lists. (Replaced with List comprehensions). 3. Dictionary's `iteritems` which is removed in Python 3. PR-URL: #25580 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent b31035d commit 1c7f6a5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

configure.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1135,8 +1135,8 @@ def configure_library(lib, output):
11351135
if options.__dict__[shared_lib + '_includes']:
11361136
output['include_dirs'] += [options.__dict__[shared_lib + '_includes']]
11371137
elif pkg_cflags:
1138-
output['include_dirs'] += (
1139-
filter(None, map(str.strip, pkg_cflags.split('-I'))))
1138+
stripped_flags = [flag.strip() for flag in pkg_cflags.split('-I')]
1139+
output['include_dirs'] += [flag for flag in stripped_flags if flag]
11401140

11411141
# libpath needs to be provided ahead libraries
11421142
if options.__dict__[shared_lib + '_libpath']:
@@ -1152,7 +1152,7 @@ def configure_library(lib, output):
11521152
output['libraries'] += [pkg_libpath]
11531153

11541154
default_libs = getattr(options, shared_lib + '_libname')
1155-
default_libs = map('-l{0}'.format, default_libs.split(','))
1155+
default_libs = ['-l{0}'.format(lib) for lib in default_libs.split(',')]
11561156

11571157
if default_libs:
11581158
output['libraries'] += default_libs
@@ -1375,7 +1375,8 @@ def write_config(data, name):
13751375
# safe to split, cannot contain spaces
13761376
o['libraries'] += libs.split()
13771377
if cflags:
1378-
o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I')))
1378+
stripped_flags = [flag.strip() for flag in cflags.split('-I')]
1379+
o['include_dirs'] += [flag for flag in stripped_flags if flag]
13791380
# use the "system" .gyp
13801381
o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
13811382
return
@@ -1656,7 +1657,7 @@ def make_bin_override():
16561657
if options.prefix:
16571658
config['PREFIX'] = options.prefix
16581659

1659-
config = '\n'.join(map('='.join, config.iteritems())) + '\n'
1660+
config = '\n'.join(['='.join(item) for item in config.items()]) + '\n'
16601661

16611662
# On Windows there's no reason to search for a different python binary.
16621663
bin_override = None if sys.platform == 'win32' else make_bin_override()

0 commit comments

Comments
 (0)