Avoiding repeating code for python variants

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Avoiding repeating code for python variants

Mojca Miklavec-2

Is there some clean way to avoid repeating the following chunk of code
four times (or more)?

variant python27 conflicts python34 python35 python36 description
{Enable GUI using Python 2.7} {

    set python.version  27
    set python.branch   "[string range ${python.version} 0
end-1].[string index ${python.version} end]"


ROOT 6 does something similar, but I want to know if I'm missing
something obvious.

PS: In my particular case the Python 3 code was still experimental and
semi-broken some time ago. These variants allowed me to more
extensively test the port and fix the software upstream, so it was
important to be able to switch back and forth between 2.7 and 3.4. In
all honesty the variants currently hardly play any role any longer
(unless something is broken that I'm not aware of), so I could just as
well go for Python 3.6 and forget the rest. But it might be relevant
for other ports. (I wish there was a way to do the same using the
Python PortGroup.)

Thank you,