dropbox / rules_node

Node rules for Bazel (unsupported)
Apache License 2.0
52 stars 16 forks source link

Rules assume /usr/bin/python is Python 2 #11

Closed JeffCarpenter closed 6 years ago

JeffCarpenter commented 6 years ago

Last night, I decided to build livegrep which uses _rulesnode. Now I could be wrong, but it looks like these rules depend on /usr/bin/python being Python 2. I tried a Python 2 virtual environment, but got the same dictionary item concatenation error. Then when I temporarily linked /usr/bin/python to /usr/bin/python2, the build succeed.

ERROR: /home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/external/org_dropbox_rules_node/npm/webpack/BUILD:7:1: installing node modules from external/org_dropbox_rules_node/npm/webpack/npm-shrinkwrap.json failed (Exit 1)
Traceback (most recent call last):
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 49, in <module>
    main()
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 45, in main
    npm_install(args.shrinkwrap, args.output)
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 27, in npm_install
    run_npm(['install'], env=env, cwd=output)
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/utils.py", line 84, in run_npm
    full_env = dict(full_env.items() + env.items())
TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'
INFO: Elapsed time: 376.399s, Critical Path: 28.67s
INFO: 1395 processes: 1395 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
samertm commented 6 years ago

Thanks for the report! I fixed that specific issue in 74d8aeb40d079acdceb2380af2a72e29613a8fd6. There may be other python3 compatibility issues, though, since I didn't go through all of the python code.

You'll need to update the commit that livegrep uses for the node rules here: https://github.com/livegrep/livegrep/blob/master/WORKSPACE#L125

JeffCarpenter commented 6 years ago

Thank you!