简体   繁体   English

PyPI:我如何测试和分发用free pascal编写的本机python扩展(没有任何C代码)?

[英]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 . 开发Python模块使用Pascal教程后,我能够在Windows上的对象pascal中使用优秀的Free Pascal编译器创建一个python模块。

The question is: how should I distribute a native code module that isn't compiled with with the standard C tool-chain? 问题是:我应该如何分发未使用标准C工具链编译的本机代码模块?

Should I just ask users to install Free Pascal? 我应该要求用户安装Free Pascal吗? If so, how do I convince the distutils to invoke it? 如果是这样,我如何说服distutils调用它?

Or should I just distribute binaries? 或者我应该只分发二进制文件? Free Pascal supports a bunch of compilation targets , so cross-compiling binaries is no problem. Free Pascal支持一堆编译目标 ,因此交叉编译二进制文件没有问题。 It's perfectly normal to distribute binaries for windows on PyPI, but what about the other platforms? 在PyPI上为Windows分发二进制文件是完全正常的,但其他平台呢?

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?" PS:听起来不像商业广告,但为了回应不可避免的问题,“为什么不用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. 所有我能说的是在C和pyrex / Cython中有书面扩展,免费pascal是迄今为止我用过的最简单的时间,而且我很乐意通过一些箍来使用它。

Definitely distribute binary kits. 绝对分发二进制工具包。 I doubt people would be willing to install Free Pascal. 我怀疑人们愿意安装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. 要在许多平台上测试模块,最好的选择是使用VirtualBox在您自己的开发机器上运行这些操作系统。

Simply distribute the binaries, as long as the module doesn't link to a too specific python library, you'll be fine. 只需分发二进制文件,只要模块没有链接到太具体的python库,你就可以了。 ie: try to linklib python instead of libpython2.7.so.1.2.3.whatever 即:尝试linklib python而不是libpython2.7.so.1.2.3.whatever

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. 我的特定情况最好的答案是将系统视为应用程序而不是模块,并将应用程序本身作为二进制文件分发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM