classification
Title: bdist_wininst preinstall script support is broken in 2.5a1
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: paul.moore, theller
Priority: high Keywords:

Created on 2006-04-06 16:40 by paul.moore, last changed 2006-04-18 19:48 by theller. This issue is now closed.

Files
File name Uploaded Description Edit
simple_module.zip paul.moore, 2006-04-06 16:40 Sample code demonstrating the bug
pythonrun.diff theller, 2006-04-12 20:12 Re-export the functions again.
Messages (7)
msg28137 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2006-04-06 16:40
The attached zip file contains a trivial module. Run
"run_setup.bat" to create a bdist_wininst installer
(you'll need to edit it to make the preinstall script
path match where you unzipped the file).

The resulting installer fails with an error "Running the
pre-installation script failed".
msg28138 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-04-06 18:22
Logged In: YES 
user_id=11105

bdist_wininst7.1.exe uses runtime dynamic linking to the
python dll.  Python25.dll doesn't export a
PyRun_SimpleString function anymore, it has been replaced by
a macro:
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)

bdist_wininst *could* be changed to use
PyRun_SimpleStringFlags instead, however, installers built
with previous versions of Python will then refuse to install
pure distributions to Python 2.5.

I have not checked if installers that do *not* have a
pre-install script will work or not.

I suggest to make PyRun_SimpleString an exported function
again - this should be cheap.
msg28139 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2006-04-06 20:01
Logged In: YES 
user_id=113328

Seems to be limited to installers with preinstall scripts,
as far as I can tell. The main example is pywin32, which is
irritatingly significant :-)

(One oddness I couldn't check is that scripts don't seem to
get compiled any more - don't know if this is related to the
same issue. It's not a big deal either way, though).

The fix sounds reasonable.
msg28140 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-04-11 17:19
Logged In: YES 
user_id=11105

These apis are now macros, they were exported functions in
Python 2.4:

PyParser_SimpleParseFile
PyParser_SimpleParseString
PyRun_AnyFile
PyRun_AnyFileEx
PyRun_AnyFileFlags
PyRun_File
PyRun_FileEx
PyRun_FileFlags
PyRun_InteractiveLoop
PyRun_InteractiveOne
PyRun_SimpleFile
PyRun_SimpleFileEx
PyRun_SimpleString
PyRun_String
Py_CompileString

All of them, to be safe, should probably exposed as exported
functions again.

See also this thread on python-dev:

http://mail.python.org/pipermail/python-dev/2006-January/059374.html

Raising the priority to 7 because this must be fixed before
release.
msg28141 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-04-12 20:12
Logged In: YES 
user_id=11105

Attached a patch which should fix this issue.

Paul, if you want do further tests *now* I can upload a
python25.dll, compiled from current SVN + patch, somewhere.
Hopefully this will be compatible with a 2.5a1 installation.
msg28142 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2006-04-16 14:18
Logged In: YES 
user_id=113328

Thomas,
As I've just got my own build environment set up with the
free MS compiler, I thought I'd show off and build my own
copy :-)

I can confirm that with the patch, the pywin32 installer
also works (the one real-life case of a preinstall script
that I know).

Also, this patch fixes another funny issue I'd not quite
managed to isolate - installers were failing to compile .py
files (and conversely, the uninstaller was leaving .pyc
files behind).

Paul.
msg28143 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-04-18 19:48
Logged In: YES 
user_id=11105

Compiling .py to .pyc/.pyo works the same way as the
preinstall-script: By dynamically loading a pythonXY.dll and
calling functions in it.  The difference is that there's no
error message when loading fails because of missing
functions ;-).
History
Date User Action Args
2006-04-06 16:40:20paul.moorecreate