Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM python bindings dependency #72

Closed
nforro opened this issue Jul 25, 2022 · 8 comments · Fixed by #75
Closed

RPM python bindings dependency #72

nforro opened this issue Jul 25, 2022 · 8 comments · Fixed by #75

Comments

@nforro
Copy link
Member

nforro commented Jul 25, 2022

specfile currently depends on rpm which is not (and probably never will be) available on PyPI. That means whoever wants to install it using pip has to have RPM python bindings already installed (usually via a package manager).
We could instead depend on rpm-py-installer, but it's not a flawless solution.

@nforro
Copy link
Member Author

nforro commented Jul 26, 2022

One problem is, specifying rpm-py-installer as a dependency breaks dynamic buildrequires, because there is no python3dist(rpm-py-installer) in Fedora.

A solution that comes to mind is to continue depending on rpm and use an extra for rpm-py-installer, so users could install specfile with pip install specfile[rpm-py-installer] (or something similar).

@TomasTomecek
Copy link
Member

how hard would it be to have rpm available on PyPI?

would it be too complicated to write a script and run it in GitHub action that would take care of that?

@nforro
Copy link
Member Author

nforro commented Jul 26, 2022

would it be too complicated to write a script and run it in GitHub action that would take care of that?

What do you mean exactly? I don't follow.

@TomasTomecek
Copy link
Member

So, I understand that rpm-py-installer compiles the rpm python bindings locally on the fly. That's great but requires all build tools and everything.

Since you can have binary artifacts on PyPI, one could do that in a controlled environment (e.g. GitHub action) and upload the artifacts to PyPI as bdist_wheel.

Do you think that would work?

@nforro
Copy link
Member Author

nforro commented Jul 27, 2022

I'm not sure. The thing is, RPM python bindings are tied to a specific RPM version. So there would have to be a build for every RPM version ever released and the correct one would have to be chosen during installation.

If I understand it correctly, rpm-py-installer first tries to install matching bindings from a system package, and only if that's not possible it builds them from source (and in the worst case it builds RPM itself from source as well).

@nforro
Copy link
Member Author

nforro commented Jul 27, 2022

See also rpm-software-management/rpm#273

@TomasTomecek
Copy link
Member

oh, didn't realize it works like that, thank you for educating me

I wish they changed their mind.

@nforro
Copy link
Member Author

nforro commented Jul 31, 2022

A better solution that works with dynamic buildrequires is to substitute rpm-py-installer with rpm in setup.cfg in %prep (it works because %prep is executed before %generate_buildrequires):

%prep
%autosetup -p1 -n specfile-%{version}
sed -i 's/rpm-py-installer/rpm/' setup.cfg

%generate_buildrequires
%pyproject_buildrequires -x testing

softwarefactory-project-zuul bot added a commit that referenced this issue Aug 3, 2022
Switch to rpm-py-installer

Fixes #72.

Reviewed-by: Tomas Tomecek <tomas@tomecek.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants