有没有办法在具有相同版本号的PyPI上发布多平台轮子?

时间:2019-07-05 11:54:23

标签: raspberry-pi cython pypi platform python-wheel

我正在尝试将Cython包装的C ++模块作为轮子部署到PyPI。目的是使I2C硬件模块可在任何Raspberry Pi上与Python一起使用。到目前为止,我已经编译了代码,并且知道我是否可以将编译的模块从运行Buster的Pi 3B复制到运行Stretch的Pi Zero W上,但是当我将车轮从Buster部署到test.pypi.org并将其安装在Stretch上时我得到:

Could not find a version that satisfies the requirement pyiArduinoI2Crelay (from versions: )
No matching distribution found for pyiArduinoI2Crelay

如果我只是将车轮从* _armv7l.whl重命名为* _armv6l.whl 模块下载并在Pi Zero上运行。但是Pi 3B从PyPI下载了以前的版本(我使用了-no-cache-dir rm -r .cache / pip /

如果我执行sdist并上传它,则抱怨安装模块时没有安装Cython,尽管我知道已经安装了它,因为它与我之前编译过的Pi相同。 (setup_requires和install_requires似乎不起作用)

到目前为止,这些方法都没有帮助:

https://www.python.org/dev/peps/pep-0425/#platform-tag https://packaging.python.org/guides/distributing-packages-using-setuptools/#platform-wheels https://wheel.readthedocs.io/en/stable/user_guide.html#building-wheels Prepare C-based Cython package to publish on pypi

这是项目的链接:

https://github.com/tremaru/pyiArduinoI2Crelay

这是setup.py:

from setuptools import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext

def readme():
        with open('README.md') as readme:
                return readme.read()

setup(name='pyiArduinoI2Crelay',
        version='1.6.4.dev8',
        description='iarduino.ru module for Raspberry Pi',
        long_description=readme(),
        classifiers=[
                'Programming Language :: Python :: 3',
        ],
        url='http://github.com/tremaru/pyiArduinoI2Crelay',
        author='iarduino.ru',
        author_email='shop@iarduino.ru',
        license='MIT',
        package=['pyiArduinoI2Crelay'],
        ext_modules = [Extension(
                name="pyiArduinoI2Crelay",
                sources=["pyiArduinoI2Crelay/pyiArduinoI2Crelay.cpp"])],
        include_package_data=True,
        python_requires='>=3',
        setup_requires=['Cython'],
        install_requires=['Cython'],
        cmdclass = {
                "build_ext": build_ext
        }
)

我希望能够为所有Raspberry发布模块的一个版本。那么,有没有办法将多个.so打包到一个轮子上?还是某种用于arm体系结构的manylinux1标签?

1 个答案:

答案 0 :(得分:0)

结果证明我是一个牛头人。生成cpp文件后,我的安装程序中不需要任何Cython东西。我要做的就是删除Cython内容并删除cmdclass = { "build_ext": build_ext }。然后在发布和构建为源分发时都没问题。

相关问题