tomerfiliba-org / reedsolomon

⏳🛡 Pythonic universal errors-and-erasures Reed-Solomon codec to protect your data from errors and bitrot. Includes a future-proof zero-dependencies pure-python implementation 🔮 and an optional speed-optimized Cython/C extension 🚀
http://pypi.python.org/pypi/reedsolo
Other
358 stars 86 forks source link

setup.py: Fix installation via 'pip' if no C compiler is available #24

Closed projectgus closed 4 years ago

projectgus commented 4 years ago

Hi again!

This is a follow-up to the amended version of #21 that was merged as v1.5.3.

Screenshot of pip install reedsolo on Windows Python 3.8: Screenshot from 2020-05-19 10-14-51

(With no native compiler installed.) Description of what's happening included below and in commit message. This only seems to happen on Python 3.x not 2.7, but it might be the pip version not the Python version that makes the difference.

I haven't bumped the package version in this PR, but is it a problem to please make a 1.5.4 release on pypi with this fix soon?

Please let me know if you want me to make any changes at all. Thanks for all your work maintaining this package. :)


Fix renames the package-specific --compile option to --native-compile

Reason: setuptools also has a --compile option (recognized by both pip and setup.py, although setup.py usage doesn't seem to be documented anywhere.) However this --compile option controls compiling Python bytecode, not native code.

--compile is the default, but recent versions of pip will pass this option explicitly to setup.py: https://github.com/pypa/pip/blob/9cbe8fbdd0a1bd1bd4e483c9c0a556e9910ef8bb/src/pip/_internal/utils/setuptools_build.py#L171

This would cause native compilation to trigger even when no native compiler is installed.


lrq3000 commented 4 years ago

Oh wow, I'm pretty sure I tested with pypi under a virtualenv with no compiler to make sure the build there was ok, but it seems this bug passed through.

Thanks a lot again @projectgus for helping in fixing this serious issue, I'll take care of it asap!

lrq3000 commented 4 years ago

@projectgus OK I have merged your PR and pushed to pypi, I hope it's all good now. I know why this issue passed through, it's because I still have my compiler installed and I don't have a Linux machine ready for testing right now. Hence, could you please tell me if that's ok now? If not, I will setup a dedicated machine to test this through. Thanks a lot for your help! :D

projectgus commented 4 years ago

Thanks @lrq3000 and sorry for the long turnaround on my side.

I've installed reedsolo 1.5.4 using pip from Python 2.7 & 3.8 on Windows. Getting a Linux install with Python and no python-dev packages turned out to be a bit of a pain, but I'm confident it will work for this configuration as well.

lrq3000 commented 4 years ago

No problem @projectgus , thanks a lot for your feedback and PR, glad that the install seems to finally work as expected :-)