How to force a python wheel to be platform specific when building it?

后端 未结 4 1857
南旧
南旧 2020-11-29 07:31

I am working on a python2 package in which the setup.py contains some custom install commands. These commands actually build some Rust code and output some

4条回答
  •  悲哀的现实
    2020-11-29 08:20

    Here's the code that I usually look at from uwsgi

    The basic approach is:

    setup.py

    # ...
    
    try:
        from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
        class bdist_wheel(_bdist_wheel):
            def finalize_options(self):
                _bdist_wheel.finalize_options(self)
                self.root_is_pure = False
    except ImportError:
        bdist_wheel = None
    
    setup(
        # ...
        cmdclass={'bdist_wheel': bdist_wheel},
    )
    

    The root_is_pure bit tells the wheel machinery to build a non-purelib (pyX-none-any) wheel. You can also get fancier by saying there are binary platform-specific components but no cpython abi specific components.

提交回复
热议问题