Closed stonebig closed 2 months ago
It's arbitrary in that there was no particular reason I chose it, but it is hard coded. If you want to change it, you need to change the stub and rebuild mkshim.py
.
To be honest, I don't even remember how to rebuild mkshim.py
- briefly checking stub.c
, it seems to have a different marker, suggesting that there's either a step I did that I've since forgotten, or the stub source is out of date with mkshim.py
.
So, looking on the super-simple code of 2014-08-04 end-of-day, time of the 'glorious' mkshim.py the supposed limit at the time was 1024 characters. So I'll get adventurous on myself to see if 200 characters can bite me.
maybe didn't look at the right place...
mkshim.py
assumes the version of stub.c
that's in https://github.com/pfmoore/shimmy/commit/7bcbf56fbc207a0208035b610a69e16e81861c2c
See the section "Current WIP changes (undocumented)" for how the current code works (in particular, you don't need mkshim.py
, you just compile stub.c
and prepend it to your executable).
So I'll get adventurous on myself to see if 200 characters can bite me.
You'll probably get bitten by https://github.com/pfmoore/shimmy/blob/master/mkshim.py#L27 which assumes that the embedded stub executable contains the marker string (100 "X"s).
Honestly, you'd probably be better simply modifying the stub.c
code to hardcode the command you want to run, and compiling a custom shim that way.
Yes, so:
cl stub200.c
python build200.py
and then, apparently, this works:
python mkshim200.py -f my_IDLE_python201.exe -c "./python-3.13.0rc1.amd64/python.exe ./python-3.13.0rc1.amd64/Lib/idlelib/idle.pyw"
the new launchers are still a bit bigger, even if I do the exercise for 100. I presume modern Visual Studio includes more stuff.
don't know how to make it back in you original size of 54k, now stuck at 107K
I really don't recall. Maybe I was just using an older version of MSVC, which had a leaner C runtime? The executable wrappers pip produces are about 108k, scoop produces shims that are 120k or so, the py.exe
launcher is 766k. So I don't think anyone really cares in practice about squeezing the last byte out of a wrapper executable on Windows these days...
my work is in https://github.com/stonebig/shimmy/tree/shimmy240
is the 100 character limit arbitrary ? If not, how to get to 200 ?
Do we just need to replace "100" per "200" in https://github.com/pfmoore/shimmy/blob/master/mkshim.py ?