[pywin32-bugs] Building PyWin32 into Python as built-in
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: A <abc...@gm...> - 2017-10-02 20:39:34
|
Hello, I need some assistance please regarding building PyWin32. I hope that this is the correct mailing list to ask this, but if not, please direct me to the right place. I'm wondering if it's possible to build PyWin32 into Python as a built-in module? I would like to do this with Python 2.7.13 64-bit for Windows. I have Microsoft Visual Studio 2008 and VS 2010 Service Pack 1 installed, and I have built Python from the source code with "pcbuild.sln". I found that most of the modules distributed with Python can be made to be built-in by changing the module's project type to be "Static library (.lib)" rather than a DLL project, adding "Py_BUILD_CORE;Py_NO_ENABLE_SHARED;" to the module project's preprocessor directives, changing the project references so that the "pythoncore" project refers to the module's project rather than the module's project referring to "pythoncore", and adding corresponding lines for the module in "PC\config.c" (in the "pythoncore" project). (There are a few more steps/hacks needed for some of the modules, but that is the basic process.) I can do this because the modules distributed with Python ("bz2", "_ctypes", etc.) are Visual Studio projects. However, PyWin32 is much different because it is built with Python Distutils and a "setup.py" script, not a Visual Studio project/solution. Usually, PyWin32 would be built with the command "python setup.py {build|install}". I have tried playing with command-line options to no avail thus far. I have also tried including all of the .c, .cpp, .cxx, .h, etc. files from the PyWin32 source directories into the "pythoncore" Visual Studio project, but this didn't end up working. I figure that I would need to do one of two things: either (a) the PyWin32 modules need to be built as static library (.lib) files rather than .pyd files somehow, and "pythoncore" needs to link to those .lib files (like I did with the modules distributed with Python), or (b) I need to include PyWin32's source files into the "pythoncore" project somehow (and the way that I tried it was incorrect for some reason). Can someone please provide guidance as to how I can properly build PyWin32 into Python as a built-in module? Is there a quick way of doing this, or would it take an entire overhaul of all of PyWin32's source code to accomplish this? Thank you! |