[Distutils] VBScript puzzle

"Martin v. Löwis" martin at v.loewis.de
Mon Mar 22 21:25:55 CET 2010


> Looks like we need JScript (what can that do, though?) or VBScript.

Not sure whether users could accept writing JScript or VBScript for
bdist_msi, so (atleast for bdist_msi), I would like to either support
Python pre-install scripts, or not support pre-install scripts at all.

The question is whether we could trick a VBScript into also being a
Python script.

As this might be an interesting puzzle to solve, I'd like to pose it to
the entire distutils-sig readership. So here is the problem again:

As a batch file, my attempt at having a batch file that is also a
Python script was to write it as

rem="""
%1 %0
exit
"""
<python code here>

This should have been run with argv[1] being the path to the Python
interpreter. As a batch file, the first line is a comment, the second
line runs Python, anbd the third line terminates the script (so it
doesn't consider the following lines). As a Python script, the first
block is a variable assignment, followed by the regular Python script.

Now (as Installer won't run batch files) we need the same as VBScript
(or, failing that, as JScript). The script would be computed at the time
of MSI generation.

TIA,
Martin


More information about the Distutils-SIG mailing list