Commits

Ronald Oussoren committed 6b8d006

Make sure the pluginbuilder is used from a framework install, plugins
require a framework install of python.

  • Participants
  • Parent commits 76e5740

Comments (0)

Files changed (1)

File pyobjc/Lib/PyObjCTools/pluginbuilder.py

 Examples of plugin bundles include PreferencePanes and InterfaceBuilder 
 palletes.
 
+You *must* use a framework build of Python to be able to use this module.
+
 The PluginBuilder class is instantated with a number of keyword arguments and
 have a build() method that will do all the work. See the class docstrings for
 a description of the constructor arguments.
     binaries = []
 
     def setup(self):
+
+        assert_frameworkinstall()
+
         if self.mainmodule is None:
             raise bundlebuilder.BundleBuilderError, ("must specify 'mainmodule'"
                 " when building a plugin bundle")
         if self.missingModules or self.maybeMissingModules:
             self.reportMissing()
 
+def assert_frameworkinstall():
+    import sys
+
+    for item in sys.path:
+        if item.endswith('site-packages'):
+            break
+    else:
+        raise RuntimeError, "Cannot detect python flavor"
+
+    if item.find("Python.framework") == -1:
+        raise RuntimeError, "This module requires a framework install of Python"
+
 def compileBundle(outputName, bundle, mainModule):
     tmpFile = outputName + '.m'
     mainModule = os.path.splitext(mainModule)[0]
     main(builder)
 
 if __name__ == "__main__":
+    assert_frameworkinstall()
     main()