tangentstorm
tangentstorm

Reputation: 7305

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.

Upvotes: 0

Views: 332

Answers (3)

tangentstorm
tangentstorm

Reputation: 7305

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.

Upvotes: 0

LeleDumbo
LeleDumbo

Reputation: 9340

Simply distribute the binaries, as long as the module doesn't link to a too specific python library, you'll be fine. i.e.: try to linklib python instead of libpython2.7.so.1.2.3.whatever

Upvotes: 1

Ned Batchelder
Ned Batchelder

Reputation: 375784

Definitely distribute binary kits. I doubt people would be willing to install Free Pascal.

To test the module on many platforms, the best option is to use VirtualBox to run those operating systems on your own development machine.

Upvotes: 1

Related Questions