Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmbuild failed with syntax error #1731

Closed
gr790 opened this issue Mar 21, 2018 · 4 comments
Closed

rpmbuild failed with syntax error #1731

gr790 opened this issue Mar 21, 2018 · 4 comments

Comments

@gr790
Copy link

gr790 commented Mar 21, 2018

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.

@berkerpeksag
Copy link
Collaborator

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.

@jamadden
Copy link
Collaborator

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.

@gr790
Copy link
Author

gr790 commented Mar 21, 2018

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.

@gr790 gr790 closed this as completed Mar 21, 2018
@opsarno
Copy link

opsarno commented Oct 15, 2019

My solution

%global __python %{__python3}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants