[Pythonmac-SIG] Building modules for the command line Python?

Sean Hummel seanh@real.com
Tue, 19 Feb 2002 10:13:12 -0800 (PST)


Great! That sounds simple enough, is that all though, I mean that compiles
the module but does it link it to the appropriate libraries, such as it
could be used from the command line?

On Mon, 18 Feb 2002, Donovan Preston wrote:

> 
> On Monday, February 18, 2002, at 10:30 AM, Sean Hummel wrote:
> 
> >
> > Okay, so I am looking at making the OSAm module into a module which is
> > useable from the commandline.  However, I am a bit confused on one 
> > point,
> > is just making a module Carbon compatible, enough of a conversion?
> >
> > Also I'm not very familiar with the Makefile system, and would like a
> > pointer as to where in the Makefiles I should look for the portion that
> > creates modules.
> >
> > Yes I know this is quite a bit to ask, but I am just delving seriously
> > into MacOSX now that I have the chance to do so.
> 
> It's pretty trivial, really -- you just need to write a setup.py that 
> uses distutils to compile OSAm.c and ScriptRunner.c into a module.
> 
> Here's the one I wrote for OSAm on my machine (save it in setup.py in 
> the same directory as the OSAm source)
> 
> ----------------
> 
> from distutils.core import setup, Extension
> 
> setup(name="OSAm",
> 	version="1.0",
> 	ext_modules=[
> 		Extension("OSAm", ["OSAm.c", "ScriptRunner.c"],
> 	extra_link_args=["-framework", "Carbon"])])
> 
> -----------------
> 
> Run it with "python setup.py install". It works great. It's cool being 
> able to send apple events from python in the shell.
> 
> By the way, I have made some modifications to OSAm which adds a "Raw" 
> mode that returns the raw AppleEvent record to Python wrapped in such a 
> way that you can use aetools.unpack on it to convert (sometimes) 
> straight to Python datatypes. It's messy and leaks memory (I think), but 
> if you're interested I'll send it to you.
> 
> Also, if anyone else is interested, I have made the changes necessary to 
> use gensuitemodule on Mac OS X with UNIX Python.
> 
> Donovan
> 
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> 
>