Using pyproject macros when setup.py isn't in root directory

2025-07-08 Thread Scott Talbert via python-devel
Is there any way to use the pyproject macros when setup.py isn't in the 
root directory?


I maintain a couple of packages where this is the case - one where there 
are actually two PyPI packages built from the same source package, and 
another where the Python package is in a subdirectory because it's 
bindings for a C library that is also built.


When I try, I get this error during build:
+ echo 'ERROR: Neither pyproject.toml nor setup.py found, consider using 
%pyproject_buildrequires -N  if this is not a Python 
package.'
ERROR: Neither pyproject.toml nor setup.py found, consider using 
%pyproject_buildrequires -N  if this is not a Python 
package.


There aren't requirements files in the upstream packages.  But I guess I 
could make a downstream one?


Thanks,
Scott
--
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Using pyproject macros when setup.py isn't in root directory

2025-07-09 Thread Scott Talbert via python-devel

On Wed, 9 Jul 2025, Miro Hrončok via python-devel wrote:


On 09. 07. 25 4:31, Scott Talbert via python-devel wrote:
Is there any way to use the pyproject macros when setup.py isn't in the 
root directory?


I maintain a couple of packages where this is the case - one where there 
are actually two PyPI packages built from the same source package, and 
another where the Python package is in a subdirectory because it's bindings 
for a C library that is also built.


When I try, I get this error during build:
+ echo 'ERROR: Neither pyproject.toml nor setup.py found, consider using 
%pyproject_buildrequires -N  if this is not a Python 
package.'
ERROR: Neither pyproject.toml nor setup.py found, consider using 
%pyproject_buildrequires -N  if this is not a Python 
package.


There aren't requirements files in the upstream packages.  But I guess I 
could make a downstream one?
This is only useful when you want to use an exiting requirements file in a 
piece of software that is *not* a Python package. Which the macro thinks is 
your case, as it did not find a pyproject.toml or a setup.py file.


To locate the files, simply cd to the directory before using the macro.

 %generate_buildrequires
 cd subdirectory
 %pyproject_buildrequires

 %build
 ...
 cd subdirectory
 %pyproject_wheel

Note: Make sure not to use pushd or cd - without >&2 in 
%pyproject_buildrequires, as those commands put output on the stdout and all 
stdout is considered as generated BuildRequires.


Thanks for these hints.  This all worked.

The one thing - %pyproject_save_files can't work in the case of building 
multiple wheels in the same package, right?


Scott-- 
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Using pyproject macros when setup.py isn't in root directory

2025-07-10 Thread Scott Talbert via python-devel

On Thu, 10 Jul 2025, Miro Hrončok wrote:


On 10. 07. 25 2:45, Scott Talbert wrote:


The one thing - %pyproject_save_files can't work in the case of building 
multiple wheels in the same package, right?


Correct. As ow now, it has no API to say "save files from package X", so when 
multiple wheels are installed in %pyproject_install, we bail out and no 
longer allow %pyproject_save_files.


Obviously, this is somethign we could design, but the amount of such spec 
files in Fedora is rather low, and they can function with manual %file 
section.


Thanks, I agree, no need to design for such a limited use case.

Scott-- 
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue