[mod_python] Win32 platform - compiling psp

David Fraser davidf at sjsoft.com
Fri Mar 5 13:04:35 EST 2004


David Fraser wrote:

> Gregory (Grisha) Trubetskoy wrote:
>
>> [snip]
>>  
>>
>>> To build the win32 installer it needs to be done in the dist directory
>>> (apparently under Unix)
>>> I had troubles trying to run configure on MinGW as it needs an apxs to
>>> find...
>>> but the APXS is not actually needed for the setup script (the code that
>>> used it is commented out)
>>> So I ran configure on Linux, and built the installer there...
>>> This is done by copying src/Release/mod_python.so to the dist 
>>> directory.
>>>   
>>
>>
>> not anymore, it now can be done under windows. In fact it *has* to 
>> because
>> this step also compiles _psp.
>>
>> you DO need to manually create a setup.py from setup.py.in since
>> ./configure, as you noted, won't work on windows
>>
>>  
>>
>>> In fact I found that by simply copying the setup.py generated on 
>>> Linux I
>>> could run this on Windows
>>> The instruction is:
>>>  setup.py bdist_wininst --install-script=win32_postinstall.py
>>>   
>>
>>
>> perhaps distutils take care of it automtically, but I've always
>> done it separately, building the mod_python package for the standard 
>> lib,
>> which would be a step just before the bdist_wininst.
>>
>> I had to copy src and mod_python (in lib/python) to under dist (on unix
>> the makefiles creates symlinks, but they don't work under windows, so 
>> you
>> have to copy), then run
>>
>> (This has to be run from the VC++ msdos shell, since it will invoke the
>> compiler to build _psp.so (or _psp.dll, don't remember))
>>
>> python setup.py build
>>  
>>
>
> OK, trying to get the win32 build for psp going ...
> Previous message from Grisha on the subject (sent privately to me on 
> 08/21/2003 07:15 PM):
>
>> The you'll need to build _psp.so - that you need to do in the dist
>> directory, and you will need to manually create a setup.py file from
>> setup.py.in. I think you will also need to copy src and lib into dist in
>> order to make it work. Then you do python setup.py build and it should
>> produce _psp.so.
>>
>> Ah, also, you'll need to edit psp_parser.c and comment out a 
>> reference to
>> unistd.h, also need to do that in include/psp_flex.h.
>>  
>>
> There's a option nounistd in the psp_parser.l code which doesn't work.
> However, adding --nounistd to the flex command line does work (it 
> removes the includes nicely)
> This also sorts out include/psp_flex.h
> It's worth noting that flex 2.5.31 compiles and works out of the box 
> on CygWin (but not MinGW).
>
> Anyway I have now modified the setup.py.in so that it can be used to 
> compile without manually copying the src and lib directories.
> The paths are determined automatically. I have tested this on Windows 
> and Linux but obviously it would need further testing...
> I attach a patch for setup.py.in
> With this, mod_psp compiles successfully on Windows and passes the 
> tests...
> I also tried getting the install script to run automatically without 
> having to specify it on the command line but distutils makes it tricky...
>
> Cheers
> David

Sorry, bad patch...

>+if winbuild:
>+    scripts = ["win32_postinstall.py"]
>+    data_files = [(os.path.join(getmp_srcdir(), 'Release'), ["mod_python.so"])]
>  
>
This should be:

    scripts = ["win32_postinstall.py"]
    # put the mod_python.so file in the Python root ...
    # win32_postinstall.py will pick it up from there...
    data_files = [("", [(os.path.join(getmp_srcdir(), 'Release', 
'mod_python.so'))])]

But I'll fix it all up properly when I combine everything...

I also suspect our method of detecting compiling on Windows is a bit 
strange ... it only adds the scripts in if we're building a windows 
distribution.
But this is impossible from Unix anyway (since you can't compile the C 
extensions...) so maybe we should just detect the current platform

Cheers
David


More information about the Mod_python mailing list