[Pythonmac-SIG] Embedding Python in applications under MacOSX and Darwin.

David M.Cooke cookedm at physics.mcmaster.ca
Sun Nov 28 09:45:13 CET 2004

On Nov 27, 2004, at 23:02, Robert White wrote:

> I am wondering if someone can answer this question for me.  Is Python 
> installed as a framework under Darwin?  If so, is there an easy way to 
> know within a "configure" script (autoconf, libtool, et al) whether 
> you are in MacOSX or Darwin?  I do not run Darwin, just MacOSX.  The 
> reason that I ask this is that there are several programs that embed 
> python within the Darwinports system and I would like to develop a 
> common routine that would allow a "configure" script to properly 
> compile and link against the Python Framework in MacOSX yet work in 
> Darwin as well.  I have not looked at a lot of ports, but the ones 
> that I have looked at don't get it right and I am too new to the 
> libtool system to provide a proper response.  So any information or 
> pointers are greatly appreciated.

In DarwinPorts, python is installed as a shared library 
(non-framework), just like it would be under other unices. I think a 
good way to check for Mac OS-specific is something like

     import MacOS
except ImportError:
     python_type = 'not macos'
     if MacOS.linkmodel == 'framework':
         python_type = 'framework'
         python_type = 'not framework'

(run in the python you're testing, of course)

According to the docs, MacOS.linkmodel is 'framework', 'static', or 
'shared'; a DarwinPorts python should be 'shared'.

|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the Pythonmac-SIG mailing list