276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# is returned if no API keys are currently configured. The prefix
# argument is an extra variable name prefix to check prior to any
# that are already configured.
#
# <internal>
proc getApiKeys { {prefix ""} } {
global env
set prefixes [list]
if {[string length $prefix] > 0} then {
lappend prefixes $prefix
}
lappend prefixes [getLookupVarNamePrefix]
foreach prefix $prefixes {
if {[string length $prefix] == 0} then {
set prefix ::; # TODO: Make non-global?
}
set varName [appendArgs $prefix api_keys]
if {[info exists $varName]} then {
return [set $varName]
}
set varName [string trim $varName :]
if {[info exists env($varName)]} then {
return $env($varName)
}
}
return [list]; # NOTE: System default, which is "public-only".
}
#
# NOTE: This procedure returns the base URI for the package repository
# server. There are no arguments.
#
proc getLookupBaseUri {} {
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
# is returned if no API keys are currently configured. The prefix
# argument is an extra variable name prefix to check prior to any
# that are already configured.
#
# <internal>
proc getApiKeys { {prefix ""} } {
global env
variable autoApiKeys
#
# NOTE: If the caller specified a variable name prefix, try to use it
# first.
#
set prefixes [list]
if {[string length $prefix] > 0} then {
lappend prefixes $prefix
}
#
# NOTE: Next, fallback to the variable name prefix for this package.
#
lappend prefixes [getLookupVarNamePrefix]
#
# NOTE: Try each variable name prefix, in order, until a set of API
# keys is found.
#
foreach prefix $prefixes {
#
# NOTE: If an empty prefix is seen, force it to use the "api_keys"
# variable from the global namespace.
#
if {[string length $prefix] == 0} then {
set prefix ::; # TODO: Make non-global?
}
#
# NOTE: Check for the variable, in whatever namespace it resides,
# and return its value verbatim if it exists.
#
set varName [appendArgs $prefix api_keys]
if {[info exists $varName]} then {
return [set $varName]
}
#
# NOTE: Fallback to using an environment variable with the same
# base name and returns its value verbatim if it exists.
#
set varName [string trim $varName :]
if {[info exists env($varName)]} then {
return $env($varName)
}
}
#
# NOTE: If there is a default list of API keys, just return it.
#
if {[info exists autoApiKeys] && [llength $autoApiKeys] > 0} then {
return $autoApiKeys
}
#
# NOTE: Otherwise, return the system default, which is "anonymous"
# packages only (i.e. those without any owners).
#
return [list]
}
#
# NOTE: This procedure returns the base URI for the package repository
# server. There are no arguments.
#
proc getLookupBaseUri {} {
|
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
|
# NOTE: This procedure performs initial setup of the package repository
# client, using the current configuration parameters. There are
# no arguments. It may load the Garuda package when evaluated in
# native Tcl. It may load a native Tcl library when evaluated in
# Eagle. It may install the [package unknown] hook.
#
proc setupPackageUnknownHandler {} {
variable autoHook
variable autoLoadTcl
variable autoRequireGaruda
#
# NOTE: Should we attempt to automatically load the Garuda package for
# native Tcl?
|
>
|
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
|
# NOTE: This procedure performs initial setup of the package repository
# client, using the current configuration parameters. There are
# no arguments. It may load the Garuda package when evaluated in
# native Tcl. It may load a native Tcl library when evaluated in
# Eagle. It may install the [package unknown] hook.
#
proc setupPackageUnknownHandler {} {
variable autoApiKeys
variable autoHook
variable autoLoadTcl
variable autoRequireGaruda
#
# NOTE: Should we attempt to automatically load the Garuda package for
# native Tcl?
|
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
|
#
# NOTE: This procedure sets up the default values for all configuration
# parameters used by the package repository client. There are no
# arguments.
#
proc setupPackageUnknownVars {} {
#
# NOTE: Automatically install our [package unknown] handler when this
# package is loaded?
#
variable autoHook; # DEFAULT: true
if {![info exists autoHook]} then {
|
>
>
>
>
>
>
>
>
>
>
>
|
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
|
#
# NOTE: This procedure sets up the default values for all configuration
# parameters used by the package repository client. There are no
# arguments.
#
proc setupPackageUnknownVars {} {
#
# NOTE: What is the default set of API keys if none were set explicitly?
# This list is subject to change at any time -AND- may be empty or
# may contain non-working API keys, please do not rely on it.
#
variable autoApiKeys; # DEFAULT: 0000000000000000000000000000000000000000
if {![info exists autoApiKeys]} then {
set autoApiKeys [list 0000000000000000000000000000000000000000]
}
#
# NOTE: Automatically install our [package unknown] handler when this
# package is loaded?
#
variable autoHook; # DEFAULT: true
if {![info exists autoHook]} then {
|