source: trunk/tcl/install @ 6

Last change on this file since 6 was 6, checked in by mmc, 19 years ago

Fixed the Tcl library to mirror the API developed for XML
libraries on the Python side. The Tcl Rappture::library
now has methods like "children", "element", "put", etc.
One difference: On the Tcl side, the default -flavor for
element/children is "component", since that works better
in Tcl code. In Python, the default is flavor=object.

Also fixed the Tcl install script to install not just
the tcl/scripts library, but also the ../gui and ../lib
directories.

File size: 2.6 KB
Line 
1#!/bin/sh
2# ----------------------------------------------------------------------
3#  USAGE: tclsh install
4#
5#  Use this script to install the Rappture toolkit into an existing
6#  Tcl installation.
7# ======================================================================
8#  AUTHOR:  Michael McLennan, Purdue University
9#  Copyright (c) 2004  Purdue Research Foundation, West Lafayette, IN
10# ======================================================================
11#\
12exec tclsh "$0" "$*"
13# ----------------------------------------------------------------------
14# tclsh executes everything from here on...
15
16# run this script from directory containing it
17cd [file dirname [info script]]
18
19set package "Rappture"
20set version "0.9"
21
22proc find {dir} {
23    set flist ""
24    foreach name [glob [file join $dir *]] {
25        lappend flist $name
26        if {[file isdirectory $name]} {
27            eval lappend flist [find $name]
28        }
29    }
30    return $flist
31}
32
33proc mkindex {dir} {
34    package require Itcl  ;# index Itcl files too!
35    auto_mkindex $dir *.tcl
36}
37
38
39set dir [file dirname [info library]]
40set targetdir [file join $dir $package$version]
41
42if {![file exists $targetdir]} {
43    puts "making directory $targetdir..."
44    file mkdir $targetdir
45}
46
47set origdir [pwd]
48foreach context {. ../gui} {
49    cd $context
50
51    foreach file [find .] {
52        set target [file join $targetdir $file]
53        if {[file isdirectory $file]} {
54            puts "making directory $target..."
55            catch {file mkdir $target}
56            file attributes $target -permissions ugo+rx
57        } else {
58            puts "installing $target..."
59            file copy -force $file $target
60            file attributes $target -permissions ugo+r
61        }
62    }
63}
64
65cd ..
66catch {file mkdir [file join $targetdir lib]}
67foreach file [find ./lib] {
68    set target [file join $targetdir $file]
69    if {[file isdirectory $file]} {
70        puts "making directory $target..."
71        catch {file mkdir $target}
72        file attributes $target -permissions ugo+rx
73    } else {
74        puts "installing $target..."
75        file copy -force $file $target
76        file attributes $target -permissions ugo+r
77    }
78}
79
80cd $origdir
81
82set fid [open [file join $targetdir pkgIndex.tcl] w]
83puts $fid "# Tcl package index file"
84puts $fid "package ifneeded $package $version \""
85puts $fid "  \[list lappend auto_path \[file join \$dir scripts\]\]"
86puts $fid "  namespace eval Rappture \[list variable installdir \$dir\]"
87puts $fid "  package provide $package $version"
88puts $fid "\""
89close $fid
90
91mkindex [file join $targetdir scripts]
92
93puts "== $package-$version INSTALLED"
Note: See TracBrowser for help on using the repository browser.