Skip to content

Commit 99d16a7

Browse files
thefourtheyeBaochengSu
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: nodejs#25580 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> (cherry picked from commit 26f80dc)
1 parent 0b3ba49 commit 99d16a7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

configure.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,8 @@ def configure_library(lib, output):
993993
if options.__dict__[shared_lib + '_includes']:
994994
output['include_dirs'] += [options.__dict__[shared_lib + '_includes']]
995995
elif pkg_cflags:
996-
output['include_dirs'] += (
997-
filter(None, map(str.strip, pkg_cflags.split('-I'))))
996+
stripped_flags = [flag.strip() for flag in pkg_cflags.split('-I')]
997+
output['include_dirs'] += [flag for flag in stripped_flags if flag]
998998

999999
# libpath needs to be provided ahead libraries
10001000
if options.__dict__[shared_lib + '_libpath']:
@@ -1004,7 +1004,7 @@ def configure_library(lib, output):
10041004
output['libraries'] += [pkg_libpath]
10051005

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

10091009
if default_libs:
10101010
output['libraries'] += default_libs
@@ -1207,7 +1207,8 @@ def write_config(data, name):
12071207
# safe to split, cannot contain spaces
12081208
o['libraries'] += libs.split()
12091209
if cflags:
1210-
o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I')))
1210+
stripped_flags = [flag.strip() for flag in cflags.split('-I')]
1211+
o['include_dirs'] += [flag for flag in stripped_flags if flag]
12111212
# use the "system" .gyp
12121213
o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
12131214
return
@@ -1489,7 +1490,7 @@ def make_bin_override():
14891490
if options.prefix:
14901491
config['PREFIX'] = options.prefix
14911492

1492-
config = '\n'.join(map('='.join, config.iteritems())) + '\n'
1493+
config = '\n'.join(['='.join(item) for item in config.items()]) + '\n'
14931494

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

0 commit comments

Comments
 (0)