14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if {[info exists ::env($checkenv)]} {
return $::env($checkenv)
}
}
return "/tmp"
}
proc __get_homedir {} {
if {[info exists ::env(HOME)]} {
return $::env(HOME)
}
set pkgcachedir [file join [__get_tmpdir] "DELETEME_teapotclient_[string tolower [md5::md5 -hex [list [info script] $::tcl_platform(user)]]].cache"]
catch {
set ::env(HOME) [file normalize ~]
}
if {[info exists ::env(HOME)]} {
return $::env(HOME)
}
set ::env(HOME) [file join [__get_tmpdir] FAKEHOME_$tcl_platform(user)]
catch {
file mkdir $::env(HOME)
}
return $::env(HOME)
}
set pkgcachedir [file join [__get_homedir] ".teapot-client" "cachedir"]
# Conversions from Teapot-style names to local ones
set osTeapotToLocal(tcl) *
set osTeapotToLocal(linux-*) linux
set osTeapotToLocal(win32) windows
set osTeapotToLocal(solaris*) solaris
set osTeapotToLocal(freebsd) freebsd_*
|
272
273
274
275
276
277
278
279
280
281
|
292
293
294
295
296
297
298
299
300
301
302
303
304
|
+
+
+
|
foreach pkg [array names pkginfo] {
set pkginfo($pkg) [lsort -decreasing -dictionary $pkginfo($pkg)]
}
return [array get pkginfo]
}
proc setcachedir {dir} {
set ::teapotclient::pkgcachedir $dir
}
}
package provide teapotclient 0.1
|