★ wanayoo — archive 1999 https://mail.python.org/pipermail/pythonmac-sig/2002-July/005811.htmlNouvelle recherche | Portail wanayoo

[Pythonmac-SIG] A question about embedding with Mac OS X Carbon

Alexandre Parenteau alexp@strata.com
Sat, 13 Jul 2002 11:48:52 -0700


Hello all,

I promise I will try to do something over the week-end to help people embed
on OSX/Classic. I'll keep the list posted.

> One thing I realized, after reading the thread was that I didn't
> clarify the target of my OS X Carbon application. It's CFM, not
> Mach-O. The reason I am CFM-targeted is that my application needs to
> also run on Mac OS 9. Single binary. It is not a requirement that the
> application supports Python when running on OS 9, thus the weak link

OK. MacCvs does that with the CFM target.

For the CFM target, it uses CFM Python. But it could use Mach-O Python
selectively for OSX only.

Doing that would suppose you do the kind of manual function binding. I
believe you have all you need inside the MacCvs source code to get started.

> I spoke of in my opening email. Also, for sake of providing possible
> missing useful information, I'm using CodeWarrior 7.2 as my
> development environment. My C/C++ application also runs on Windows,
> and am using CodeWarrior there too.

This is my current config.

> I learned from this thread that if I'm going to embed Carbon Python
> into a CFM application running on Mac OS X, I'll either have to use
> GUSI, or I'll have to do the rather tedious Mach-O --> CFM wrapping
> technic you outlined in this email. I've done this sort of wrapping
> for specific Quartz calls, so I am familiar with it.

Exactly.

> So, I looked over MacCVS. First, I build MacCVS 3.2 Carbon from
> sources and built Python 2.2.1's PythonCarbonLib and dropped it into
> the same folder as the MacCVS application. Launching MacCVS on Mac OS
> X 10.1.5, I found the following two problems:

I'm not sure anymore you want to drop it : you actually want to launch the
Python installer which will add aliases inside your system folders and other
things. This is my config on OSX.

> 1) the console window that you provide comes up under macCVS's
> toolbar. I see no way to get it moved into the foreground

Oh yeah. It is a bug at the moment.... Try to open a browser, quit and
restart.

> 2) MacCVS is suffering from the "dual menubar problem" -- where SIOUX
> (via PythonCarbonLib) is presenting it's own rendition of the main
> menu to the right of MacCVS's, resulting in an unusable application.

This is not normal at all. I worked with Jack on this problem and thought it
was fixed on 2.2.1. Please make sure you don't have bad Python aliases in
your folder, try to re-do the Python install.

> I then tried to make the Mach-O target of MacCVS from latest sources.
> When launching it, there's a dialog saying "You need to put
> PythonCarbonLib into the application folder to get python support." I
> have one there. The MacCVS Mach-o application doesn't recognize it.

It is a wrong message, because Mach-O python is using the python framework
(Mach-O) indeed.

> 1) How do I get MacCVS Mach-o to run with Python via latest sources?

You need Python-Mach-O installed as a framework. I just found out there is
an installer for it : just visit wxPython on SourceForge
(www.sf.net/projects/wxpython). It is named MachO-Python.

> 2) (the question I was persuing at the start of this) Should I
> attempt to follow your lead and wrap Python-Mach-O calls for use in
> my CFM application? How much work is it? Will it be a mere matter of
> copy/pasting your work?

It's not bad, considering you also did similar things for Quartz. Once again
you have the choice on OSX-CFM :

- Use CFM-Python, but GUSI is in the way, which means possible slow downs,
strange socket locking, poor SMP support (none of these are really GUSI or
Python fault BTW, it is more CFM which sucks).
- Use Mach-O Python but it is complicated because you need to do a manual
binding of the functions, you need to use the infamous Mach-O/CFM wrapper
pointer function when handing function pointers to Python, and I don't have
a concrete example of that, although all this code is partially implemented
in MacCvs.

alex.

>
> Best,
>
> /Jay
>
> --
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>    Jay Koutavas                         mailto:jay@heynow.com
>    Heynow Software                      http://www.heynow.com
>    Windham, New Hampshire, USA
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>