[121943] contrib/port-depgraph/port-depgraph
jmr at macports.org
jmr at macports.org
Fri Jul 11 16:57:25 PDT 2014
Revision: 121943
https://trac.macports.org/changeset/121943
Author: jmr at macports.org
Date: 2014-07-11 16:57:25 -0700 (Fri, 11 Jul 2014)
Log Message:
-----------
port-depgraph: work with macports 2.3
Modified Paths:
--------------
contrib/port-depgraph/port-depgraph
Modified: contrib/port-depgraph/port-depgraph
===================================================================
--- contrib/port-depgraph/port-depgraph 2014-07-11 22:26:14 UTC (rev 121942)
+++ contrib/port-depgraph/port-depgraph 2014-07-11 23:57:25 UTC (rev 121943)
@@ -1,5 +1,7 @@
-#!/usr/bin/tclsh
+#!/bin/sh
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# \
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" "$@"; fi
#
# Run a recursive dependency listing against a given port, outputing
# a Graphviz graph description. To create a graphical representation
@@ -14,10 +16,10 @@
proc printUsage {} {
- puts "Usage: $::argv0 \[-dhrvV\] \[-t macports-tcl-path\] port-name \[variants...\]"
+ puts "Usage: $::argv0 \[-dhrvV\] \[-p macports-prefix\] port-name \[variants...\]"
puts " -h This help"
- puts " -t Give a different location for the base MacPorts Tcl"
- puts " file (defaults to /Library/Tcl)"
+ puts " -p Use a different MacPorts prefix"
+ puts " (defaults to /opt/local)"
puts " -v verbose output, includes dependency labels"
puts " -V show version and MacPorts version being used"
puts ""
@@ -123,7 +125,7 @@
# Begin
-set macportsTclPath /Library/Tcl
+set macportsPrefix /opt/local
set verbose 0
set showVersion 0
@@ -133,15 +135,20 @@
printUsage
exit 0
}
- t {
- if {[llength $::argv] < 2} {
- puts "-t needs a path"
- printUsage
- exit 1
- }
- set macportsTclPath [lindex $::argv 1]
- set ::argv [lrange $::argv 1 end]
+ i {
+ set interp_path [lindex $::argv 1]
+ set ::argv [lrange $::argv 1 end]
}
+ p {
+ if {[llength $::argv] < 2} {
+ puts "-p needs a path"
+ printUsage
+ exit 1
+ }
+ set macportsPrefix [lindex $::argv 1]
+ set ::argv [lrange $::argv 1 end]
+ set userPrefix 1
+ }
v {
set verbose 1
}
@@ -157,7 +164,27 @@
set ::argv [lrange $::argv 1 end]
}
-source ${macportsTclPath}/macports1.0/macports_fastload.tcl
+# check that default prefix exists
+if {![info exists userPrefix] && ![file isdirectory $macportsPrefix]} {
+ error "prefix '$macportsPrefix' does not exist; maybe you need to use the -p option?"
+}
+
+if {[info exists interp_path]} {
+ set prefixFromInterp [file dirname [file dirname $interp_path]]
+ # make sure we're running in the port-tclsh associated with the correct prefix
+ if {$prefixFromInterp ne $macportsPrefix} {
+ if {[file executable ${macportsPrefix}/bin/port-tclsh]} {
+ exec ${macportsPrefix}/bin/port-tclsh $argv0 -i ${macportsPrefix}/bin/port-tclsh {*}[lrange $origArgv 2 end] <@stdin >@stdout 2>@stderr
+ } else {
+ exec /usr/bin/tclsh $argv0 {*}[lrange $origArgv 2 end] <@stdin >@stdout 2>@stderr
+ }
+ exit 0
+ }
+} else {
+ # older base version
+ source ${macportsPrefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+}
+
package require macports
mportinit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140711/50b33290/attachment.html>
More information about the macports-changes
mailing list