[python-win32] Re: PyWin32 extensions can now be built using distutils

Thomas Heller theller at python.net
Tue Dec 2 04:44:28 EST 2003


"Mark Hammond" <mhammond at skippinet.com.au> writes:

> This is for anyone who builds PyWin32/win32all from CVS source code.
>
> Currently, the instructions for building these extensions require you to use
> Visual Studio, and perform lots of magic fiddling to get everything
> installed and working.  But thanks to Thomas Heller, we now have a
> 'distutils' setup script that does all this magic for you.
>
> I'd like anyone who builds from sources (or anyone who would like to, but
> failed in the past) to try this out for me.  Eventually, I will update the
> build instructions accordingly to make this the 'official' way to build and
> install these extensions from source.  You still need MSVC (but should *not*
> need Visual Studio - only the command-line compiler is used)
>
> To test this, follow these instructions:
> * Remove any win32all installations, and remove any previously built
> win32all extensions.  This isn't strictly necessary, but will help me to
> ensure that everything works.  It will also avoid one or 2 duplicate files
> (notably, the .exe files)
> * Pull the latest source-code from CVS - see the project sourceforge page.
> * In the root directory, execute 'setup_win32all.py', with no arguments.
> This will print a couple of pages of usage information, including what
> params you use to build and install.  The short course is "setup_win32all.py
> install" will build and install all the extensions.
>
> Once installed, you will find all built .pyd/.dll/.exe files, and .py files,
> installed into your "site-packages" directory, as a normal win32all
> installation would do.  You can build for multiple versions of Python simply
> by changing the 'python.exe' used to execute 'setup_win32all.py'.
> Instructions are also provided for building (and installing) debug versions
> of the extensions.
>
> If anyone does try this, please let me know how you go - successful or
> otherwise.

Well, I had to make a couple of changes to get this to work on a fresh
CVS checkout (diffs are attached):

- I had to comment out 'pywin32.chm', this is not (yet) built.

- I commented out the exchange and exchdapi extensions because some
files were not found by the compiler (but I don't care about these).

- I had to comment out the shell extension, this failed with linker
errors (Hm, seems I cannot reproduce this).

Then building of permondata.dll failed, because the script tries to
compile perfmondata.cpp first, and complais about a missing PyPerfMsgs.h
file.  The latter would be created by processing PyPerfMsgs.mc with the
messaage compiler.  Therefore I changed the WinExt.get_sourcefile()
method to sort the source files depending on the filename extension -
but this requires a change to the msvccompiler class also.

After these changes, I could build an install everything, and even
Pythonwin.exe works!

'setup.py bdist_wininst' doesn't really work, but that is for later.

Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup_win32all.py.diff
Type: text/x-patch
Size: 3463 bytes
Desc: Patch for setup_win32all.py
Url : http://mail.python.org/pipermail/python-win32/attachments/20031202/ce4a4da7/setup_win32all.py.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvccompiler.py.diff
Type: text/x-patch
Size: 949 bytes
Desc: Patch for msvccompiler.py
Url : http://mail.python.org/pipermail/python-win32/attachments/20031202/ce4a4da7/msvccompiler.py.bin


More information about the Python-win32 mailing list