The python-devel RPM installs a macro definition file:


However, after installing python36u-devel from the IUS repository I do not have a Python 3 flavor of this file installed.

What is the recommended practice for setting the variables required to properly byte compile code using the Python 3 compiler when running rpmbuild?

For now I've gotten the rpmbuild to complete successfully by adding these definitions to my .spec file:

%{!?__python3: %global __python3 /usr/bin/python3}
%global __python %{__python3}
%global _pylib /usr/lib/python3.6/site-packages

However, I'm going to want to build multiple RPM files and I want to avoid duplicating this or even creating my own macro definition files for a standard system tool like this.


Most modern packages put macros to /usr/lib/rpm/macros.d/. The macros defined by that package is there.

That package fromIUS repository define macros: %__python36, %python36_sitelib...

| improve this answer | |
  • Thanks for the pointers. I'm slightly adverse to using %__python36 because at some point in the future I'm fairly certain we'll move to Python 3.7 and would not want to have to update either the spec files or the macro to redefine __python using __python3. – Mark Edington Apr 15 '17 at 12:48
  • IUS packages are intended to stick to an upstream "branch" such as the 3.6 branch of Python. python36u will never update to 3.7. So if you want to build your package against python36u-devel, the macros make sense. When you are ready to switch to 3.7 in the future you would do it deliberately with a s/36/37/ of the spec file. – carlwgeorge May 30 '17 at 3:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.