befeleme / pyp2spec

Generate Fedora RPM spec files for Python packages
MIT License
11 stars 4 forks source link

Failed to run %check secion #31

Open pkking opened 1 year ago

pkking commented 1 year ago

What i run:

pyp2spec -t types-toml
spectool -RSg python-types-toml.spec
rpmbuild -br python-types-toml.spec
yum-builddep /root/rpmbuild/SRPMS/python-types-toml-0.10.8.1-1.fc35.src.rpm 
rpmbuild -ba python-types-toml.spec

And i got:

+ cd types-toml-0.10.8.1                                                                                                                                                                                                                    
+ '[' '!' -f /root/rpmbuild/BUILD/python-types-toml-0.10.8.1-1.fc35.x86_64-pyproject-modules ']'                                                                                                                                            
+ PATH=/root/rpmbuild/BUILDROOT/python-types-toml-0.10.8.1-1.fc35.x86_64/usr/bin:/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin                                                                    
+ PYTHONPATH=/root/rpmbuild/BUILDROOT/python-types-toml-0.10.8.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages:/root/rpmbuild/BUILDROOT/python-types-toml-0.10.8.1-1.fc35.x86_64/usr/lib/python3.10/site-packages                        
+ _PYTHONSITE=/root/rpmbuild/BUILDROOT/python-types-toml-0.10.8.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages:/root/rpmbuild/BUILDROOT/python-types-toml-0.10.8.1-1.fc35.x86_64/usr/lib/python3.10/site-packages                       
+ PYTHONDONTWRITEBYTECODE=1                                                                                                                                                                                                                 
+ /usr/bin/python3 -s /usr/lib/rpm/redhat/import_all_modules.py -f /root/rpmbuild/BUILD/python-types-toml-0.10.8.1-1.fc35.x86_64-pyproject-modules -t                                                                                       
Traceback (most recent call last):                                                                                                                                                                                                          
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>                                                                                                                                                                   
    main()                                                                                                                                                                                                                                  
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 163, in main                                                                                                                                                                       
    modules = read_modules_from_all_args(cli_args)                                                                                                                                                                                          
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 89, in read_modules_from_all_args                                                                                                                                                  
    raise ValueError('No modules to check were left')                                                                                                                                                                                       
ValueError: No modules to check were left                                                                                                                                                                                                   
error: Bad exit status from /var/tmp/rpm-tmp.nsCKMQ (%check) 
befeleme commented 1 year ago

It looks like this project only contains the typing stubs (.pyi files, not .py) so there's nothing to import during the %check phase of the package build. To build the package as RPM you should edit the generated python-types-toml.spec file and remove the %check section entirely.

hroncok commented 1 year ago

FTR we tried to mitigate a similar but different issue via https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/fa49bf2efbcb01e9b80a592d24073e1afa6acd0c?branch=rawhide

befeleme commented 1 year ago

True. To make the build of such packages seamless, we could change the behavior of %pyproject_check_import and accept it when it doesn't detect any modules. I wouldn't make it default though, this could be something possible to use in related projects, similarly like pyp2spec invokes %pyproject_save_files '*' +auto but forbidden in the actual distribution.

hroncok commented 1 year ago

Possibly. That would enable automatic copr build of packages without Python modules.