[Distutils] How to handle launcher script importability?

Paul Moore p.f.moore at gmail.com
Tue Aug 13 21:58:57 CEST 2013

On 13 August 2013 18:08, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

> On 13 August 2013 17:33, Paul Moore <p.f.moore at gmail.com> wrote:
> >
> > On another point you mention, Cygwin Python should be using Unix-style
> shell
> > script wrappers, not Windows-style exes, surely? The whole point of
> Cygwin
> > is that it emulates Unix, after all... So I don't see that as an argument
> > either way.
> So say I have a ~/bin directory where I put my scripts that I want to
> be generally available. I install something with
>     python setup.py install --install-scripts=~/bin
> so that the scripts/script-wrappers go in there because I want to be
> able to always access that program under that name. Don't be fooled by
> the unixy tilde: I'm running ordinary Windows Python in that command
> in git-bash, not Cygwin. Now if that folder is on PATH while I am in
> Cygwin I can run the program with the same name if an .exe wrapper was
> added. I can't run it with the same name if it's a .py/,bat file
> because Cygwin doesn't have the implicit strip-the-extension PATHEXT
> feature and can't run .bat files.

Ah, OK, thanks for the clarification.

In that case I can see why you'd prefer exe wrappers (or maybe cygwin bash
shell wrappers, or shell aliases...). Maybe an option to still use exe
wrappers is worth it - but honestly, I'd say that in that context you
probably have enough expertise to understand the issue and make your own
solution relatively easily.

What about having in your .bashrc:

for prog in ls ~/bin/*.py; do
    alias $(basename $prog .py)=$prog

(Excuse me if I got the precise details wrong there). OK, you need to rerun
.bashrc if you add new scripts. It's not perfect. But it's not a
showstopper either.

I do think, as I said before, that this needs some sort of policy-type PEP
on the standard approach for wrapping scripts, with all the pros and cons
of the various approaches documented and reviewed.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130813/3de85cc4/attachment.html>

More information about the Distutils-SIG mailing list