[Distutils] Self-contained boostrap scripts [was: Re: A new, experimental packaging tool: distil]

Steve Dower Steve.Dower at microsoft.com
Thu Mar 28 23:19:07 CET 2013


Daniel Holth wrote:
> On Thu, Mar 28, 2013 at 3:49 PM, PJ Eby <pje at telecommunity.com> wrote:
>> On Thu, Mar 28, 2013 at 1:54 PM, Steve Dower <Steve.Dower at microsoft.com> wrote:
>>> And, I'm almost certain that most if not all existing ZIP tools on
>>> Windows will fail to open files with a shebang, since they've
>>> never had to deal with them.
>>
>> Actually, the opposite is true, at least for 3rd-party (non-Microsoft) 
>> archiving tools: they work even when there's a whole .exe file stuck 
>> on the front.  ;-)
>>
>> Some of them require you to rename from .exe to .zip first, but some 
>> actually detect that an .exe is a stub in front of a zip file and give 
>> you extraction options in an Explorer right-click.
>>
>> So, no worries on the prepended data front, even if the extension is 
>> .zip.  What you probably can't safely do is *modify* a .zip with 
>> prepended data...  and there I'm just guessing, because I've never 
>> actually tried.
>
> It will all work. ZIP is cool! Every offset is relative from the end of the file.
>
> The wheel distribution even has a ZipFile subclass that lets you pop() files
> off the end by truncating the file and rewriting the index. This will work
> on any ordinary zip file that is just the concatenation of the compressed
> files in zip directory order, without data or extra space between the
> compressed files.

Ah of course, I totally forgot that it works from the end of the file.

I'd still rather they got a new extension though, since nobody is going to teach WinZip what "#! python" means. That's probably an issue for the handful of Windows devs on python-dev rather than here, though.


Cheers,
Steve



More information about the Distutils-SIG mailing list