Tk Library Source Code

Artifact [d7af9f9571]
Login

Artifact d7af9f9571e3dec6b4daee0ce7a992f199bd65ca:

Attachment "tcllibtclmod.diff" to ticket [3495830fff] added by stwo 2012-03-01 06:26:50.
Index: installer.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/installer.tcl,v
retrieving revision 1.24
diff -u -p -r1.24 installer.tcl
--- installer.tcl	19 Sep 2006 14:19:16 -0000	1.24
+++ installer.tcl	29 Feb 2012 23:19:22 -0000
@@ -196,6 +196,24 @@ proc xinstall {type args} {
     return
 }
 
+proc minstall {type tclmodulepath args} {
+    global modules guide pkgs
+    foreach m $modules {
+	set p $guide($m,$type)
+	if {$p eq "_tcm"} {
+	    if {$tclmodulepath eq ""} {
+		set p "_tcl"
+	    } else {
+		set a [list $tclmodulepath $pkgs($m)]
+	    }
+	} else {
+	    set a $args
+	}
+	eval $p $m $a
+    }
+    return
+}
+
 proc ainstall {} {
     global apps config tcl_platform distribution
 
@@ -207,7 +225,7 @@ proc ainstall {} {
 
     foreach a $apps {
 	set aexe [file join $distribution apps $a]
-	set adst [file join $config(app,path) ${a}$ext]
+	set adst [file join $config(destdir)$config(app,path) ${a}$ext]
 
 	log "\nGenerating $adst"
 	if {!$config(dry)} {
@@ -218,10 +236,10 @@ proc ainstall {} {
 
 	if {[file exists $aexe.man]} {
 	    if {$config(doc,nroff)} {
-		_manfile $aexe.man nroff n $config(doc,nroff,path)
+		_manfile $aexe.man nroff n $config(destdir)$config(doc,nroff,path)
 	    }
 	    if {$config(doc,html)} {
-		_manfile $aexe.man html html $config(doc,html,path)
+		_manfile $aexe.man html html $config(destdir)$config(doc,html,path)
 	    }
 	}
     }
@@ -229,7 +247,7 @@ proc ainstall {} {
 }
 
 proc doinstall {} {
-    global config package_version distribution package_name modules excluded
+    global config package_version distribution package_name modules excluded pkgs
 
     if {!$config(no-exclude)} {
 	foreach p $excluded {
@@ -239,22 +257,26 @@ proc doinstall {} {
 	}
     }
 
+    if {$config(tmd)} {
+	array set pkgs [exec [info nameofexecutable] [file join $distribution sak.tcl] provided]
+    }
+
     if {$config(doc,nroff)} {
 	set config(man.macros) [string trim [get_input \
 		[file join $distribution support installation man.macros]]]
     }
-    if {$config(pkg)}       {
-	xinstall   pkg $config(pkg,path)
-	gen_main_index $config(pkg,path) $package_name $package_version
+    if {$config(pkg)} {
+	minstall pkg [expr {$config(tmd) ? "$config(destdir)$config(tmd,path)" : ""}] $config(destdir)$config(pkg,path)
+	gen_main_index $config(destdir)$config(pkg,path) $package_name $package_version
 	if {$config(doc,nroff)} {
-	    xinstall doc nroff n    $config(doc,nroff,path)
+	    xinstall doc nroff n $config(destdir)$config(doc,nroff,path)
 	}
 	if {$config(doc,html)}  {
-	    xinstall doc html  html $config(doc,html,path)
+	    xinstall doc html html $config(destdir)$config(doc,html,path)
 	}
     }
-    if {$config(exa)}       {xinstall exa $config(exa,path)}
-    if {$config(app)}       {ainstall}
+    if {$config(exa)} {xinstall exa $config(destdir)$config(exa,path)}
+    if {$config(app)} {ainstall}
     log ""
     return
 }
@@ -265,12 +287,14 @@ proc doinstall {} {
 
 array set config {
     pkg 1 pkg,path {}
+    tmd 0 tmd,path {}
     app 1 app,path {}
     doc,nroff 0 doc,nroff,path {}
     doc,html  0 doc,html,path  {}
     exa 1 exa,path {}
     dry 0 wait 1 valid 1
     gui 0 no-gui 0 no-exclude 0
+    destdir ""
 }
 
 # --------------------------------------------------------------
@@ -313,6 +337,7 @@ proc defaults {} {
 
 	set config(app,path)       $bindir
 	set config(pkg,path)       [file join $libdir ${package_name}${package_version}]
+	set config(tmd,path)       [lindex [::tcl::tm::path list] 0]
 	set config(doc,nroff,path) $mandir
 	set config(doc,html,path)  $htmldir
 	set config(exa,path)       [file join $bindir ${package_name}_examples${package_version}]
@@ -360,6 +385,7 @@ proc showconfiguration {} {
     puts ""
 
     showpath "Packages:      " pkg
+    showpath "Tcl Modules:   " tmd
     showpath "Applications:  " app
     showpath "Examples:      " exa
 
@@ -406,31 +432,34 @@ proc setupgui {} {
 
     foreach {w type cspan col row opts} {
 	.pkg checkbutton 1 0 0 {-anchor w -text {Packages:}     -variable config(pkg)}
-	.app checkbutton 1 0 1 {-anchor w -text {Applications:} -variable config(app)}
-	.dnr checkbutton 1 0 2 {-anchor w -text {Doc. Nroff:}   -variable config(doc,nroff)}
-	.dht checkbutton 1 0 3 {-anchor w -text {Doc. HTML:}    -variable config(doc,html)}
-	.exa checkbutton 1 0 4 {-anchor w -text {Examples:}     -variable config(exa)}
+	.tmd checkbutton 1 0 1 {-anchor w -text {Tcl Modules:}  -variable config(tmd)}
+	.app checkbutton 1 0 2 {-anchor w -text {Applications:} -variable config(app)}
+	.dnr checkbutton 1 0 3 {-anchor w -text {Doc. Nroff:}   -variable config(doc,nroff)}
+	.dht checkbutton 1 0 4 {-anchor w -text {Doc. HTML:}    -variable config(doc,html)}
+	.exa checkbutton 1 0 5 {-anchor w -text {Examples:}     -variable config(exa)}
 
-	.spa frame  3 0 5 {-bg black -height 2}
+	.spa frame  3 0 6 {-bg black -height 2}
 
-	.dry checkbutton 2 0 7 {-anchor w -text {Simulate installation} -variable config(dry)}
+	.dry checkbutton 2 0 8 {-anchor w -text {Simulate installation} -variable config(dry)}
 
 	.pkge entry 1 1 0 {-width 40 -textvariable config(pkg,path)}
-	.appe entry 1 1 1 {-width 40 -textvariable config(app,path)}
-	.dnre entry 1 1 2 {-width 40 -textvariable config(doc,nroff,path)}
-	.dhte entry 1 1 3 {-width 40 -textvariable config(doc,html,path)}
-	.exae entry 1 1 4 {-width 40 -textvariable config(exa,path)}
-
-	.pkgb button 1 2 0 {-text ... -command {browse Packages     pkg,path}}
-	.appb button 1 2 1 {-text ... -command {browse Applications app,path}}
-	.dnrb button 1 2 2 {-text ... -command {browse Nroff        doc,nroff,path}}
-	.dhtb button 1 2 3 {-text ... -command {browse HTML         doc,html,path}}
-	.exab button 1 2 4 {-text ... -command {browse Examples     exa,path}}
+	.tmde entry 1 1 1 {-width 40 -textvariable config(tmd,path)}
+	.appe entry 1 1 2 {-width 40 -textvariable config(app,path)}
+	.dnre entry 1 1 3 {-width 40 -textvariable config(doc,nroff,path)}
+	.dhte entry 1 1 4 {-width 40 -textvariable config(doc,html,path)}
+	.exae entry 1 1 5 {-width 40 -textvariable config(exa,path)}
+
+	.pkgb button 1 2 0 {-text ... -command {browse Packages      pkg,path}}
+	.tmdb button 1 2 1 {-text ... -command {browse "Tcl Modules" tmd,path}}
+	.appb button 1 2 2 {-text ... -command {browse Applications  app,path}}
+	.dnrb button 1 2 3 {-text ... -command {browse Nroff         doc,nroff,path}}
+	.dhtb button 1 2 4 {-text ... -command {browse HTML          doc,html,path}}
+	.exab button 1 2 5 {-text ... -command {browse Examples      exa,path}}
 
-	.sep  frame  3 0 8 {-bg black -height 2}
+	.sep  frame  3 0 9 {-bg black -height 2}
 
-	.run  button 1 0 9 {-text {Install} -command {set ::run 1}}
-	.can  button 1 1 9 {-text {Cancel}  -command {exit}}
+	.run  button 1 0 10 {-text {Install} -command {set ::run 1}}
+	.can  button 1 1 10 {-text {Cancel}  -command {exit}}
     } {
 	eval [list $type $w] $opts
 	grid $w -column $col -row $row -sticky ew -columnspan $cspan
@@ -439,7 +468,7 @@ proc setupgui {} {
 
     grid .can -sticky e
 
-    grid rowconfigure    . 9 -weight 1
+    grid rowconfigure    . 10 -weight 1
     grid columnconfigure . 0 -weight 0
     grid columnconfigure . 1 -weight 1
 
@@ -485,17 +514,24 @@ proc processargs {} {
 	    -nroff       {set config(doc,nroff) 1}
 	    -examples    {set config(exa) 1}
 	    -pkgs        {set config(pkg) 1}
+	    -tclmodules  {set config(tmd) 1}
 	    -apps        {set config(app) 1}
 	    -no-html     {set config(doc,html) 0}
 	    -no-nroff    {set config(doc,nroff) 0}
 	    -no-examples {set config(exa) 0}
 	    -no-pkgs     {set config(pkg) 0}
+	    -no-tclmodules {set config(tmd) 0}
 	    -no-apps     {set config(app) 0}
 	    -pkg-path {
 		set config(pkg) 1
 		set config(pkg,path) [lindex $argv 1]
 		set argv             [lrange $argv 1 end]
 	    }
+	    -tclmodule-path {
+		set config(tmd) 1
+		set config(tmd,path) [lindex $argv 1]
+		set argv             [lrange $argv 1 end]
+	    }
 	    -app-path {
 		set config(app) 1
 		set config(app,path) [lindex $argv 1]
@@ -516,9 +552,13 @@ proc processargs {} {
 		set config(exa,path) [lindex $argv 1]
 		set argv             [lrange $argv 1 end]
 	    }
+	    -destdir {
+		set config(destdir) [lindex $argv 1]
+		set argv             [lrange $argv 1 end]
+	    }
 	    -help   -
 	    default {
-		puts stderr "usage: $argv0 ?-dry-run/-simulate? ?-no-wait? ?-no-gui? ?-html|-no-html? ?-nroff|-no-nroff? ?-examples|-no-examples? ?-pkgs|-no-pkgs? ?-pkg-path path? ?-apps|-no-apps? ?-app-path path? ?-nroff-path path? ?-html-path path? ?-example-path path?"
+		puts stderr "usage: $argv0 ?-dry-run/-simulate? ?-no-wait? ?-no-gui? ?-html|-no-html? ?-nroff|-no-nroff? ?-examples|-no-examples? ?-pkgs|-no-pkgs? ?-pkg-path path? ?-tclmodules|-no-tclmodules? ?-tclmodule-path path? ?-apps|-no-apps? ?-app-path path? ?-nroff-path path? ?-html-path path? ?-example-path path? ?-destdir path?"
 		exit 1
 	    }
 	}
Index: support/installation/actions.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/support/installation/actions.tcl,v
retrieving revision 1.4
diff -u -p -r1.4 actions.tcl
--- support/installation/actions.tcl	10 Nov 2011 21:16:02 -0000	1.4
+++ support/installation/actions.tcl	29 Feb 2012 23:19:25 -0000
@@ -26,6 +26,14 @@ proc _tcr {module libdir} {
     return
 }
 
+proc _tcm {module tclmoduledir version} {
+    global distribution
+    file mkdir $tclmoduledir
+    xcopyfile [file join $distribution modules $module $module.tcl] \
+	    [file join $tclmoduledir $module-$version.tm]
+    return
+}
+
 proc _doc {module libdir} {
     global distribution
 
Index: support/installation/modules.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/support/installation/modules.tcl,v
retrieving revision 1.35
diff -u -p -r1.35 modules.tcl
--- support/installation/modules.tcl	10 Nov 2011 21:16:02 -0000	1.35
+++ support/installation/modules.tcl	29 Feb 2012 23:19:25 -0000
@@ -49,7 +49,7 @@ Module  cmdline     _tcl  _man  _null
 Module  comm        _tcl  _man  _null
 Module  control      _tci _man  _null
 Module  coroutine   _tcl _null  _null
-Module  counter     _tcl  _man  _null
+Module  counter     _tcm  _man  _null
 Module  crc         _tcl  _man  _null
 Module  csv         _tcl  _man _exa
 Module  des         _tcl  _man  _null
@@ -62,55 +62,55 @@ Module  doctools2toc  _tcl _man _null
 Module  exif        _tcl  _man  _null
 Module  fileutil    _tcl  _man  _null
 Module  ftp         _tcl  _man _exa
-Module  ftpd        _tcl  _man _exa
+Module  ftpd        _tcm  _man _exa
 Module  fumagic     _tcl  _man  _null
-Module  gpx         _tcl _null  _null
+Module  gpx         _tcm _null  _null
 Module  grammar_aycock _tcl _man _null
 Module  grammar_fa  _tcl  _man  _null
 Module  grammar_me  _tcl  _man  _null
 Module  grammar_peg _tcl  _man  _null
-Module  hook        _tcl  _man  _null
-Module  html        _tcl  _man  _null
+Module  hook        _tcm  _man  _null
+Module  html        _tcm  _man  _null
 Module  htmlparse   _tcl  _man  _exa
 Module  http        _tcl  _man  _null
 Module  ident       _tcl  _man  _null
-Module  imap4       _tcl  _man  _null
+Module  imap4       _tcm  _man  _null
 Module  inifile     _tcl  _man  _null
 Module  interp      _tcl  _man  _null
 Module  irc         _tcl  _man _exa
-Module  javascript  _tcl  _man  _null
+Module  javascript  _tcm  _man  _null
 Module  jpeg        _tcl  _man  _null
 Module  json        _tcl  _man  _null
-Module  lambda      _tcl  _man  _null
+Module  lambda      _tcm  _man  _null
 Module  ldap        _tcl  _man _exa
 Module  log          _msg _man  {_exax logger}
 Module  map         _tcl  _man  _null
-Module  mapproj     _tcl  _man _exa
+Module  mapproj     _tcm  _man _exa
 Module  math         _tci _man _exa
 Module  md4         _tcl  _man  _null
 Module  md5         _tcl  _man  _null
 Module  md5crypt    _tcl  _man _null
 Module  mime        _tcl  _man _exa
-Module  multiplexer _tcl  _man  _null
-Module  namespacex  _tcl  _man  _null
+Module  multiplexer _tcm  _man  _null
+Module  namespacex  _tcm  _man  _null
 Module  ncgi        _tcl  _man  _null
-Module  nmea        _tcl  _man  _null
+Module  nmea        _tcm  _man  _null
 Module  nns         _tcl  _man  _null
-Module  nntp        _tcl  _man _exa
+Module  nntp        _tcm  _man _exa
 Module  ntp         _tcl  _man _exa
 Module  ooutil      _tcl  _man  _null
-Module  otp         _tcl  _man  _null
+Module  otp         _tcm  _man  _null
 Module  page         _trt _man  _null
 Module  pki         _tcl  _man  _null
-Module  pluginmgr   _tcl  _man  _null
+Module  pluginmgr   _tcm  _man  _null
 Module  png         _tcl  _man  _null
-Module  pop3        _tcl  _man  _null
+Module  pop3        _tcm  _man  _null
 Module  pop3d       _tcl  _man  _null
-Module  profiler    _tcl  _man  _null
+Module  profiler    _tcm  _man  _null
 Module  pt          _tcl  _man  _null
 Module  rc4         _tcl  _man  _null
 Module  rcs         _tcl  _man  _null
-Module  report      _tcl  _man  _null
+Module  report      _tcm  _man  _null
 Module  rest        _tcl  _man  _null
 Module  ripemd      _tcl  _man  _null
 Module  sasl        _tcl  _man  _exa
@@ -130,11 +130,11 @@ Module  tie         _tcl  _man  _exa
 Module  tiff        _tcl  _man  _null
 Module  transfer    _tcl  _man  _null
 Module  treeql      _tcl  _man  _null
-Module  try         _tcl  _man  _null
+Module  try         _tcm  _man  _null
 Module  uev         _tcl  _man  _null
 Module  units       _tcl  _man  _null
 Module  uri         _tcl  _man  _null
-Module  uuid        _tcl  _man  _null
+Module  uuid        _tcm  _man  _null
 Module  valtype     _tcl _null  _null
 Module  virtchannel_base       _tcl _null  _null
 Module  virtchannel_core       _tcl _null  _null