TcL question

René J.V. Bertin rjvbertin at gmail.com
Wed Nov 11 02:30:11 PST 2015


Hi,

I'm working on KF5 Portfiles, and have the following routine to help defining dependencies in the PortGroup:

{{{
# variables to facilitate setting up dependencies to KF5 frameworks that may (or not)
# also exist as port:kf5-foo-devel .
proc kf5.framework_dependency {name {library 0}} {
    upvar #0 kf5.${name}_dep dep
    if {${library} ne 0} {
            set kf5.lib_path    lib
            set kf5.lib_ext     5.dylib
        set dep                 path:${kf5.lib_path}/${library}.${kf5.lib_ext}:kf5-${name}
        ui_debug "Dependency expression for KF5ramework ${name}: ${dep}"
    } else {
        set strlen [string length [info global "kf5.${name}_dep"]]
        if {${strlen} ne 0} {
            return ${dep}
        } else {
            set allknown [info global "kf5.*_dep"]
            ui_error "No KF5 framework is known corresponding to \"${name}\""
            ui_msg "Known framework ports: ${allknown}"
            return -code error "Unknown KF5 framework ${name}"
        }
    }
}
}}}

That procedure is used either to define a path-style dependency, or to obtain it, mapping the official (lowercase) framework name to the corresponding port name. What I wonder is whether the existence check is done the way it should. From what I read, [info exists varname] should detect the existence of variables no matter the frame they're defined in, but [info exists kf5.${name}_dep] always returns false for me. Maybe [info exists] doesn't work with patterns?

Thanks,
R.


More information about the macports-dev mailing list