Hello folks, I'm trying to migrate graphql-server spec file to the newer Python guidelines, but I'm hitting some walls.
- Building the package locally went fine, while on Koji [¹] I get: error: line 39: Unknown tag: %pyproject_extras_subpkg -n python3-graphql-server flask webob aiohttp
- The example spec file in the guidelines says to use the %tox macro, but I cannot test it locally, because I get: tox: error: unrecognized arguments: --current-env
- graphql-server has a [flask] extra, but in beta4 it requires Flask<1, while in Fedora we have Flask>1... should I remove the extra by obsoleting it? How to properly do so for an extra, considering that all previous Provides were generated automatically?
Thanks in advance for the help. Mattia
[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=74321415
On Sun, 22 Aug 2021 at 06:06, Mattia Verga mattia.verga@protonmail.com wrote:
Hello folks, I'm trying to migrate graphql-server spec file to the newer Python guidelines, but I'm hitting some walls.
- Building the package locally went fine, while on Koji [¹] I get:
error: line 39: Unknown tag: %pyproject_extras_subpkg -n python3-graphql-server flask webob aiohttp
The extras macro expands to %package, %description, and %files; you have put it in between a %package and %description, which will surely confuse rpm somewhat.
- The example spec file in the guidelines says to use the %tox macro, but I cannot test it locally, because I get:
tox: error: unrecognized arguments: --current-env
You need to ensure that tox is installed as well, if it isn't listed in upstream's requirements to get pulled in by %pyproject_buildrequires.
- graphql-server has a [flask] extra, but in beta4 it requires Flask<1, while in Fedora we have Flask>1... should I remove the extra by obsoleting it? How to properly do so for an extra, considering that all previous Provides were generated automatically?
I asked a similar question earlier: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproje...
But maybe you try removing the pin? Flask 2 did break things, but it may not have broken your package.
Thanks in advance for the help. Mattia
[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=74321415
On Sun, 22 Aug 2021 at 06:06, Mattia Verga <mattia.verga(a)protonmail.com> wrote:
The extras macro expands to %package, %description, and %files; you have put it in between a %package and %description, which will surely confuse rpm somewhat.
Oh, I've missed that. Thanks.
You need to ensure that tox is installed as well, if it isn't listed in upstream's requirements to get pulled in by %pyproject_buildrequires.
I'll try adding the missing BuildReqs (I suppose `%pyproject_buildrequires -t` should be enough), then I'll have to have a look on how tox works... from a quick look to the tox config file, it seems that there are many environments specified, some of them are related to code linting. In the Guidelines I see these should be skipped, I'll need to find out how to do that.
I asked a similar question earlier: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedorapr...
But maybe you try removing the pin? Flask 2 did break things, but it may not have broken your package.
I don't know why upstream has pinned that requirement, the commit says it was for "fixing tests"... I'll try to ask upstream.
Thank you
On 24. 08. 21 18:47, Mattia Verga wrote:
On Sun, 22 Aug 2021 at 06:06, Mattia Verga <mattia.verga(a)protonmail.com> wrote:
The extras macro expands to %package, %description, and %files; you have put it in between a %package and %description, which will surely confuse rpm somewhat.
Oh, I've missed that. Thanks.
Longer explanation: I was lazy to introduce the pyproject-srpm-macros subpackage that is always installed. Hence none of the pyproject macros is available in the buildroot when the SRPM is being created in Koji.
When the SRPM macro is created, %pyproject_extras_subpkg macro expands to literal "%pyproject_extras_subpkg ...". And depending on where you put this macro into the spec, it might tell you "Unknown tag: %pyproject_extras_subpkg ...".
The documentation/README says:
The macro should be placed after the base package's %description to avoid issues in building the SRPM.
It is a trick, because when the SRPM is created without the macros installed, it will literally put the "%pyproject_extras_subpkg ..." line into the base package's description.
I guess this is fragile and I should bite the bullet and create pyproject-srpm-macros.
You need to ensure that tox is installed as well, if it isn't listed in upstream's requirements to get pulled in by %pyproject_buildrequires.
I'll try adding the missing BuildReqs (I suppose `%pyproject_buildrequires -t` should be enough), then I'll have to have a look on how tox works...
Yes, documentation/README for the %tox macro says:
In case you want to run the tests as specified in tox configuration, you must use %pyproject_buildrequires with -t or -e as explained above.
Using %tox without %pyproject_buildrequires -t/-e is not supported.
from a quick look to the tox config file, it seems that there are many environments specified, some of them are related to code linting. In the Guidelines I see these should be skipped, I'll need to find out how to do that.
You don't skip environments, you explicitly select them.
When running %pyproject_buildrequires -t, the default environment is %{default_toxenv}, i.e. py310 on rawhide. If you want different environment(s), you pass them to %pyproject_buildrequires -e. E.g.:
%pyproject_buildrequires -e %{default_toxenv}-foo,%{default_toxenv}-bar
And %tox will run those.
If that is not enough and you want to run different environments in %check, you can also pass -e directly to %tox:
# Install dependencies from pypy310-foo: %pyproject_buildrequires -e %{default_toxenv}-foo ... # But run tests from pypy310-bar: %tox -e %{default_toxenv}-bar
However, graphql-server has one thing in tox.init hat we cannot support: it calls pip install directly:
https://github.com/graphql-python/graphql-server/blob/1ccebee8c6102f2855bcf6...
This will fail in rpmbuild and if you want to run %tox, you need to patch/sed it out.
I asked a similar question earlier: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedorapr...
My answer there hopefully provides more info.
python-devel@lists.fedoraproject.org