fedora-python/pyp2rpm

Handle cases with pyproject.toml but no setup.py

jfhbrook opened this issue · 8 comments

I've been kicking the tires on COPR's automatic pypi feature, which uses this project to generate spec files. When trying it out with mdformat I get this error:

Running: which pyp2rpm

cmd: ['which', 'pyp2rpm']
cwd: .
rc: 0
stdout: /usr/bin/pyp2rpm
stderr: 

Running: pyp2rpm mdformat -t fedora --srpm -d /var/lib/copr-rpmbuild/results -b 3

cmd: ['pyp2rpm', 'mdformat', '-t', 'fedora', '--srpm', '-d', '/var/lib/copr-rpmbuild/results', '-b', '3']
cwd: .
rc: 3
stdout: INFO  Pyp2rpm initialized.
INFO  Using /var/lib/copr-rpmbuild/results as directory to save source.
INFO  Downloaded package from PyPI: /var/lib/copr-rpmbuild/results/mdformat-0.7.11.tar.gz.
INFO  Getting metadata from setup.py using SetupPyMetadataExtractor.
stderr: setup.py not found, maybe /var/lib/copr-rpmbuild/results/mdformat-0.7.11.tar.gz is not proper source archive.

Copr build error: setup.py not found, maybe /var/lib/copr-rpmbuild/results/mdformat-0.7.11.tar.gz is not proper source archive.

I believe the issue is that somewhere around PEP 621 it became plausible for a package to have a pyproject.toml but not a setup.py. This is certainly the case with mdformat.

This may be a bigger issue - support pyproject.toml at all - but sticking to the scope of the bug report for now.

Actually, PEP 517.

This might also be a case where work is needed outside of pyp2rpm... If I manually create a modern fedora spec for the mdformat module and try to build it, the process fails while getting buildrequires:

Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.bcI8X8
...
/usr/bin/python3 -m tox --print-deps-to /tmp/tmpv0w1mh8n --print-extras-to /tmp/tmplkq6mdp0 --no-provision /tmp/tmpe027hh6m -qre py310
...
tox.exception.ConfigError: ConfigError: Either whitelist_externals or allowlist_externals might be specified, not both

I'm not sure at the moment if that's a bug in tox, or a bug in mdformat's pyproject.toml file.

Oh my! my guess is that they're synonyms and that tox started validating it better more recently. At a minimum it sounds like there's a simple to reproduce and simple to fix bug with the pyproject.toml file. I can probably take and run with that in the next few days if mdformat is on github. Maybe I can get a patch in-flight

I think there may be a misunderstanding on my part, given the copr output. Are we triggering the same code path and the copr log is just obscuring that? Or perhaps copr is running an old version of pyp2rpm? If the latter, I can follow up with the copr project on pagure.

I've been distracted but I've also been meaning to reproduce this locally - I just haven't gotten to it, and if this thing I'm running into is someone else's problem I feel bad for knocking!

This sounds like fedora-python/tox-current-env#45 -- I'll make sure it's fixed soon.

I think there may be a misunderstanding on my part, given the copr output. Are we triggering the same code path and the copr log is just obscuring that?

No, we're not. The error you're reporting is a feature that pyp2rpm needs, and any module that has only pyproject.toml in the fashion that you reported. I'm noting that mdformat might not be an ideal example of such a module because once pyp2rpm produces a spec in the modern format, the resulting build will still fail, so we can't do an end-to-end test using that module.

This sounds like fedora-python/tox-current-env...

I'll follow that bug, as well. Thanks, @hroncok

Hello,
I have this example which doesn't provide setup.py:

pyp2rpm pyproject-metadata
setup.py not found, maybe /home/yves/rpmbuild/SOURCES/pyproject-metadata-0.5.0.tar.gz is not proper source archive.

Any news on this? setup.py is deprecated and new support for pyproject.toml is a must to keep this project alive.
Or is this project already dead?