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

Support Python 2.6 #27

Closed
tfryman opened this issue May 11, 2017 · 6 comments
Closed

Support Python 2.6 #27

tfryman opened this issue May 11, 2017 · 6 comments

Comments

@tfryman
Copy link

tfryman commented May 11, 2017

[root@]# python -V
Python 2.6.6
[root@]# gixy /etc/nginx/conf.d/default.conf
Traceback (most recent call last):
File "/usr/bin/gixy", line 7, in
from gixy.cli.main import main
File "/usr/lib/python2.6/site-packages/gixy/cli/main.py", line 8, in
from gixy.formatters import get_all as formatters
File "/usr/lib/python2.6/site-packages/gixy/formatters/init.py", line 2, in
from gixy.formatters.base import BaseFormatter
File "/usr/lib/python2.6/site-packages/gixy/formatters/base.py", line 7
skip_parents = {block.Root, block.HttpBlock}
^
SyntaxError: invalid syntax

@Jamie0
Copy link

Jamie0 commented May 11, 2017

From what I can see gixy won't run on 2.6, as it's using 2.7/3.x syntax.

If, like me, you're running CentOS 6, try installing EPEL and then python34 and python34-setuptools. You can then install using pip3.

sudo easy_install-3.4 pip
pip3 install gixy
gixy [/etc/nginx/conf.d/default.conf]

@buglloc buglloc changed the title SyntaxError: invalid syntax Support Python 2.6 May 11, 2017
@buglloc
Copy link
Member

buglloc commented May 11, 2017

For now Gixy does not support Python 2.6 and I'm not sure if it is needed.
The last release of Python 2.6 was 2013-10-29, over 3 years ago: https://www.python.org/dev/peps/pep-0361/

For example, the pip project has recently dropped support for 2.6: pypa/pip#4343
And as I can see, CentOS 7 also used Python 2.7 by default:

$ docker run -t centos:7 python -V
Python 2.7.5

So the only popular distro with Python 2.6 is CentOS 6?

@Jamie0
Copy link

Jamie0 commented May 11, 2017

As far as I can tell, both CentOS and RHEL 6 (EL6) just support Python 2.6 (in their base repos). Then they backport security fixes back into the packages when necessary. As they're true long-term releases, EL 6 will be supported until 2020, and it still has a pretty big market share.

The only reason Gixy doesn't seem to currently work is because the set syntax is different (set([1, 2]) compared to {}) and the .format() syntax in 2.7 and 3.x.

I guess providing some brief installation instruction for CentOS 6 could be helpful as a workaround?

@gongled
Copy link
Contributor

gongled commented May 14, 2017

From the one hand, CentOS 6 ships with a Python 2.6 by default. As @Jamie0 said RHEL/CentOS 6.x will be supported until 2020 and it still has a lot of users. For example, Ansible developers support Python 2.6 as well as Python 2.7.

From the other hand, I understand that supporting compatibility with an obsolete version of Python might be painful. @buglloc I suggest you estimate how much effort and time do you need to maintain also the older version of Python interpreter. If it is not worth it, just close the issue and move on.

@buglloc
Copy link
Member

buglloc commented May 16, 2017

Supporting Python 2.6 is painful, but I'll try to support it as much as I can :)
If this becomes too difficult (in future), I'll drop it.

@buglloc
Copy link
Member

buglloc commented May 21, 2017

Fixed in Gixy v0.1.5

@buglloc buglloc closed this as completed May 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants