openSUSE / py2pack

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

TypeError: unsupported operand type(s) for +: 'generator' and 'list' #151

Closed coogor closed 2 years ago

coogor commented 3 years ago

generating a spec file for the below package results in a python dump

py2pack 0.8.6 on TW

`docb@X1E:~/buildservice/Application:ERP:Tryton:6.0/trytond>` py2pack generate -t opensuse.spec trytond
generating spec file for trytond...
Traceback (most recent call last):
  File "/usr/bin/py2pack", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/py2pack/__init__.py", line 365, in main
    args.func(args)
  File "/usr/lib/python3.8/site-packages/py2pack/__init__.py", line 264, in generate
    result = template.render(data).encode('utf-8')                          # render template and encode properly
  File "/usr/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/usr/lib/python3.8/site-packages/py2pack/templates/opensuse.spec", line 83, in top-level template code
    {%- set scripts_or_console_scripts = (
TypeError: unsupported operand type(s) for +: 'generator' and 'list' `
coogor commented 3 years ago

same error for package csb43

fpesari commented 3 years ago

Same problem here. I doubt it depends on a specific target package and it's very serious, since it prevents py2pack from working. I think the error is here https://github.com/openSUSE/py2pack/blob/master/py2pack/templates/opensuse.spec#L84

You can't use the + operator on a generator and a list, you have to call list(generator) before doing it.

Edit: 0.8.7 fixes it on my system. 0.8.6 is still in the official openSUSE repos, however

mcepl commented 2 years ago

Edit: 0.8.7 fixes it on my system. 0.8.6 is still in the official openSUSE repos, however

OK, then problem is not in this repo, but that we haven’t updated yet. And 0.8.7 is in Factory anyway.