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

Fix syntax error #401

Merged
merged 1 commit into from
Aug 12, 2014
Merged

Fix syntax error #401

merged 1 commit into from
Aug 12, 2014

Conversation

bochecha
Copy link
Contributor

No description provided.

@bochecha
Copy link
Contributor Author

A bit more context here.

The problem only happens with Python 3, not Python 2:

$ python2
Python 2.7.5 (default, Jun 25 2014, 10:19:55) 
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(s):
...     if isinstance(s, str):
...         print(s)
...         return
...     raise TypeError, 'unexpected type "%s"' % repr(s)
... 
>>> 
$ python3
Python 3.3.2 (default, Jun 30 2014, 17:20:03) 
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(s):
...     if isinstance(s, str):
...         print(s)
...         return
...     raise TypeError, 'unexpected type "%s"' % repr(s)
  File "<stdin>", line 5
    raise TypeError, 'unexpected type "%s"' % repr(s)
                   ^
SyntaxError: invalid syntax
>>> 

The problem is in a file that is completely unused in Python 3 (py2.py).

However, that file still gets installed when building for Python 3.

So, when building the Fedora package python3-pygit2, the file is installed, and we then use Python 3 to byte-compile it, which causes the build to fail due to the SyntaxError.

This pull request fixes the problem by simply using a syntax which works both in Python 2 and 3.

Another way to fix it is to make sure the file isn't installed when building for Python 3 (and of course that py3.py doesn't get installed when building for Python 2)

However, I prefered going with the simpler solution first. 😃

@jdavid jdavid merged commit 6c4e1d0 into libgit2:master Aug 12, 2014
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

Successfully merging this pull request may close these issues.

2 participants