pax_global_header 0000666 0000000 0000000 00000000064 13545366426 0014530 g ustar 00root root 0000000 0000000 52 comment=e8c706da52c61bc98b186902af90bc5f7661dde6
deken-0.6.0/ 0000775 0000000 0000000 00000000000 13545366426 0012621 5 ustar 00root root 0000000 0000000 deken-0.6.0/LICENSE.txt 0000664 0000000 0000000 00000003041 13545366426 0014442 0 ustar 00root root 0000000 0000000 This software is copyrighted by Chris McCormick and others. The following
terms (the "Standard Improved BSD License") apply to all files associated with
the software unless explicitly disclaimed in individual files:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
deken-0.6.0/Makefile 0000664 0000000 0000000 00000001016 13545366426 0014257 0 ustar 00root root 0000000 0000000 default:
@echo "make dek: build a legacy deken-package for the deken-plugin"
plugin_version := $(shell egrep "^if.*::deken::versioncheck" deken-plugin.tcl | sed -e 's| *].*||' -e 's|.* ||')
dek: deken-plugin-$(plugin_version)--externals.zip
.PHONY: dek deken-plugin
deken-plugin: deken-plugin.tcl README.plugin.txt LICENSE.txt
rm -rf $@
mkdir -p $@
cp $^ $@
mv $@/README.plugin.txt $@/README.txt
deken-plugin-$(plugin_version)--externals.zip: deken-plugin
deken package --dekformat=0 --version=$(plugin_version) $^
deken-0.6.0/README.md 0000664 0000000 0000000 00000006306 13545366426 0014105 0 ustar 00root root 0000000 0000000 A minimal package management system for Pure Data externals.

Packages are stored on and can be installed using the `Help -> Find Packages` menu after installing the [TCL plugin](https://raw.githubusercontent.com/pure-data/deken/master/deken-plugin.tcl).
## README.1st ##
Since [`Pd-0.47`](http://puredata.info/downloads/pure-data/releases/0.47-0),
the `deken-plugin` is included into Pure Data itself,
so the only reason to manually install it is to get the newest version.
Main development of the plugin is still happening in *this* repository,
so you might want to manually install the plugin to help testing new features.
When manually installing the `deken-plugin`, Pd will use it if (and only if) it has a greater version number
than the one included in Pd.
In this case you will see something like the following in the Pd-console (you first have to raise the verbosity to `Debug`):
> `[deken]: installed version [0.2.1] < 0.2.3...overwriting!`
> `deken-plugin.tcl (Pd externals search) in /home/frobnozzel/.local/lib/pd/extra/deken-plugin/ loaded.`
## Download/Install ##
Click to download [deken-plugin.tcl](https://raw.githubusercontent.com/pure-data/deken/master/deken-plugin.tcl) and save it to your Pd folder:
* Linux = `~/.local/lib/pd/extra/deken-plugin/` (with Pd<0.47 try `~/pd-externals/deken-plugin/`)
* OSX = `~/Library/Pd/deken-plugin/`
* Windows = `%AppData%\Pd\deken-plugin\`
Then select `Help -> Find Packages` and type the name of the external you would like to search for.
## Trusting packages
The `deken-plugin` will help you find and install Pd-libraries.
However, it does not verify whether a given package is downloaded from a trusted source or not.
As of now, the default package source is http://puredata.info.
Anybody who has an account on that website (currently that's a few thousand people) can upload packages,
that the `deken-plugin` will happily find and install for you.
In order to make these packages more trustworthy, we ask people to sign their uploaded packages with the GPG-key.
Unfortunately the deken-plugin does not check these signatures yet.
If you are concerned about the authenticity of a given download, you can check the GPG-signature manually,
by following these steps:
- Navigate to `Help -> Find Packages` and search for an external
- Right-Click one of the search results
- Select "Copy package URL" to copy the link to the downloadable file to your clipboard
- Download the packge from the copied link
- Back in the deken search results, select "Copy OpenGPG signature URL"
- Download the GPG-signature from the copied link to the same location as the package
- Run `gpg --verify` on the downloaded file
If the signature is correct, you can decide yourself whether you actually trust the person who signed:
- Do you trust the signature to be owned by the person?
- Do you know the person?
- Do you trust them enough to let them install arbitrary software on your machine?
# Developers #
`deken` comes with a tool to package and upload your own library builds.
See [developer/README.md](./developer/README.md) for more information.
deken-0.6.0/README.plugin.txt 0000664 0000000 0000000 00000004516 13545366426 0015622 0 ustar 00root root 0000000 0000000 A minimal package management system for Pure Data externals.
============================================================
Packages are stored on and can be installed using the
`Help -> Find Packages` menu.
## README.1st ##
Since Pd-0.47, the `deken-plugin` is included into Pure Data itself,
so the only reason to manually install it is to get the newest version.
When manually installing the `deken-plugin`, Pd will use it if (and only if) it
has a greater version number than the one included in Pd.
In this case you will see something like the following in the Pd-console (you
first have to raise the verbosity to `Debug`):
> Loading plugin: /home/zmoelnig/src/puredata/deken/deken-plugin/deken-plugin.tcl
> [deken]: installed version [0.2.1] < 0.2.3...overwriting!
> [deken] deken-plugin.tcl (Pd externals search) loaded from /home/zmoelnig/src/puredata/deken/deken-plugin.
## Trusting packages
The `deken-plugin` will help you find and install Pd-libraries.
However, it does not verify whether a given package is downloaded from a trusted
source or not.
As of now, the default package source is https://deken.puredata.info/.
Anybody who has an account on the https://puredata.info website (currently
that's a few thousand people) can upload packages, that the `deken-plugin` will
happily find and install for you.
In order to make these packages more trustworthy, we ask people to sign their
uploaded packages with the GPG-key.
Unfortunately the deken-plugin does not check these signatures yet.
If you are concerned about the authenticity of a given download, you can check
the GPG-signature manually, by following these steps:
- Navigate to `Help -> Find Packages` and search for an external
- Right-Click one of the search results
- Select "Copy package URL" to copy the link to the downloadable file to your clipboard
- Download the packge from the copied link
- Back in the deken search results, select "Copy OpenGPG signature URL"
- Download the GPG-signature from the copied link to the same location as the package
- Run `gpg --verify` on the downloaded file
If the signature is correct, you can decide yourself whether you actually trust
the person who signed:
- Do you trust the signature to be owned by the person?
- Do you know the person?
- Do you trust them enough to let them install arbitrary software on your machine?
deken-0.6.0/deken-extra-plugins/ 0000775 0000000 0000000 00000000000 13545366426 0016507 5 ustar 00root root 0000000 0000000 deken-0.6.0/deken-extra-plugins/deken-xtra-apt-plugin.tcl 0000664 0000000 0000000 00000011446 13545366426 0023341 0 ustar 00root root 0000000 0000000 # META NAME PdExternalsSearch
# META DESCRIPTION Search for externals Debian-packages via apt
# META AUTHOR IOhannes m zmölnig
# ex: set setl sw=2 sts=2 et
# Search URL:
# http://puredata.info/search_rss?SearchableText=xtrnl-
# The minimum version of TCL that allows the plugin to run
package require Tcl 8.4
## ####################################################################
## searching apt (if available)
namespace eval ::deken::apt {
namespace export search
namespace export install
variable distribution
}
proc ::deken::apt::search {name} {
set result []
if { [info exists ::deken::apt::distribution] } { } {
if { [ catch { exec lsb_release -si } ::deken::apt::distribution ] } {
set ::deken::apt::distribution {}
}
}
if { "$::deken::apt::distribution" == "" } {
return
}
set name [ string tolower $name ]
array unset pkgs
array set pkgs {}
set _dpkg_query {dpkg-query -W -f ${db:Status-Abbrev}${Version}\n}
set filter "-F Provides pd-externals --or -F Depends -w pd --or -F Depends -w puredata --or -F Depends -w puredata-core"
if { "$name" == "" } { } {
set filter " -F Package $name --and ( $filter )"
}
set io [ open "|grep-aptavail -n -s Package $filter | sort -u | xargs apt-cache madison" r ]
while { [ gets $io line ] >= 0 } {
#puts $line
set llin [ split "$line" "|" ]
set pkgname [ string trim [ lindex $llin 0 ] ]
#if { $pkgname ne $searchname } { continue }
set ver_ [ string trim [ lindex $llin 1 ] ]
set info_ [ string trim [ lindex $llin 2 ] ]
## status: is the package installed?
set state "Provided"
catch {
set io2 [ open "|${_dpkg_query} ${pkgname} | egrep ^ii | egrep ${ver_}$" ]
if { [ gets $io2 _ ] >= 0 } {
set state "Already installed"
} {
while { [ gets $io2 _ ] >= 0 } { }
}
}
if { "Packages" eq [ lindex $info_ end ] } {
set suite [ lindex $info_ 1 ]
set arch [ lindex $info_ 2 ]
if { ! [ info exists pkgs($pkgname/$ver_) ] } {
set pkgs($pkgname/$ver_) [ list $pkgname $ver_ $suite $arch $state]
}
}
}
foreach {name inf} [ array get pkgs ] {
set pkgname [ lindex $inf 0 ]
set v [ lindex $inf 1 ]
set suite [ lindex $inf 2 ]
set arch [ lindex $inf 3 ]
set state [ lindex $inf 4 ]
set cmd "::deken::apt::install ${pkgname}=$v"
set match 1
set comment "${state} by ${::deken::apt::distribution} (${suite})"
set status "${pkgname}_${v}_${arch}.deb"
lappend result [list $name $cmd $match $comment $status]
}
# version-sort the results and normalize the result-string
set sortedresult []
if {[expr {[llength [info procs ::deken::normalize_result ]] > 0}]} {
foreach r [lsort -dictionary -decreasing -index 1 $result ] {
foreach {title cmd match comment status} $r {break}
lappend sortedresult [::deken::normalize_result $title $cmd $match $comment $status]
}
} {
foreach r [lsort -dictionary -decreasing -index 1 $result ] {
# [list $title $cmd $match $comment $status]
foreach {title cmd match comment status} $r {break}
lappend sortedresult [list $title $cmd $match $comment $status]
}
}
return $sortedresult
}
proc ::deken::apt::install {pkg} {
set desc deken::apt
set prog "apt-get install -y --show-progress ${pkg}"
if { [ catch { exec which pkexec } sudo ] } {
if { [ catch { exec which gksudo } sudo ] } {
set sudo ""
} { set sudo "$sudo -D $desc --"
}
}
if { $sudo == "" } {
::deken::post "Please install 'policykit-1', if you want to install system packages via deken..." error
} {
# for whatever reasons, we cannot have 'deken' as the description
# (it will always show $prog instead)
set cmdline "$sudo $prog"
#::deken::post "$cmdline" error
set io [ open "|${cmdline}" ]
while { [ gets $io line ] >= 0 } {
::deken::post "apt: $line"
}
if { [ catch { close $io } ret ] } {
::deken::post "apt::install failed to install $pkg" error
::deken::post "\tDid you provide the correct password and/or" error
::deken::post "\tis the apt database locked by another process?" error
}
}
}
proc ::deken::apt::register { } {
if { [ catch { exec apt-cache madison } _ ] } { } {
if { [ catch { exec which grep-aptavail } _ ] } { } {
if { [ catch {
::deken::register ::deken::apt::search
} ] } {
::pdwindow::debug "Not using APT-backend for unavailable deken\n"
} {
return 1
}
}}
return 0
}
if { [::deken::apt::register] } {
::pdwindow::debug "Using APT as additional deken backend\n"
}
deken-0.6.0/deken-plugin.tcl 0000664 0000000 0000000 00000201564 13545366426 0015717 0 ustar 00root root 0000000 0000000 # META NAME PdExternalsSearch
# META DESCRIPTION Search for externals zipfiles on puredata.info
# META AUTHOR chris@mccormick.cx
# META AUTHOR zmoelnig@iem.at
# ex: set setl sw=2 sts=2 et
# Search URL:
# http://deken.puredata.info/search?name=foobar
# TODOs
## + open embedded README
## - open README on homepage (aka "More info...")
## + remove library before unzipping
## + only show valid arch
## - only show most recent version (of each arch)
## - check whether the "cd" thing during unzip works on w32 and multiple drives
## - redirect ::deken::post to ::pdwindow::post (that is: use the results pane only for results)
## + make the "add to path" thingy configurable
# The minimum version of TCL that allows the plugin to run
package require Tcl 8.4
# If Tk or Ttk is needed
#package require Ttk
# Any elements of the Pd GUI that are required
# + require everything and all your script needs.
# If a requirement is missing,
# Pd will load, but the script will not.
package require http 2
# try enabling https if possible
if { [catch {package require tls} ] } {} {
::tls::init -ssl2 false -ssl3 false -tls1 true
::http::register https 443 ::tls::socket
}
# try enabling PROXY support if possible
if { [catch {package require autoproxy} ] } {} {
::autoproxy::init
if { ! [catch {package present tls} stdout] } {
::http::register https 443 ::autoproxy::tls_socket
}
}
package require pdwindow 0.1
package require pd_menucommands 0.1
package require pd_guiprefs
namespace eval ::deken:: {
variable version
variable installpath
variable userplatform
variable hideforeignarch
# whether to use http:// or https://
variable protocol
}
namespace eval ::deken::preferences {
variable installpath
variable userinstallpath
# automatically detected platform
variable platform
# user specified platform
variable userplatform
# boolean whether non-matching archs should be hidden
variable hideforeignarch
}
namespace eval ::deken::utilities { }
## only register this plugin if there isn't any newer version already registered
## (if ::deken::version is defined and is higher than our own version)
proc ::deken::versioncheck {version} {
if { [info exists ::deken::version ] } {
set v0 [split $::deken::version "."]
set v1 [split $version "."]
foreach x $v0 y $v1 {
if { $x > $y } {
::pdwindow::debug [format [_ "\[deken\] installed version \[%1\$s\] > %2\$s...skipping!" ] $::deken::version $version ]
::pdwindow::debug "\n"
return 0
}
if { $x < $y } {
::pdwindow::debug [format [_ "\[deken\] installed version \[%1\$s] < %2\$s...overwriting!" ] $::deken::version $version ]
::pdwindow::debug "\n"
set ::deken::version $version
return 1
}
}
::pdwindow::debug [format [_ "\[deken\] installed version \[%1\$s\] == %2\$s...skipping!" ] $::deken::version $version ]
::pdwindow::debug "\n"
return 0
}
set ::deken::version $version
return 1
}
## put the current version of this package here:
if { [::deken::versioncheck 0.6.0] } {
## FIXXXXME only initialize vars if not yet set
set ::deken::installpath {}
set ::deken::userplatform {}
set ::deken::hideforeignarch 1
set ::deken::show_readme 1
set ::deken::remove_on_install 1
set ::deken::add_to_path 0
set ::deken::keep_package 0
set ::deken::verify_sha256 1
set ::deken::preferences::installpath {}
set ::deken::preferences::userinstallpath {}
set ::deken::preferences::platform {}
set ::deken::preferences::userplatform {}
set ::deken::preferences::hideforeignarch {}
set ::deken::preferences::show_readme {}
set ::deken::preferences::remove_on_install {}
set ::deken::preferences::add_to_path {}
set ::deken::preferences::add_to_path_temp {}
set ::deken::preferences::keep_package {}
set ::deken::preferences::verify_sha256 {}
namespace eval ::deken:: {
namespace export open_searchui
variable mytoplevelref
variable platform
variable architecture_substitutes
variable installpath
variable statustext
variable statustimer
variable backends
variable progressvar
namespace export register
}
namespace eval ::deken::search:: { }
set ::deken::installpath ""
set ::deken::statustimer ""
set ::deken::userplaform ""
set ::deken::hideforeignarch false
set ::deken::protocol "http"
if { ! [catch {package present tls} stdout] } {
set ::deken::protocol "https"
}
proc ::deken::utilities::bool {value {fallback 0}} {
catch {set fallback [expr bool($value) ] } stdout
return $fallback
}
proc ::deken::utilities::tristate {value {offset 0} {fallback 0} } {
catch {set fallback [expr (int($value) + int($offset))% 3 ]} stdout
return $fallback
}
proc ::deken::utilities::is_writable_dir {path} {
set fs [file separator]
set access [list RDWR CREAT EXCL TRUNC]
set tmpfile [::deken::get_tmpfilename $path]
# try creating tmpfile
if {![catch {open $tmpfile $access} channel]} {
close $channel
file delete $tmpfile
return true
}
return false
}
proc ::deken::utilities::substpath {path} {
set result [string map "@PD_PATH@ $::sys_libdir" $path]
return $result
}
proc ::deken::utilities::verbose {level message} {
::pdwindow::verbose ${level} "\[deken\]: "
::pdwindow::verbose ${level} ${message}
::pdwindow::verbose ${level} "\n"
}
if { [catch {package require zipfile::decode} ] } {
proc ::deken::utilities::unzipper {zipfile {path .}} {
## this is w32 only
if {$::tcl_platform(platform) eq "windows"} { } { return 0 }
## create script-file
set vbsscript [::deken::get_tmpfilename [::deken::gettmpdir] ".vbs" ]
set script {
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
'The location of the zip file.
ZipFile = fso.GetAbsolutePathName(WScript.Arguments.Item(0))
'The folder the contents should be extracted to.
ExtractTo = fso.GetAbsolutePathName(WScript.Arguments.Item(1))
'If the extraction location does not exist create it.
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
'Extract the contents of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
'In case of an error, exit
If Err.Number <> 0 Then
Err.Clear
WScript.Quit 1
End If
Set fso = Nothing
Set objShell = Nothing
}
if {![catch {set fileId [open $vbsscript "w"]}]} {
puts $fileId $script
close $fileId
}
if {[file exists $vbsscript]} {} {
## still no script, give up
return 0
}
## try to call the script
## (and windows requires the file to have a .zip extension!!!)
if { [ catch {
set zipfilezip ${zipfile}.zip
file rename ${zipfile} ${zipfilezip}
exec cscript "${vbsscript}" "${zipfilezip}" .
file rename ${zipfilezip} ${zipfile}
} stdout ]
} {
catch { file rename ${zipfilezip} ${zipfile} }
catch { file delete "${vbsscript}" }
::pdwindow::debug "\[deken\] VBS-unzip($vbsscript): $stdout\n"
return 0
}
catch { file delete "${vbsscript}" }
return 1
}
} { # successfully imported zipfile::decode
proc ::deken::utilities::unzipper {zipfile {path .}} {
::zipfile::decode::unzipfile "${zipfile}" "${path}"
return 1
}
}
set ::deken::_vbsunzip ""
proc ::deken::utilities::extract {installdir filename fullpkgfile} {
# installdir fullpkgfile filename
set PWD [ pwd ]
cd $installdir
set success 1
if { [ string match *.dek $fullpkgfile ] } then {
if { [ ::deken::utilities::unzipper $fullpkgfile $installdir ] } { } {
if { [ catch { exec unzip -uo $fullpkgfile } stdout ] } {
::pdwindow::debug "$stdout\n"
set success 0
}
}
} elseif { [ string match *.zip $fullpkgfile ] } then {
if { [ ::deken::utilities::unzipper $fullpkgfile $installdir ] } { } {
if { [ catch { exec unzip -uo $fullpkgfile } stdout ] } {
::pdwindow::debug "$stdout\n"
set success 0
}
}
} elseif { [ string match *.tar.* $fullpkgfile ]
|| [ string match *.tgz $fullpkgfile ]
} then {
if { [ catch { exec tar xf $fullpkgfile } stdout ] } {
::pdwindow::debug "$stdout\n"
set success 0
}
}
cd $PWD
if { $success > 0 } {
::pdwindow::debug [_ "\[deken\] " ]
::pdwindow::debug [format [_ "Successfully unzipped %1\$s into %2\$s."] $filename $installdir ]
::pdwindow::debug "\n"
if { "$::deken::keep_package" } { } {
catch { file delete $fullpkgfile }
}
} else {
# Open both the fullpkgfile folder and the zipfile itself
# NOTE: in tcl 8.6 it should be possible to use the zlib interface to actually do the unzip
::pdwindow::error [_ "\[deken\] Unable to extract package automatically." ]
::pdwindow::error "\n"
::pdwindow::post [_ "Please perform the following steps manually:" ]
::pdwindow::post "\n"
::pdwindow::post [format [_ "1. Unzip %s." ] $fullpkgfile ]
::pdwindow::post "\n "
::pdwindow::post [_ "You might need to change the file-extension from .dek to .zip" ]
::pdwindow::post "\n"
pd_menucommands::menu_openfile $fullpkgfile
::pdwindow::post [format [_ "2. Copy the contents into %s." ] $installdir]
::pdwindow::post "\n"
::pdwindow::post [format [_ "3. Remove %s. (optional)" ] $fullpkgfile ]
::pdwindow::post "\n"
pd_menucommands::menu_openfile $installdir
}
}
proc ::deken::utilities::uninstall {path library} {
# recursively remove ${path}/${library} if it exists
set fullpath [file join ${path} ${library}]
if {[file exists ${fullpath}]} {
::pdwindow::debug [format [_ "\[deken\] uninstalling '%s'" ] ${fullpath} ]
::pdwindow::debug "\n"
if { [catch {
file delete -force "${fullpath}"
} stdout ] } {
::pdwindow::debug [format [_ "Uninstalling %1\$s from %2\$s failed!"] ${library} ${path}]
::pdwindow::debug "\n $stdout\n"
return 0
}
}
return 1
}
if { [catch {package require sha256} ] } {
proc ::deken::utilities::verify_sha256 {url pkgfile} {
::deken::utilities::verbose 0 [format [_ "skipping SHA256 verification of %s." ] $url ]
return 1
}
} { # successfully imported sha256
proc ::deken::utilities::verify_sha256 {url pkgfile} {
set retval 1
if { [ catch {
set hash [string trim [string tolower [ ::sha2::sha256 -hex -filename $pkgfile ] ] ]
set hashfile [::deken::download_file ${url}.sha256 [::deken::get_tmpfilename [::deken::gettmpdir] ".sha256" ] ]
if { "$hashfile" eq "" } {
::deken::utilities::verbose 0 [format [_ "unable to fetch reference SHA256 for %s." ] $url ]
set retval 1
} {
set fp [open $hashfile r]
set reference [string trim [string tolower [read $fp] ] ]
close $fp
catch { file delete $hashfile }
if { "${hash}" eq "${reference}" } {
set retval 1
} {
# SHA256 verification failed...
set retval 0
}
}
} stdout ] } {
::deken::utilities::verbose 0 "\[deken\] $stdout\n"
# unable to verify
::deken::utilities::verbose 0 [format [_ "unable to perform SHA256 verification for %s." ] $url ]
set retval 1
}
return ${retval}
}
}
proc ::deken::utilities::rmrecursive {path} {
# recursively remove ${path} if it exists, traversing into each directory
# to delete single items (rather than just unlinking the parent directory)
set errors 0
set myname [lindex [info level 0] 0]
set children [glob -nocomplain -directory $path -types hidden *]
lappend children {*}[glob -nocomplain -directory $path *]
foreach child $children[set children {}] {
if {[file tail $child] in {. ..}} {
continue
}
if {[file isdirectory $child]} {
if {[file type $child] ne "link"} {
incr errors [$myname $child]
}
}
if { [ catch { file delete -force $child } ] } {
incr errors
}
}
return $errors
}
proc ::deken::utilities::newwidget {basename} {
# calculate a widget name that has not yet been taken
set i 0
while {[winfo exists ${basename}${i}]} {incr i}
return ${basename}${i}
}
if { [ catch { set ::deken::installpath [::pd_guiprefs::read dekenpath] } stdout ] } {
# this is a Pd without the new GUI-prefs
proc ::deken::set_installpath {installdir} {
set ::deken::installpath $installdir
}
proc ::deken::set_platform_options {platform hide} {
set ::deken::userplatform $platform
set ::deken::hideforeignarch [::deken::utilities::bool $hide ]
}
proc ::deken::set_install_options {remove readme add keep verify256} {
set ::deken::remove_on_install [::deken::utilities::bool $remove]
set ::deken::show_readme [::deken::utilities::bool $readme]
set ::deken::add_to_path [::deken::utilities::tristate $add 0 0]
set ::deken::keep_package [::deken::utilities::bool $keep]
set ::deken::verify_sha256 [::deken::utilities::bool $verify256]
}
} {
# Pd has a generic preferences system, that we can use
proc ::deken::set_installpath {installdir} {
set ::deken::installpath $installdir
::pd_guiprefs::write dekenpath $installdir
}
# user requested platform (empty = DEFAULT)
set ::deken::userplatform [::pd_guiprefs::read deken_platform]
set ::deken::hideforeignarch [::deken::utilities::bool [::pd_guiprefs::read deken_hide_foreign_archs] 1]
proc ::deken::set_platform_options {platform hide} {
set ::deken::userplatform $platform
set ::deken::hideforeignarch [::deken::utilities::bool $hide ]
::pd_guiprefs::write deken_platform "$platform"
::pd_guiprefs::write deken_hide_foreign_archs $::deken::hideforeignarch
}
set ::deken::remove_on_install [::deken::utilities::bool [::pd_guiprefs::read deken_remove_on_install] 1]
set ::deken::show_readme [::deken::utilities::bool [::pd_guiprefs::read deken_show_readme] 1]
set ::deken::keep_package [::deken::utilities::bool [::pd_guiprefs::read deken_keep_package] 0]
set ::deken::verify_sha256 [::deken::utilities::bool [::pd_guiprefs::read deken_verify_sha256] 1]
set ::deken::add_to_path [::deken::utilities::tristate [::pd_guiprefs::read deken_add_to_path] ]
proc ::deken::set_install_options {remove readme path keep verify256} {
set ::deken::remove_on_install [::deken::utilities::bool $remove]
set ::deken::show_readme [::deken::utilities::bool $readme]
set ::deken::add_to_path [::deken::utilities::tristate $path]
set ::deken::keep_package [::deken::utilities::bool $keep]
set ::deken::verify_sha256 [::deken::utilities::bool $verify256]
::pd_guiprefs::write deken_remove_on_install "$::deken::remove_on_install"
::pd_guiprefs::write deken_show_readme "$::deken::show_readme"
::pd_guiprefs::write deken_add_to_path "$::deken::add_to_path"
::pd_guiprefs::write deken_keep_package "$::deken::keep_package"
::pd_guiprefs::write deken_verify_sha256 "$::deken::verify_sha256"
}
}
set ::deken::backends [list]
proc ::deken::register {fun} {
# register a searchfunction with deken.
# the searchfunction will be called with a ,
# and must return a list of .
# is a list of (whitespace separated) words.
# each word denotes a library or library-object to search for and may
# contain wildcards ("*").
# the should be normalized via ::deken::search::normalize_result
# failing to do so, a is a list
# - non-empty name of the library (to be shown to the user as search-result)
# - the full command to run to install the library
# - boolean value to indicate whether this entry matches the current architecture
# - additional text to be shown under the
# - additional text to be shown in the STATUS line if the mouse hovers over the result
# - ... additional args (ignored)
# the library must be non-empty (and empty value is reserved for normalized results)
set ::deken::backends [linsert $::deken::backends 0 $fun]
}
proc ::deken::normalize_result {title
cmd
{match 1}
{subtitle ""}
{statusline ""}
{contextmenus {}}
args} {
## normalize a search-result
# the function parameters are guaranteed to be a stable API (with the exception or args)
# but the value returned by this function is an implementation detail
# the primary line displayed for the search-result
# - the full command to run to install the library
# - boolean value to indicate whether this entry matches the current architecture
# - additional text to be shown under the
# - additional text to be shown in the STATUS line if the mouse hovers over the result
# - list of