zopefoundation / zodbpickle

Fork of Python's pickle module to work with ZODB
Other
17 stars 15 forks source link

Install only files suitable for the version of Python the package is being installed for #22

Closed piotr-dobrogost closed 7 years ago

piotr-dobrogost commented 7 years ago

Package contains source files meant only for Python 3 and not valid on Python 2 like pickle_3.py for example. It would nice if files meant for specific version of Python would only be installed.

Below is the error one gets when building RPM containing zodbpickle.

Compiling /.../env/lib/python2.7/site-packages/zodbpickle/pickle_3.py ...
  File "/.../env/lib/python2.7/site-packages/zodbpickle/pickle_3.py", line 178
    def __init__(self, file, protocol=None, *, fix_imports=True):
                                             ^
SyntaxError: invalid syntax
jamadden commented 7 years ago

This is known and expected and is a common practice among projects supporting multiple versions of python, including gunicorn and gevent.

If you want to build an RPM for such projects, you need this in your RPM spec:

%define _python_bytecompile_errors_terminate_build 0
piotr-dobrogost commented 7 years ago

Thanks for hint. Technically it's possible to exclude these Python 3 only files when installing for Python 2 but it's not pretty thus it's not worth it I guess.