bazel-contrib / bazel-contrib/rules_python

pre-compile is failing with `aenum` package

Open
#2,701 3 comments 0 reactions 0 assignees View on GitHub
core-rules type: bug
Dominant language
Starlark
Stars
688
Forks
721
Avg merge
14h 49m
Merged PRs (30d)
81

Description

The part of error log:
```
pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/__pycache__/_py2.cpython-311.pyc
```

It seems that the wheel that I am using is https://files.pythonhosted.org/packages/d0/fa/ca0c66b388624ba9dbbf35aab3a9f326bfdf5e56a7237fe8f1b600da6864/aenum-3.1.15-py3-none-any.whl#sha256=e0dfaeea4c2bd362144b87377e2c61d91958c5ed0b4daf89cb6f45ae23af6288

The precompile config setting was set to `enabled` and I was using the latest `rules_python 1.3.0rc1` on a mac host.

One of the errors:
```
ERROR: /private/var/tmp/_bazel_ignas.anikevicius/b76e964649685d10d1a2df959fae69ae/external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/BUILD.bazel:5:20: Python precompiling site-packages/aenum/_py2.py into external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/__pycache__/_py2.cpython-311.pyc failed: (Exit 3): python3 failed: error executing PyCompile command (from target @@rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea//:pkg) bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/python/private/python3 ... (remaining 2 arguments skipped)
Unhandled error:
Request: {'arguments': ['--invalidation_mode', 'checked_hash', '--src', 'external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/_py2.py', '--src_name', '../rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/_py2.py', '--pyc', 'bazel-out/darwin_x86_64-fastbuild-ST-5be17bb44133/bin/external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/__pycache__/_py2.cpython-311.pyc', '--optimize', '0', '--python_version', '3.11'], 'inputs': [{'path': 'external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/_py2.py', 'digest': 'NjEyMWE3MDRjZWRmZWVhNTkwNmRkNjc5NGQ4ODE1YzE3N2VhNDI0Nzc1MWIxNWJhNTQ1NzcxZWI1Y2RmNmQ2ZA=='}, {'path': 'bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/python/private/python3', 'digest': 'MDE5MTZjMzRmYTg4ZjA1MjIwNTg2NDJjZTBkYTI0YzdhZTExNjlhMTljZjIwZTlhMGE0NGIxMDAzYzY5MDVjNA=='}, {'path': 'bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/precompiler/precompiler', 'digest': 'MzUyYWNhMDkzMjljOTVmY2UxMTQzOTI2NmM0YzhiODgwMmU4YTcyNDYxOWFjMzk0Y2M3MGZjODIxYjhlY2FhNg=='}, {'path': 'bazel-out/darwin_x86_64-fastbuild-ST-5be17bb44133/bin/external/rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/__pycache__/_py2.cpython-311.pyc-0.params', 'digest': 'YjlkM2VkZTUwNDAwZTEyMjUzZDQyYmUyYTAwNWE2ZTk3MzUyZjQ3YzJiNmVjODk3M2JmNmI5MTY4NDRmYmI4NQ=='}], 'requestId': 3315}
Traceback (most recent call last):
File "/private/var/tmp/_bazel_ignas.anikevicius/b76e964649685d10d1a2df959fae69ae/external/rules_python++python+python_3_11_x86_64-apple-darwin/lib/python3.11/py_compile.py", line 144, in compile
code = loader.source_to_code(source_bytes, dfile or file,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1004, in source_to_code
File "", line 241, in _call_with_frames_removed
File "../rules_python++pip+pypi_311_aenum_py3_none_any_e0dfaeea/site-packages/aenum/_py2.py", line 5
raise exc, None, tb
^
SyntaxError: invalid syntax
```

And the contents of this file are:
```from operator import div as _div_
from inspect import getargspec

def raise_with_traceback(exc, tb):
raise exc, None, tb

__all__ = ['_div_', 'getargspec', 'raise_with_traceback']
```

I understand that I can patch the wheel to exclude the file, but I am curious what the user is expected to do in this case.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.