Programmatically set variants from a list

Ruben Di Battista rubendibattista at gmail.com
Wed May 8 12:10:30 UTC 2019


Hello, 
I’m trying to set paraview python variants programmatically (each of them conflicts with the others). I’m not a TCL ninja so I came out with the code below, but I’m getting error of the type: "Warning: Variant python27 conflicts with non-existing variant python35 python36 python37” for all the variant combinations. How do I set variants programmatically?
 

```
# Supported pythons
set python_versions {27 35 36 37}

foreach pyver ${python_versions} {
    # Conflicting python versions
    set other_python_versions {}
    foreach other_pyver ${python_versions} {
        if {${other_pyver} ne ${pyver}} {
            if {${other_pyver} ni ${other_python_versions}} {
                lappend other_python_versions python${other_pyver}
                }
            }
    }

    # Get python branch
    set python_branch {[string range ${pyver} 0 end-1].[string index ${pyver} end]}

    variant python${pyver} conflicts [join ${other_python_versions} " "] description {Add Python ${python_branch} support.} {
            depends_lib-append port:py${pyver}-matplotlib
            configure.args-append \
                -DPARAVIEW_ENABLE_PYTHON:BOOL=ON \
                -DPYTHON_EXECUTABLE=${prefix}/bin/python${python_branch} \
                -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${python_branch}/Headers/ \
                -DPYTHON_LIBRARY=${prefix}/lib/libpython${python_branch}.dylib

            if {[mpi_variant_isset]} {
                depends_lib-append port:py${pyver}-mpi4py
                configure.args-append \
                    -DVTK_USE_SYSTEM_MPI4PY:BOOL=ON
            }
    }
    
}

foreach pyver ${python_versions} {
    if {[variant_isset python${pyver}]} {
        notes-append\
            "\n Currently Paraview installs as an app, including the Python modules. To use with MacPorts Python, add ${applications_dir}/paraview.app/Contents/Python/:${applications_dir}/paraview.app/Contents/Libraries/ to PYTHONPATH and ${applications_dir}/paraview.app/Contents/Libraries/ to DYLD_LIBRARY_PATH. Also, simultaneous use of independent vtk libraries, e.g. with Mayavi, may result in segfault."
    }

}
```

          _   
-.     .´  |∞∞∞∞
  ',  ;    |∞∞∞∞∞∞
    ˜˜     |∞∞∞∞∞∞∞∞∞ RdB
    ,.,    |∞∞∞∞∞∞
  .'   '.  |∞∞∞∞
-'       `’

https://rdb.is
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20190508/2d707cda/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using AMPGpg
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20190508/2d707cda/attachment.sig>


More information about the macports-dev mailing list