Avoiding repeating code for python variants
Mojca Miklavec
mojca at macports.org
Thu Mar 9 09:56:19 UTC 2017
Hi,
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]"
depends_lib-append
path:${frameworks_dir}/Python.framework/Versions/${python.branch}/lib/python${python.branch}/site-packages/PIL:py${python.version}-Pillow
}
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,
Mojca
More information about the macports-dev
mailing list