2

What I Want To Do

I'm trying to build an RPM package of my app that could be installed in different Fedora distros, which have different default Python 3 versions (i.e. Fedora 28 has python3.6, and Fedora 29 has python3.7)

I'm using this to build an RPM

python3 setup.py bdist_rpm

The Problem

If I build it on Fedora 28, then the RPM will have my python files in /usr/lib/python3.6/site-packages.

When a users installs it on Fedora 29, where a default Python is 3.7, it won't find my package because it looks into /usr/lib/python3.7/site-packages.

So when a user launches the app it naturally fails with error "No module named 'myappname'".

The Solution That I Don't Like

I can build multiple RPM packages -- one in Fedora 28 and another one in 29

Instead, I'd like to build one RPM that works in both distros.

What I Tried

I tried adding python37 as a dependency, but then app fails too because it cannot import dependencies like python-Levenshtein -- all dependencies are installed in /usr/lib/python3.6/site-packages

My spec file is here.

  • Follow the instructions: docs.fedoraproject.org/en-US/packaging-guidelines/Python – Michael Hampton Dec 15 '18 at 17:11
  • @MichaelHampton Thanks for the link. I actually read that page multiple times but didn't find an answer to my question there. – Aleksandr Dec 15 '18 at 19:07
  • Your spec file doesn't use the %py3_build or %py3_install macros as it is meant to do. See also the example spec file on that page for how you should use the macros to build and install files. – Michael Hampton Dec 15 '18 at 19:19
  • I've looked at those macroses in /usr/lib/rpm/macros.d/macros.python3, similar %build and %install commands can be created by passing proper arguments to bdist_rpm. But that always produces a single directory under /usr/lib. I think that in order to have a single RPM package I have to copy site-packages to both python3.7 and python3.6 dirs. – Aleksandr Dec 15 '18 at 19:49
  • Oh, I think I understand what you're after. You're not supposed to do that. Build a package on Fedora 28 and a separate package on Fedora 29. This is literally the way every other package is built. – Michael Hampton Dec 15 '18 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.