Skip to content

distribute_setup.py uses private API (Tarfile.chown) which is now deprecated, breaking it. (Source builds won't work on Modern Pythons) #376

@JamesParrott

Description

@JamesParrott

Reliance on 'private' methods (especially nominally private ones in Python) will always result in brittleness.
But ever since Python 3.5, Tarfile.chown has required a third argument (Here is the old version in Python 3.4

The call to it in distribute_setup.py only supplies two:

self.chown(tarinfo, dirpath)

There's a dependency on the now deprecated (in Python 3.12) pkg_resources too.

Build failure (uv Python 3.13.5, Debian Trixie (12), 6.18.x kernel. I know it's not supported, but this bug will still hit others):

debian@beaglebone:~$ uv pip install Adafruit_BBIO
Using Python 3.13.5 environment at: spi_venv
  x Failed to build `adafruit-bbio==1.2.0`
  |-> The build backend returned an error
  `-> Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stderr]
      Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.6.45.tar.gz
      Extracting in /tmp/tmp5t1_d4y9
      Traceback (most recent call last):
        File "/home/debian/.cache/uv/sdists-v9/pypi/adafruit-bbio/1.2.0/NI_RcoFb0ny5jn2yTPZ3X/src/distribute_setup.py",
      line 146, in use_setuptools
          import pkg_resources
      ModuleNotFoundError: No module named 'pkg_resources'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 14, in <module>
          requires = get_requires_for_build({})
        File "/home/debian/.cache/uv/builds-v0/.tmpoPgFdR/lib/python3.13/site-packages/setuptools/build_meta.py", line
      333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])

...


        File "/home/debian/.cache/uv/sdists-v9/pypi/adafruit-bbio/1.2.0/NI_RcoFb0ny5jn2yTPZ3X/src/distribute_setup.py",
      line 510, in _extractall
          self.chown(tarinfo, dirpath)
          ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
      TypeError: TarFile.chown() missing 1 required positional argument: 'numeric_owner'

      hint: This usually indicates a problem with the package or the build environment.
(venv) debian@beaglebone:~$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions