[ python-Bugs-870479 ] Scripts need platform-dependent handling

SourceForge.net noreply at sourceforge.net
Mon Jan 5 11:25:47 EST 2004


Bugs item #870479, was opened at 2004-01-04 19:00
Message generated for change (Comment added) made by pmoore
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=870479&group_id=5470

Category: Distutils
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Per Cederqvist (ceder)
Assigned to: Nobody/Anonymous (nobody)
Summary: Scripts need platform-dependent handling

Initial Comment:
When a  script is installed on Unix, it should be named
something like "mailman-discard", with no extension.
When it is installed on Windows, it should be named
"mailman-discard.py", so that it is associated with
Python.  I think that "scripts" should be smart enough
to handle this.

My suggestion is that "scripts" should be set to a list
of the scripts, including the extension, and that
distutils will remove the extension when it installs
programs on platforms where this is true:

    os.name == 'posix'

It is possible to override the install_scripts class to
get this behaviour, but if you want to make a binary
distribution you also have to override bdist_wininst,
et c, since the install_scripts class is used on the
host system while building a directory tree that will
later be installed on the target system. See this
example script:

http://cvs.lysator.liu.se/viewcvs/viewcvs.cgi/mailman-discard/setup.py?rev=1.2&cvsroot=mailman-discard&content-type=text/vnd.viewcvs-markup
 
Peter Åstrand also suggests that on Windows, you should
create a command file named "mailman-discard.cmd" and
put it in the same directory as the
"mailman-discard.py" file.  It should contain a single
line:

start %~dp0\mailman-discard.py

That way, you will be able to start the script from a
dos shell, and not just by double-clicking it in a file
browser.  It would be nice if Distutils created this
file automatically when installing on the win32 platform.

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2004-01-05 16:25

Message:
Logged In: YES 
user_id=113328

Having a ".cmd" file isn't a good idea. For a start, it isn't 
Windows 9x compatible (and %~dp0 isn't available in 
command.com). Also, you need to include a way of passing 
any command line arguments on to the script. And 
finally, "start" probably isn't right. This will run the command 
in a new console window, rather than in the existing console.

A XXX.cmd file which just does @%~dp0\XXX.py %* is 
better, but I still don't think it's needed. Just adding ".py" to 
PATHEXT (which is something the user can do if they want, 
at the same time they add the Python scripts directory to 
their PATH) is enough, at least on NT/2000/XP.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=870479&group_id=5470



More information about the Python-bugs-list mailing list