[120359] contrib/mpab/subports.tcl
jmr at macports.org
jmr at macports.org
Sat May 24 01:55:44 PDT 2014
Revision: 120359
https://trac.macports.org/changeset/120359
Author: jmr at macports.org
Date: 2014-05-24 01:55:44 -0700 (Sat, 24 May 2014)
Log Message:
-----------
mpab: make subports.tcl work without ${prefix}/bin in PATH
Modified Paths:
--------------
contrib/mpab/subports.tcl
Modified: contrib/mpab/subports.tcl
===================================================================
--- contrib/mpab/subports.tcl 2014-05-24 08:33:35 UTC (rev 120358)
+++ contrib/mpab/subports.tcl 2014-05-24 08:55:44 UTC (rev 120359)
@@ -1,7 +1,7 @@
#!/bin/sh
#
# \
-if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" "$@"; else exec /usr/bin/tclsh "$0" "$@"; fi
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" -i /usr/bin/tclsh "$@"; fi
# Generates a list of the subports for the given port.
#
# Copyright (c) 2011 The MacPorts Project.
@@ -37,9 +37,23 @@
set prefix /opt/local
}
-if {[file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
- source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+if {[llength $::argv] == 0} {
+ puts stderr "Usage: $argv0 <portname>"
+ exit 1
+} elseif {[llength $::argv] >= 3 && [lindex $argv 0] eq "-i"} {
+ set prefixFromInterp [file dirname [file dirname [lindex $argv 1]]]
+ if {$prefixFromInterp eq "/usr" && [file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+ } elseif {$prefixFromInterp ne $prefix} {
+ if {[file executable ${prefix}/bin/port-tclsh]} {
+ exec ${prefix}/bin/port-tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ } else {
+ exec /usr/bin/tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ }
+ exit 0
+ }
}
+
package require macports
if {[catch {mportinit "" "" ""} result]} {
@@ -48,11 +62,6 @@
exit 1
}
-if {[llength $::argv] == 0} {
- puts stderr "Usage: $argv0 <portname>"
- exit 1
-}
-
set portname [lindex $::argv 0]
if {[catch {set one_result [mportlookup $portname]}] || [llength $one_result] < 2} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140524/13816e58/attachment.html>
More information about the macports-changes
mailing list