Compiling Python on Windows : how to deal with modules ?

R

r2d3

Hi Pythoners,

I am using Python embedded in my application (OSX,Windows) and I need
to distribute Python as part of my application.

On OSX, no problem, I got a self contained framework (with dynamic
library and all the modules).

On Windows, I manage to compile Python 2.6.2 with PCbuild\build.bat
and I get python26.dll/python26_d.dll.

But the readme gives no clue about how to deal with the module
"compilation"/installation.

So how do I "compile"/package all the modules that comes with Python
source distribution on Windows ? To embed it in my distribution, I
just copy the whole Modules tree (only pyc/pyo/pyd files ?) ? and set
the right sys.path from my C code (using PySys_SetPath) ?

Thanks in advance.
 
R

r2d3

Hi all,

after some investigation, I managed to find how to do this "manually".
I post it here if it could help others...

1) on windows, mostly all the dynamic libraries (time, socket, ...)
are statically linked into python26.dll
2) all the modules are located in lib/ and some .pyd (in fact renamed
dll files) live in PCbuild
3) "PCBuild\python -m compileall lib" will compile all the .py under
lib which then could by zipped into a single python26.zip

So I will just need to distribute python26.dll and python26.zip with
my app and set sys.path (using PySys_SetPath) to point to python26.zip
+ the place where I store the .pyd.

I will solve the "user want to add other module" later using
PYTHONPATH or allowing the user to add python path through our GUI.

Best regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top