[DDG] 2020-02-25: Below is a small utility script which writes all `package require` calls to stdout. This is useful to check if making a release of your application which packages are required for your a application. It shows recursively all packages on the terminal. I use this to create standalone files which contains all embedded modules before the actual application script using the script `mk_tm.tcl` at the bottom of the wiki page [Another Tcl module maker]. So this helps in creating single file Tcl applications where the application is the last file and all modules files are added before. Here is the code: ====== #!/bin/env tclsh # file pkgDeps.tcl rename package package.orig proc package {args} { set subcmd [lindex $args 0] if {$subcmd eq "require"} { puts stderr "package require $args" } package.orig {*}$args } if {[info exists argv0] && $argv0 eq [info script]} { if {[llength $argv] == 0} { puts "Usage: [info script] app.tcl ?other args?" exit 0 } set ::argv0 [lindex $argv 0] set ::argv [lrange $argv 1 end] source $argv0 } ====== Example call for the package [mkdoc::mkdoc]: ====== $ checkPkg.tcl mkdoc.tcl package require require Tcl 8.4 package require require Markdown package require require Tcl 8.4 package require require Tcl 8.2 package require require Tcl package require require Tcl package require require textutil package require require Tcl 8.2 package require require textutil::string package require require Tcl 8.2 package require require textutil::repeat package require require Tcl 8.2 package require require textutil::adjust package require require Tcl 8.2 package require require textutil::repeat package require require textutil::string package require require textutil::split package require require Tcl 8.2 package require require textutil::tabify package require require Tcl 8.2 package require require textutil::repeat package require require textutil::trim package require require Tcl 8.2 ... ====== Now my Makefile to create the application: ====== app: tclsh ../tools/mk_tm.tcl mkdoc 0.4 \ any-script ../libs/textutil/string.tcl \ any-script ../libs/textutil/repeat.tcl \ any-script ../libs/textutil/adjust.tcl \ any-script ../libs/textutil/expander.tcl \ any-script ../libs/textutil/split.tcl \ any-script ../libs/textutil/tabify.tcl \ any-script ../libs/textutil/trim.tcl \ any-script ../libs/textutil/textutil.tcl \ any-script ../libs/markdown/markdown.tcl \ any-script mkdoc.tcl ====== Using a [tclkit] interpreter, which does not(!) use the Tcl library on the current machine, I can check if the order of the files in the output followes the inverse calling order in `package require`. Means that because "Markdown" needs "textutils" the latter must be added first. '''Discussion:''' Please discuss here ...