Skip to content

Instantly share code, notes, and snippets.

@jmroot
Created January 9, 2026 11:57
Show Gist options
  • Select an option

  • Save jmroot/175892576ff9ecae1cff79e7701cf63c to your computer and use it in GitHub Desktop.

Select an option

Save jmroot/175892576ff9ecae1cff79e7701cf63c to your computer and use it in GitHub Desktop.
Print an arbitrary variable from a Portfile interpreter
#! /usr/bin/env port-tclsh
# usage: mportkey.tcl varname portname [variants]
lassign $argv varname portname variants
package require macports
mportinit
lassign [mportlookup $portname] portname portinfo
set variations [macports::_variants_to_variations $variants]
set mport [mportopen [dict get $portinfo porturl] [dict create subport $portname] $variations]
puts [_mportkey $mport $varname]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment