Search code examples
pythonfreepascalpypi

PyPI: How can I test and distribute a native python extension written in free pascal (with no C code whatsoever)?


Following the Developing Python Modules With Pascal tutorial, I was able to create a python module in object pascal on windows with the excellent Free Pascal compiler.

The question is: how should I distribute a native code module that isn't compiled with with the standard C tool-chain?

Should I just ask users to install Free Pascal? If so, how do I convince the distutils to invoke it?

Or should I just distribute binaries? Free Pascal supports a bunch of compilation targets, so cross-compiling binaries is no problem. It's perfectly normal to distribute binaries for windows on PyPI, but what about the other platforms?

And either way: how can I test the module on all those platforms?


PS: Not to sound like a commercial, but in response to the inevitable question, "why not just write it in C?" all I can say is that having written extensions in C and pyrex/Cython, free pascal is by far the easiest time I've had of it, and I'm more than happy to jump through a few hoops to use it.


Solution

  • In retrospect, this was not really a good question.

    The answer that turned out best for my particular case was to just treat the system as an application rather than a module, and distribute the application itself as a binary.