Thanks. I’ll try if I can to your latter suggestion later, the portfile also 
uses this line with ${python.version} so it might not be that easy.

Zhenfu

> On Mar 21, 2022, at 16:13, Joshua Root <j...@macports.org> wrote:
> 
> On 2022-3-22 06:51 , Zhenfu Shi wrote:
>> Hi all,
>> I’m trying to add Python 3.10 variant to a few ports, but one of them (mpv) 
>> uses `set python_branch [join [split ${ver} {}] ".”]` to convert branch 
>> strings to version strings, resulting in “310” being converted to “3.1.0”. 
>> Can anyone advise how to change this line so it gives “3.10” without 
>> breaking compatibility with older Python versions?
> 
> Something like this works:
> 
> [string index $ver 0].[string range $ver 1 end]
> 
> However, it would be more reliable for mpv to start with versions containing 
> dots and strip them out when needed; something like:
> 
> set python.versions [list 3.8 3.9 3.10]
> foreach ver ${python.versions} {
>    set ver_nodot [string map {. ""} $ver]
>    ...
> }
> 
> - Josh

Reply via email to