openSUSE / py2pack

Generate distribution packages from PyPI
Apache License 2.0
69 stars 40 forks source link

troubles finding licenses #209

Closed MeggyCal closed 1 week ago

MeggyCal commented 2 weeks ago

Hi, thank you very much for maintaining this wonderful tool, it helps me a lot. However, I have run into an issue lately when packaging new python module:

meggy@pascal:~/buildservice/home:mcalabkova:branches:devel:languages:python:numeric/python-trubar $ py2pack generate trubar
generating spec file for trubar...
Traceback (most recent call last):
  File "/usr/bin/py2pack", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/py2pack/__init__.py", line 436, in main
    args.func(args)
  File "/usr/lib/python3.11/site-packages/py2pack/__init__.py", line 327, in generate
    _augment_data_from_tarball(args, tarball_file[0], data)
  File "/usr/lib/python3.11/site-packages/py2pack/__init__.py", line 247, in _augment_data_from_tarball
    data["license_files"].append(_quote_shell_metacharacters(match_license.group(1)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'append'

As you can see in https://github.com/janezd/trubar, the LICENSE file is present and it was present even in the tarball downloaded from PyPI. I was able to generate the spec file elsewhere, but it slowed me down, because I had to fill all the package information by hand. Could you please investigate?

Not all packages suffer from this issue, but some do, I hit this issue again when packaging python-qasync.

danigm commented 1 week ago

Thanks for the report! I've created a PR that should fix the issue, at least it's working with trubar package: https://github.com/openSUSE/py2pack/pull/210

danigm commented 1 week ago

Fixed as part of other PR: https://github.com/openSUSE/py2pack/pull/211