Package: python3-grpc-tools
Version: 1.14.1-8
Severity: important
X-Debbugs-Cc: [email protected]

Hi,

I believe I have encountered a bug in the python3-grpc-tools package, while
working on packaging BuildStream 2.7.0 which depends on it at build-time.

I have seen all calls to the grpc_tools.command.build_package_protos method
failing with a Python TypeError, regardless of the argument. For example, with
an arbitrary path in a Python REPL:

```
theodore@localhost:~$ python3
Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from grpc_tools import command
>>> command.build_package_protos("/tmp")
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    command.build_package_protos("/tmp")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib/python3/dist-packages/grpc_tools/command.py", line 33, in 
build_package_protos
    well_known_protos_include = files('grpc_tools').joinpath('_proto')
                                ~~~~~^^^^^^^^^^^^^^
TypeError: 'list' object is not callable
>>>
```

>From what I can tell, this is because of a syntax error in the upstream Python
code in Python 3.13: 
https://sources.debian.org/src/python-grpc-tools/1.14.1-8/grpc_tools/command.py.
 Looking at line 33, the files method from importlib is shadowed by
the files loop variable from line 27.

In my BuildStream packaging, I have worked around this with a patch to vendor
build_package_protos with the syntax error corrected: 
https://salsa.debian.org/tti0/buildstream-fork/-/blob/tti0/buildstream-2/debian/patches/setup.py-Vendor-grpc_tools.command.build_package_protos.patch.
 I'm quite new to the Debian project, though, so am
unsure whether such a patch would be appropriate in the python3-grpc-tools
packaging.

I have seen the same bug in both trixie and unstable.

Thank you and kind regards,

Theodore

-- System Information:
Debian Release: 13.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.6.87.2-microsoft-standard-WSL2 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python3-grpc-tools depends on:
ii  libc6             2.41-12+deb13u2
ii  libgcc-s1         14.2.0-19
ii  libstdc++6        14.2.0-19
ii  python3           3.13.5-1
ii  python3-grpcio    1.51.1-6
ii  python3-protobuf  3.21.12-11

python3-grpc-tools recommends no packages.

python3-grpc-tools suggests no packages.

-- no debconf information

Reply via email to