vstinner / hachoir

Hachoir is a Python library to view and edit a binary stream field by field
http://hachoir.readthedocs.io/
GNU General Public License v2.0
604 stars 70 forks source link

pip install hachoir[urwid] fails on "recent" setuptools versions #93

Open adrienbeau opened 6 months ago

adrienbeau commented 6 months ago

hachoir[urwid] requires urwid==1.3.1 (released on 2015-11-02) This produces distutils.errors.DistutilsSetupError: use_2to3 is invalid. use_2to3 was indeed removed from setuptools 58 (released on 2021-09-05)

Software environment:

Commands run:

$ python3 -m venv env-hachoir
$ cd env-hachoir
$ . bin/activate
$ pip install hachoir
Successfully installed hachoir-3.3.0
$ pip install hachoir[urwid]
Requirement already satisfied: hachoir[urwid] in ./lib/python3.10/site-packages (3.3.0)
Collecting urwid==1.3.1 (from hachoir[urwid])
  Downloading urwid-1.3.1.tar.gz (588 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  × python setup.py egg_info did not run successfully.
    exit code: 1
      Traceback (most recent call last):
      (...)
      File "/home/(...)/env-hachoir/lib/python3.10/site-packages/setuptools/dist.py", line 139, in invalid_unless_false
          raise DistutilsSetupError(f"{attr} is invalid.")
      distutils.errors.DistutilsSetupError: use_2to3 is invalid.
(...)

A workaround (or solution) is to require a more recent (or most recent) version of urwid.

hachoir-urwid works fine for me with the latest urwid (2.6.7).

vstinner commented 6 months ago

The error comes from urwid, no?

adrienbeau commented 6 months ago

I think it comes from hachoir/setup.py:

        "extras_require": {
            "urwid": [
                "urwid==1.3.1"
            ],

Hachoir specifically requires this exact old version, dating from way before use_2to3 was dropped from setuptools.

More recent versions of urwid do not have this error.

I don't know why hachoir specifically requires version 1.3.1. It seems to work fine with recent versions of urwid.

vstinner commented 6 months ago

I don't know why hachoir specifically requires version 1.3.1. It seems to work fine with recent versions of urwid.

It didn't work with a specific urwid version. I don't recall which one. Do you want to write a change to no longer stick to this version?