Skip to content

Commit

Permalink
build: using pymod_do_main in node.gyp
Browse files Browse the repository at this point in the history
GYP uses the system path when parsing node.gyp;
However, if system python is different from our
gyp runtime python, like '2.7', gyp would crash.
  • Loading branch information
himself65 committed Jul 7, 2021
1 parent 4de6f20 commit 842c8a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Windows command length limit or there would be an error.
# See https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation
'library_files': [
'<!@(python tools/search_files.py --ext js lib)',
'<!@pymod_do_main(search_files --ext js lib)',
],
'deps_files': [
'deps/v8/tools/splaytree.mjs',
Expand Down
1 change: 1 addition & 0 deletions tools/gyp_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
node_root = os.path.normpath(os.path.join(script_dir, os.pardir))

sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
sys.path.insert(0, os.path.join(node_root, 'tools', 'search_files'))
import gyp

# Directory within which we want all generated files (including Makefiles)
Expand Down
9 changes: 3 additions & 6 deletions tools/search_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
import argparse
import utils

def main():
def DoMain(args = []):
parser = argparse.ArgumentParser(
description='Search files with a specific extension under a directory',
fromfile_prefix_chars='@'
)
parser.add_argument('--ext', required=True, help='extension to search for')
parser.add_argument('directory', help='input directory')
options = parser.parse_args()
print('\n'.join(utils.SearchFiles(options.directory, options.ext)))

if __name__ == "__main__":
main()
options = parser.parse_args(args)
return '\n'.join(utils.SearchFiles(options.directory, options.ext))

0 comments on commit 842c8a9

Please sign in to comment.