nmilford / rpm-python27

An RPM spec file build and alt-install Python 2.7 on RHEL.
26 stars 29 forks source link

Build error " invalid syntax" on centos 7.1 #6

Closed shortdudey123 closed 8 years ago

shortdudey123 commented 8 years ago

I am trying to build this and am getting an error

extracting debug info from /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/lib-dynload/cStringIO.so
extracting debug info from /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/lib-dynload/spwd.so
extracting debug info from /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/lib-dynload/pyexpat.so
/usr/lib/rpm/sepdebugcrcfix: Updated 66 CRC32s, 0 CRC32s did match.
24863 blocks
+ /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 /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/debug/usr/lib/python2.7 using /usr/bin/python2.7
Bytecompiling .py files below /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7 using /usr/bin/python2.7
Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/lib2to3/tests/data/py3_test_grammar.py ...
  File "/usr/lib/python2.7/lib2to3/tests/data/py3_test_grammar.py", line 130
    x = ...
        ^
SyntaxError: invalid syntax

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/_mock_backport.py ...
SyntaxError: unqualified exec is not allowed in function '_set_signature' it contains a nested function with free variables (_mock_backport.py, line 192)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/bad_coding.py ...
  File "/usr/lib/python2.7/test/bad_coding.py", line 0
SyntaxError: unknown encoding: uft-8

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/bad_coding2.py ...
  File "/usr/lib/python2.7/test/bad_coding2.py", line 0
SyntaxError: encoding problem: utf-8

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/bad_coding3.py ...
  File "/usr/lib/python2.7/test/bad_coding3.py", line 0
SyntaxError: decoder did not return an unicode object (type=str)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future3.py ...
SyntaxError: future feature rested_snopes is not defined (badsyntax_future3.py, line 3)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future4.py ...
  File "/usr/lib/python2.7/test/badsyntax_future4.py", line 3
SyntaxError: from __future__ imports must occur at the beginning of the file

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future5.py ...
  File "/usr/lib/python2.7/test/badsyntax_future5.py", line 4
SyntaxError: from __future__ imports must occur at the beginning of the file

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future6.py ...
  File "/usr/lib/python2.7/test/badsyntax_future6.py", line 3
SyntaxError: from __future__ imports must occur at the beginning of the file

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future7.py ...
SyntaxError: from __future__ imports must occur at the beginning of the file (badsyntax_future7.py, line 3)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future8.py ...
SyntaxError: future feature * is not defined (badsyntax_future8.py, line 3)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_future9.py ...
SyntaxError: not a chance (badsyntax_future9.py, line 3)

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/badsyntax_nocaret.py ...
  File "/usr/lib/python2.7/test/badsyntax_nocaret.py", line 2
SyntaxError: can't assign to list comprehension

Compiling /root/rpmbuild/BUILDROOT/python27-2.7.10-1.x86_64/usr/lib/python2.7/test/test_grammar.py ...
  File "/usr/lib/python2.7/test/test_grammar.py", line 80
    self.assertEqual(1 if 1else 0, 1)
                           ^
SyntaxError: invalid token

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

RPM build errors:
    bogus date in %changelog: Fri Jun 28 2012 Nathan Milford <nathan@milford.io> [2.7.5-1]
    bogus date in %changelog: Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
    bogus date in %changelog: Mon Oct  9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
    Bad exit status from /var/tmp/rpm-tmp.66unhS (%install)
$ gcc --version
gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ 
$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.1.1503 (Core) 
Release:    7.1.1503
Codename:   Core
$ 

All packages on the host are up to date

garrettheel commented 8 years ago

@shortdudey123 try adding this to the top of the spec:

%global _python_bytecompile_errors_terminate_build 0

dsem commented 8 years ago

I have the same error and adding the %global as suggested resolved it.

shortdudey123 commented 8 years ago

Solved it for me too (Sorry thought i had already commented back on this)

mehulrprajapati commented 5 years ago

where to add %global to remove the errors