diff --git a/setup.py b/setup.py index 6ae3f184..1eab290b 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ import setuptools import setuptools.command.build_ext - +import warnings _EXTRA_DLL = "extra-dll" _DLL_FILENAME = "crc32c.dll" @@ -90,11 +90,17 @@ def main(build_cffi=True): if __name__ == "__main__": + import sys try: main() except KeyboardInterrupt: raise - except Exception: + except SystemExit: # If installation fails, it is likely a compilation error with CFFI # Try to install again. + warnings.warn( + "Compiling the CFFI Extension crc32c has failed. Only a pure " + "python implementation will be usable." + ) main(build_cffi=False) + diff --git a/src/crc32c/__init__.py b/src/crc32c/__init__.py index 2458c896..b44591c9 100644 --- a/src/crc32c/__init__.py +++ b/src/crc32c/__init__.py @@ -15,9 +15,9 @@ import warnings _SLOW_CRC32C_WARNING = ( - "Currently using crcmod in pure python form. This is a slow " - "implementation. If you can compile a c extension, you will have much " - "better performance." + "As the c extension couldn't be imported, `google-crc32c` is using a " + "pure python implementation that is significantly slower. If possible, " + "please configure a c build environment and compile the extension" ) # If available, default to CFFI Implementation, otherwise, use pure python.