Package: pypi2deb
Version: 4.20240727
Severity: grave
Justification: renders package unusable

Hello,

py2dsp (pypi2debian) doesn't longer work with current dh-python (likely after dh-python 6.20251030)

$ py2dsp -h
Traceback (most recent call last):
  File "/usr/bin/py2dsp", line 32, in <module>
    from pypi2deb.debianize import debianize
  File "/usr/share/pypi2deb/pypi2deb/debianize.py", line 32, in <module>
    from pypi2deb.tools import execute
  File "/usr/share/pypi2deb/pypi2deb/tools.py", line 31, in <module>
    from dhpython.pydist import load, safe_name
ImportError: cannot import name 'safe_name' from 'dhpython.pydist' (/usr/share/dh-python/dhpython/pydist.py)

After changing 'safe_name' for 'normalize_name' it fails further

E: py2dsp py2dsp:173: 'PyDist' object is not subscriptable
Traceback (most recent call last):
  File "/usr/bin/py2dsp", line 171, in <module>
    asyncio.run(main(args))
    ~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/bin/py2dsp", line 77, in main
fname = await download(name, version=requested_version, destdir=args.root) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/pypi2deb/pypi2deb/pypi.py", line 146, in download
    fname = '{}_{}.orig.{}'.format(pkg_name(name), download_version, ext)
                                   ~~~~~~~~^^^^^^
  File "/usr/share/pypi2deb/pypi2deb/tools.py", line 125, in pkg_name
    names = _load_package_names()
  File "/usr/share/pypi2deb/pypi2deb/decorators.py", line 49, in __cache
    res = func(*args, **kwargs)
File "/usr/share/pypi2deb/pypi2deb/tools.py", line 147, in _load_package_names
    result[key.lower()] = details[0]['dependency'].replace('python3-', '')
                          ~~~~~~~~~~^^^^^^^^^^^^^^
TypeError: 'PyDist' object is not subscriptable

The quick fix below allowed to achieve what I needed but I certainly missed other points

        for key in data.keys():
            details = data.get(normalize_name(key))
result[key.lower()] = details[0].dependency.replace('python3-', '')

Thanks for your support

-- System Information:
Debian Release: forky/sid
  APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (450, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.18.3 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pypi2deb depends on:
ii  build-essential  12.12
ii  devscripts       2.26.4
ii  dh-python        7.20251231
ii  python3          3.13.7-1+b1
ii  python3-aiohttp  3.13.3-3
ii  python3-debian   1.0.1
ii  python3-github   2.6.1-1
ii  python3-jinja2   3.1.6-1
ii  python3-redis    6.4.0-1

Versions of packages pypi2deb recommends:
ii  python3-msgpack  1.1.2-1

Versions of packages pypi2deb suggests:
pn  cython              <none>
pn  cython3             <none>
pn  python-all-dev      <none>
pn  python-pytest       <none>
pn  python-setuptools   <none>
ii  python3-all-dev     3.13.7-1+b1
pn  python3-pytest      <none>
ii  python3-setuptools  78.1.1-0.1
ii  python3-sphinx      8.2.3-12

-- no debconf information
Thank you for using reportbug

Reply via email to