[Pythonmac-SIG] /Library/Graphics/Patch .plugin for Quartz Composer

Chris McClimans pythonmac-sig at mcclimans.net
Tue Jan 30 16:42:40 CET 2007


I was poking around the working Quartz Composer Patch Plugin build I  
made and found the exact version I used to create it in Contents/ 
Info.plist:

<key>py2app</key>
<dict>
<key>template</key>
<string>bundle</string>
<key>version</key>
<string>0.2.5</string>

So I downloaded http://svn.red-bean.com/bob/py2app/releases/ 
py2app-0.2.5/ and it still didn't work. So I started looking at the  
imports.

The culprit is an upgrade from the included macholib-0.8 from  
py2app-0.2.5 to macholib-1.0 or higher.

If you install a macholib version beyond what is included with  
py2app-0.2.5, the build process works differently. For me it results  
in two binaries. (sample setup.py and PyQcPatchLoader.py below)

Results after 'python setup.py py2app' with py2app-0.2.5 and the  
included macholib-0.8:
$ls dist/PyQcPatchLoader.plugin/Contents/MacOS/
PyQcPatchLoader

Results after 'python setup.py py2app' with py2app-0.3.1 and  
macholib-1.0 or higher:
$ls dist/PyQcPatchLoader.plugin/Contents/MacOS/
PyQcPatchLoader
python

I suspect a diff of:
http://svn.red-bean.com/bob/py2app/releases/py2app-0.2.5/src/ 
macholib/ #aka macholib-0.8
and
http://svn.red-bean.com/bob/macholib/tags/macholib-1.0/macholib/
has the culprit embedded in there somewhere.

Any thoughts or suggestions would be greatly appreciated.
-chris

ps. I'm moving this thread to pythonmac-sig as it's not really pyobjc- 
dev related and that list seems to get more volume.

On Jan 30, 2007, at 1:38 AM, Ronald Oussoren wrote:

>
>
>> For those that are not interested in QuartzComposer plugins, here is
>> my real issue.
>> The setup.py below should result in only one file in dist/
>> PyQcPatchLoader.plugin/Contents/MacOS/ and it should be
>> PyQcPatchLoader when run through py2app. However it contains both
>> python and the CFBundleExecutable and they are not linked correctly
>> for loading as a plugin.
>>
>> I was able to get it to work correctly yesterday, but now I've
>> upgraded everything to current versions, and I think I have broken
>> something. Or I may have a blaring mistake staring at me. ;)
>
> The setup.py file looks fine to me. It seems that you have stumbled  
> acros a bug in py2app. I'll see if I can find and fix this.
>
> Ronald
>

> On 29 Jan, 2007, at 19:55, Chris McClimans wrote:

===setup.py===
"""
Script for building the a GraphFoundation plugin...
aka a QuartComposer Framework patch.

Usage:
     python setup.py py2app

To use this copy dist/PyPatchLoader.plugin to Library/Graphics/Patches:
    ~/Library/Graphics/Patches
    /Library/Graphics/Patches
    /System/Library/Graphics/Patches
"""
from distutils.core import setup
import py2app

infoPlist =

setup(
     name='PyQcPatchLoader',
     plugin=['PyQcPatchLoader.py'],
     options=dict(
         py2app=dict(
             extension=".plugin",
             plist=dict(
                 CFBundleDevelopmentRegion='English',
             	CFBundleExecutable='PyQcPatchLoader',
                 CFBundleName='PyQcPatchLoader',
                 NSPrincipalClass='PyQcPatchLoader',
                 CFBundleIdentifier='net.mcclimans.pypatchloader',
                 CFBundleGetInfoString='Simple Python Plugin Loader  
for Quartz Composer',
                 CFBundlePackageType='BNDL',
                 GFPlugIn=True,
                 CFBundleSignature='????',
                 CFBundleVersion='1.0',
                 CFBundleShortVersionString = '0.1',
             )
         ),
     ),
)
===PyQcPatchLoader.py==
import Quartz
import objc
from Foundation import NSLog

objc.loadBundle('QuartComposer',globals(),
     objc.pathForFramework(
         u'/System/Library/Frameworks/Quartz.framework/Frameworks/ 
QuartzComposer.framework'))

QCPatch=objc.lookUpClass('QCPatch')

class PyQcPatch(QCPatch):
     pass

# The NSPrincipalClass of a QCPatch BNDL must conform to  
GFPluginRegistration
GFPlugInRegistration = objc.protocolNamed('GFPlugInRegistration')

class PyQcPatchLoader(NSObject, GFPlugInRegistration):
     @objc.signature('v12 at 0:4 at 8')
     def registerNodesWithManager_(self, nodemanager):
         """
         nodemanager is a GFNodeManager instance that is passed to us  
when
         this module is loaded by the QuartzComposer Framework
         """
         NSLog('We Excuted! Yea!')
         nodemanager.registerNodeWithClass_(PyQcPatch)
         #we'll deal with what really needs to happen later
         #nodemanager.registerNodeWithClass_(PyPatch)
     registerNodesWithManager_=classmethod(registerNodesWithManager_)





More information about the Pythonmac-SIG mailing list