Compiling Python on Windows : how to deal with modules ?

Discussion in 'Python' started by r2d3, May 11, 2009.

  1. r2d3

    r2d3 Guest

    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.
     
    r2d3, May 11, 2009
    #1
    1. Advertising

  2. r2d3

    r2d3 Guest

    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.

    On 11 mai, 10:49, r2d3 <> wrote:
    > 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) ?
     
    r2d3, May 12, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Geoff Caplan

    Compiling disutil modules on Windows

    Geoff Caplan, Aug 7, 2004, in forum: Python
    Replies:
    3
    Views:
    321
    Neil Hodgson
    Aug 7, 2004
  2. Geoff Caplan

    Re: Compiling disutil modules on Windows

    Geoff Caplan, Aug 8, 2004, in forum: Python
    Replies:
    1
    Views:
    320
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Aug 8, 2004
  3. rbt

    deal or no deal

    rbt, Dec 22, 2005, in forum: Python
    Replies:
    7
    Views:
    597
    Duncan Smith
    Dec 28, 2005
  4. alf
    Replies:
    6
    Views:
    383
  5. Ralph Heinkel
    Replies:
    6
    Views:
    958
    Ralph Heinkel
    Mar 22, 2012
Loading...

Share This Page