[Distutils] small improvement of the script functionality under win32

Phillip J. Eby pje at telecommunity.com
Sat Apr 2 21:52:58 CEST 2005


At 10:45 AM 4/2/05 +0100, Paul Moore wrote:
>On Apr 2, 2005 9:06 AM, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 08:37 AM 4/2/05 +0200, Vivian De Smedt wrote:
> >
> > >The change in the she bang will happend only if
> > >  - the win32 platform is detected (os.name == "nt")
> > >  - the platform is win NT son (os.environ["OS"] == "Windows_NT")
> >
> > You really need to check that COMSPEC points to cmd.exe, since as someone
> > pointed out you can actually have an NT machine using command.com as its
> > COMSPEC, which means it won't be able to run this either.
>
>And just to be annoying, my COMSPEC (sometimes) points to 4NT.EXE, and
>I can use this feature.
>
>I support the idea, but it may not be practical. To be honest,
>shipping the files with a .py extension (which is directly associated
>with Python) in the first place is probably a better answer.

Actually, with the availability of -m, it probably makes more sense to add 
the ability to specify "script modules", mapping from a desired command 
name to a module to be run as __main__.  Then, you can generate a 
platform-specific stub to run "python -m modulename".  On Windows that 
could be a .bat, and on Unixish systems there could be no extension.  This 
wouldn't help existing distributions with scripts, or anything for Python 
<2.4, but it seems like the "right" way to fix the problem in the long term.



More information about the Distutils-SIG mailing list