Skip to content

Commit 34da9a3

Browse files
thefourtheyeaddaleax
authored andcommitted
build: make install.py python 3 compatiable
This patch replaces usage of `filter` in such a way that it will be compatible with Python 3. Also, this patch replaces the usage of `map` to do a side-effect work with normal `for` loop. PR-URL: #25583 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
1 parent b2834ce commit 34da9a3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tools/install.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ def try_remove(path, dst):
7272
try_unlink(target_path)
7373
try_rmdir_r(os.path.dirname(target_path))
7474

75-
def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
76-
def uninstall(paths, dst): map(lambda path: try_remove(path, dst), paths)
75+
def install(paths, dst):
76+
for path in paths:
77+
try_copy(path, dst)
78+
79+
def uninstall(paths, dst):
80+
for path in paths:
81+
try_remove(path, dst)
7782

7883
def npm_files(action):
7984
target_path = 'lib/node_modules/npm/'
@@ -85,7 +90,7 @@ def npm_files(action):
8590
# npm has a *lot* of files and it'd be a pain to maintain a fixed list here
8691
# so we walk its source directory instead...
8792
for dirname, subdirs, basenames in os.walk('deps/npm', topdown=True):
88-
subdirs[:] = filter('test'.__ne__, subdirs) # skip test suites
93+
subdirs[:] = [subdir for subdir in subdirs if subdir != 'test']
8994
paths = [os.path.join(dirname, basename) for basename in basenames]
9095
action(paths, target_path + dirname[9:] + '/')
9196

@@ -162,7 +167,7 @@ def ignore_inspector_headers(files, dest):
162167
'deps/v8/include/v8-inspector.h',
163168
'deps/v8/include/v8-inspector-protocol.h'
164169
]
165-
files = filter(lambda name: name not in inspector_headers, files)
170+
files = [name for name in files if name not in inspector_headers]
166171
action(files, dest)
167172

168173
action([

0 commit comments

Comments
 (0)