On 12/2/10 10:39 AM, Eric Frederich wrote:
Can you explain how to do this with distutils then?
Would I need a separate setup.py for SpamABC and SpamXYZ?
How would I get them included in the parent module Spam?

Please consult the distutils documentation.

  http://docs.python.org/distutils/index.html

In short, you only need one setup.py file.

  from distutils.core import setup, Extension

  setup(
    ...
    ext_modules=[
      Extension('Spam.ABC', sources=['src/spam_abc.c']),
      Extension('Spam.XYZ', sources=['src/spam_xyz.c']),
    ],
    packages=['Spam'],
    ...
  )

Could you explain what you mean when you say "The Python import
mechanism will be looking for an appropriately-named .pyd file for
each module"?

Are you saying that in python when I say from "Spam.ABC import *" I
need a file called "Spam.ABC.[so|pyd]"?

No, it will be looking for Spam/ABC.pyd where Spam/ is your package directory (i.e. it should have an __init__.py file, like any other Python package).

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to