Hi all,
First, is it possible to use this macro if the pyproject.toml isn't in the root directory of the package? There doesn't seem to be an option to specify a path, so I tried cd'ing into a path and running it, but it seemed to run into an odd error like it was trying to include my directory as a package.
Second, can %pyproject_buildrequires (and the other %pyproject_ macros) be used multiple times in a package? I have a package that has multiple pyproject.toml files in it (but that's mostly a legacy thing, so I could probably separate them into multiple RPMs).
Thanks, Scott
On 13. 09. 23 5:03, Scott Talbert wrote:
Hi all,
Hi Scott.
First, is it possible to use this macro if the pyproject.toml isn't in the root directory of the package? There doesn't seem to be an option to specify a path, so I tried cd'ing into a path and running it, but it seemed to run into an odd error like it was trying to include my directory as a package.
You can do this, but you MUST NOT put anything to the standard output. E.g. if you do this:
%generate_buildrequires cd subdir %pyproject_buildrequires
It'll work properly. However, if you do:
%generate_buildrequires cd subdir %pyproject_buildrequires cd -
It will generate a dependency on something like /builddir/build/BUILD/pkg-1.2.3 because that is what `cd -` prints to standard output. Same with pushd and popd.
The solution is to use >&2 when runnign such commands in %generate_buildrequires. For example:
%generate_buildrequires pushd pkg1 >&2 %pyproject_buildrequires popd >&2 pushd pkg2 >&2 %pyproject_buildrequires popd >&2
Second, can %pyproject_buildrequires (and the other %pyproject_ macros) be used multiple times in a package? I have a package that has multiple pyproject.toml files in it (but that's mostly a legacy thing, so I could probably separate them into multiple RPMs).
Yes, but %pyproject_insatll SHOULD only be used once (it will install everything, running it multiple times is redundant) and %pyproject_save_files will not work at all.
%build pushd pkg1 %pyproject_wheel popd pushd pkg2 %pyproject_wheel popd
%install # this will install both wheels: %pyproject_install # we cannot use %%pyproject_save_files here # because mixing files from multiple wheels is not supported
On Wed, 13 Sep 2023, Miro Hrončok wrote:
On 13. 09. 23 5:03, Scott Talbert wrote:
Hi all,
Hi Scott.
First, is it possible to use this macro if the pyproject.toml isn't in the root directory of the package? There doesn't seem to be an option to specify a path, so I tried cd'ing into a path and running it, but it seemed to run into an odd error like it was trying to include my directory as a package.
You can do this, but you MUST NOT put anything to the standard output. E.g. if you do this:
%generate_buildrequires cd subdir %pyproject_buildrequires
It'll work properly. However, if you do:
%generate_buildrequires cd subdir %pyproject_buildrequires cd -
It will generate a dependency on something like /builddir/build/BUILD/pkg-1.2.3 because that is what `cd -` prints to standard output. Same with pushd and popd.
The solution is to use >&2 when runnign such commands in %generate_buildrequires. For example:
%generate_buildrequires pushd pkg1 >&2 %pyproject_buildrequires popd >&2 pushd pkg2 >&2 %pyproject_buildrequires popd >&2
Second, can %pyproject_buildrequires (and the other %pyproject_ macros) be used multiple times in a package? I have a package that has multiple pyproject.toml files in it (but that's mostly a legacy thing, so I could probably separate them into multiple RPMs).
Yes, but %pyproject_insatll SHOULD only be used once (it will install everything, running it multiple times is redundant) and %pyproject_save_files will not work at all.
%build pushd pkg1 %pyproject_wheel popd pushd pkg2 %pyproject_wheel popd
%install # this will install both wheels: %pyproject_install # we cannot use %%pyproject_save_files here # because mixing files from multiple wheels is not supported
Perfect, thanks Miro!
Scott
python-devel@lists.fedoraproject.org