https://bugzilla.redhat.com/show_bug.cgi?id=2278424 --- Comment #14 from Jerry James <loganjerry@xxxxxxxxx> --- I wondered if I could do any better with lua and came up with this, which is even longer than your shell version: %generate_buildrequires %global features %{lua: local f = {} if rpm.expand("%{?with_doc}") == "1" then table.insert(f, "rtd") end if rpm.expand("%{?with_test}") == "1" then table.insert(f, "testing") end if next(f) ~= nil then print("-x ", table.concat(f, ",")) end } %pyproject_buildrequires %features Then I wondered if I could make that more general and came up with this even longer version: %generate_buildrequires %define features(-) %{lua: local myarg = {} for _, v in pairs(arg) do for s, t in string.gmatch(v, "(%w+):(%w+)") do if rpm.expand("%{?with_" .. s .. "}") == "1" then table.insert(myarg, t) end end end if next(myarg) ~= nil then print("-x ", table.concat(myarg, ",")) end } %pyproject_buildrequires %{features test:testing doc:rtd} That second version does NOT work if %global is used instead of %define. I'm not sure why. Anyway, all of these attempts at being general are cute, but ultimately less readable than what I already had in the spec file, I think. It's unlikely that the doc bcond will ever be set to true, so I should probably just rip that out of the spec file altogether. I'm going to import the version you approved for now, with the addition of the -v argument to %pytest. -- You are receiving this mail because: You are on the CC list for the bug. You are always notified about changes to this product and component https://bugzilla.redhat.com/show_bug.cgi?id=2278424 Report this comment as SPAM: https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202278424%23c14 -- _______________________________________________ package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx 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/package-review@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue