Build using python based waf build system

Hello everyone and I wish you a nice morning/day/evening/night.

I am currently working on a package inside my test OBS repo which uses the python based waf build system and I have two problems:

I already checked the packaging guide for python and experimented with the macros like:


BuildRequires %{pythons}

and to run the waf script using:

%python_exec waf configure build

and so on.

But it seems the waf script only works with python 2 and the macro pythons will add python 3.8 and also the execute will run stuff with 3.8 cuz it is the latest python in the tumbleweed repos I guess.
How do I tell it to use a certain version python instead of using switches based on the python flavor which was chosen by the build system?

Like:

%if "%{python_flavor}" == "python2"
Requires: python2-enum34
%endif

Instead I want it to use python2 in the first place.

I circumvented this issue by not using any macros at all and to run the waf script directly as:

python waf configure build

But I already know this is bad practice and at least when I try to submit the packages to the games repos I will need to change this in any case before it gets approved.

Could someone point me to some spec files where the python waf build system was used or some documentation so I might get the required info from there? :slight_smile:

My 2nd issue is that the project which should be build using waf does not compile nicely with gcc10 and gcc9 can be used at max.
I talked to the devs already and he was able to reproduce my compiling issues I am facing due to this with gcc10 as well and suggested me to try running waf as follows:

"CC=gcc-9 waf configure build"

My question is now: How do I properly set environment variables in a spec file and how to properly use the waf build system overall?

Since as described above I had some issues with %python_exec waf … due to it picking python 3.8.8 which fails to run the waf script.

I appreciate any form of help which may lead me to the solutions I need :smiley:

Thank you very much in advance and I wish you all a very nice day.

Hi
Tumbleweed is python3 only going forward…

Just define gcc9 as a build requires, and export CC in the spec file;


export CC="/usr/bin/gcc-9"

I would look at porting to python3?

Thanks I’ll talk to the dev again then or try to make it python3 compatible on my own and maybe submit the changes to them :slight_smile:

Thank you for the help it get me closer to a solution :slight_smile: