python2.4 compatibility.

38 views
Skip to first unread message

Ishaan Joshi

unread,
Feb 27, 2013, 9:49:07 PM2/27/13
to sqlp...@googlegroups.com
Andi,

  I'm using a very small subset of the functionality provided in sqlparse [sqlparse.split and sqlparse.format]. I've been able to get it to work on python2.4.x by changing a ternary conditional statement from sql.py. Would you, off the top of your head, know any other gaping holes that would not allow it to work with python2.4?

Thanks!,

.. Ishaan

Andi Albrecht

unread,
Feb 28, 2013, 2:16:57 AM2/28/13
to sqlp...@googlegroups.com
Hi Ishaan,

the test suite runs fine with two changes in the source code (I've
copied the patch below).

I don't have any concerns to apply this patch to the code base since
the changes are really minimal and don't have any side-effects.
However, there will be no guarantee that sqlparse will remain
compatible with Python 2.4. The main focus is on supporting Python 2.7
and Python 3.

The 0.1.x series will be compatible with Python >= 2.5 and Python >=
3.2. If we drop "official" support for Python 2.5 and 2.6 in 0.2.x is
not decided yet.

Best regards, Andi

vvv------------------------------------------
diff --git a/sqlparse/functions.py b/sqlparse/functions.py
index fbfcc0b..e54457e 100644
--- a/sqlparse/functions.py
+++ b/sqlparse/functions.py
@@ -33,7 +33,7 @@ def getcolumns(stream):
return pipe(stream)


-class IsType():
+class IsType(object):
"""Functor that return is the statement is of a specific type"""
def __init__(self, type):
self.type = type
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index 16f055b..6fb99c6 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -20,7 +20,10 @@ class Token(object):

def __init__(self, ttype, value):
self.value = value
- self.normalized = value.upper() if ttype in T.Keyword else value
+ if ttype in T.Keyword:
+ self.normalized = value.upper()
+ else:
+ self.normalized = value
self.ttype = ttype
self.is_keyword = ttype in T.Keyword
self.parent = None
diff --git a/tox.ini b/tox.ini
index fe2a7de..eebfa44 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist=py25,py26,py27,pypy,py32
+envlist=py24,py25,py26,py27,pypy,py32

[testenv]
deps=
^^^---------------------
> --
> You received this message because you are subscribed to the Google Groups
> "sqlparse" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlparse+u...@googlegroups.com.
> To post to this group, send email to sqlp...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlparse?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

pir...@gmail.com

unread,
Feb 28, 2013, 2:19:13 AM2/28/13
to sqlp...@googlegroups.com

Support for Python2.4 was removed recently. Maybe running the test you could find them, or reading the closed issues on GitHub.

Sent from my Android cell phone, please forgive the lack of format on the text, and my fat thumbs :-P

--

Andi Albrecht

unread,
Feb 28, 2013, 2:30:10 AM2/28/13
to sqlp...@googlegroups.com
I've just committed the patch that make sqlparse compatible with 2.4
(again). But as piranna said, Python 2.4 won't be officially supported
anymore to make it easier to support newer Python versions.

pir...@gmail.com

unread,
Feb 28, 2013, 2:32:01 AM2/28/13
to sqlp...@googlegroups.com

Well, if patches are so simple... :-D But yes, Python2.4 is not on our scope anymore.

Sent from my Android cell phone, please forgive the lack of format on the text, and my fat thumbs :-P

Ishaan Joshi

unread,
Feb 28, 2013, 10:19:04 PM2/28/13
to sqlp...@googlegroups.com
Andi, El -

  Apologies for the late reply, I should have enabled email notifications. Thanks a ton for the patch, FWIW, I can also just do this locally.
  Future incompatibility is not an issue, I just wanted to use the formatter and the part of split that removes comments. I'll include a snapshot of the current version in my repo and will work just fine.

  Thanks a ton for the rapid response and turn around, it is much appreciated. I wish you guys all the best.

.. Ishaan
Reply all
Reply to author
Forward
0 new messages