Gunicorn: rpmbuild failed with syntax error

Created on 21 Mar 2018  路  4Comments  路  Source: benoitc/gunicorn

Hello,

I am trying to create an rpm from source code. I have pip 9.0.2 installed and Python version is 2.7.5.
I have written a .spec file for creating RPM out of this source code.
But it fails with syntax error.
``

  • /usr/lib/rpm/check-buildroot
  • /usr/lib/rpm/redhat/brp-compress
  • /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
  • /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
    Bytecompiling .py files below /home/vagrant/project/gunicorn/work/buildroot/usr/lib/python2.7 using /usr/bin/python2.7
    Compiling /home/vagrant/project/gunicorn/work/buildroot/usr/lib/python2.7/site-packages/gunicorn/workers/gaiohttp.py ...
    File "/usr/lib/python2.7/site-packages/gunicorn/workers/gaiohttp.py", line 67
    yield from self.wsgi.close()
    ^
    SyntaxError: invalid syntax

error: Bad exit status from /var/tmp/rpm-tmp.esw9T7 (%install)
``

Any Idea..?

I agree with the point that it is harmless, and pip install gunicorn=19.0 works fine, but why it failed to create package....

Thanks,
Rahul.

Most helpful comment

According to a gevent commentor you can put %define _python_bytecompile_errors_terminate_build 0 in your spec to stop this from being a problem.

All 4 comments

Because it tries to compile a Python 3-only file with Python 2. I don't know anything about rpmbuild, but I think there should be a way to extract some files from the build or a way to tell rpmbuild to build Gunicorn with /usr/bin/python3 or /usr/bin/python3.Y.

According to a gevent commentor you can put %define _python_bytecompile_errors_terminate_build 0 in your spec to stop this from being a problem.

Hello,

Thanks for your help, But I solved it by using 'exit 0' at the end of %install section in my rpm spec file, just to ignore any error during build..
Closing this issue.

Regards.

My solution

%global __python %{__python3}

https://fedoraproject.org/wiki/Archive:PackagingDrafts/Python3?rd=PackagingDrafts/Python3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zenglingyu picture zenglingyu  路  4Comments

mw44118 picture mw44118  路  4Comments

haolujun picture haolujun  路  3Comments

benoitc picture benoitc  路  4Comments

joekohlsdorf picture joekohlsdorf  路  4Comments