As stated in the title:; I have a "small" python exe GUI program generated by pyinstaller which creates a tcl folder that has 820 files (mostly tzdata). Any chance of reducing this number?
It takes a long time to copy the program because of all the tiny files.
I've used the datetime library. I just need the date and time to pop up on a pdf that I'm printing, so doesn't need to be that fancy. I just need the time on the computer :)
I can use "--onefile" to just get the .exe, but that takes too long to open.
Program is only for Windows atm.
If you don't mind adding a native dynamic library (dll/so), you can use
tclvfs
, a Tcl extension, and store those 820 files in a zip file.AFAIK,
tclvfs
doesn't extract the files to a temp directory like pyinstaller's "--onefile" (unless you try to load a native extension), so it should be fast.Walkthrough
Acquire the extension
You can either build from source or grab the Windows binaries from msys2. The msys2 binaries are a bit outdated (from 2013) but will still work.
Extract the package under the tcl directory. You only need
pkgIndex.tcl
,vfs.tcl
,vfs142.dll
,vfslib.tcl
,vfsUtils.tcl
, andzipvfs.tcl
for mounting zip files. Put them under.../tcl/tclvfs
.Zip the loose files
Pack all the original files in the
tcl
directory intolibrary.zip
. You can do the same withtk
(under thetk
directory).Those files need to stay in the
tcl
directory:init.tcl
,package.tcl
,tclIndex
,tm.tcl
(for loading packages).Patch
init.tcl
Add the following to
init.tcl
to loadlibrary.zip
.Now you have 11 files instead of 820.