[Distutils] Installing scripts

Fred L. Drake, Jr. fdrake at acm.org
Thu Jun 10 12:01:29 EDT 2004


Tim Peters and I have recently been beating our heads over what the right 
approach to deal with scripts in cross-platform software.  It's not clear 
that we've reached any conclusions at all, but I think this is an interesting 
issue for the Distutils SIG, since distutils is involved in installing 
scripts.

The issue is that the expectations of end-users on Unix and Windows differ 
substantially.  Unix users generally expect that scripts will not have 
extensions and don't need to have a specific interpreter named on the command 
line (since that's what sh-bang lines are for).  Windows users really expect 
an icon to click on, and are massively confused by extension-less files.  
Windows encourages this confusion.  Adding a .py extension to Python scripts 
on Windows allows the user to at least not have to add the path to the Python 
interpreter on the command line if they want to run the script using the 
default Python installation (meaning "the one registered to handle the .py 
extension").

This can be handled by passing a different value to the current script= 
keyword argument to distutils.core.setup() based on os.name, and having 
versions of scripts for Windows and Unix.  This seems tedious at best, but 
works, and allows flexibility in implementing the scripts differently for the 
two platforms.

I'm interested in hearing about how others are handling this issue for 
software that's intended to work on both Unix and Windows.  Is there a better 
approach?  I'd love to find a better way to support end-user expectations 
across platforms, especially if it could involve less magic in the setup.py 
script.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation




More information about the Distutils-SIG mailing list