summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2009-04-30 07:26:03 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2009-04-30 07:26:03 +0200
commit73e08937ed5de0e5106408da32cdb3cb71af5b8c (patch)
tree4d959684c6293f829c21d9592a3dc8dbc5183a5a /extras
parentf7613ad2238fbbfcb76fb584f1bb27ebc8e0d199 (diff)
downloadsqlparse-73e08937ed5de0e5106408da32cdb3cb71af5b8c.tar.gz
Initial approach to provide an experimental Py3K version.
Diffstat (limited to 'extras')
-rw-r--r--extras/py3k/Makefile20
-rw-r--r--extras/py3k/README8
-rw-r--r--extras/py3k/fixes.diff44
3 files changed, 72 insertions, 0 deletions
diff --git a/extras/py3k/Makefile b/extras/py3k/Makefile
new file mode 100644
index 0000000..694b9cd
--- /dev/null
+++ b/extras/py3k/Makefile
@@ -0,0 +1,20 @@
+2TO3=2to3-3.0
+
+all: sqlparse tests
+
+sqlparse:
+ cp -r ../../sqlparse .
+ $(2TO3) sqlparse > sqlparse.diff
+ patch -p0 < sqlparse.diff
+ patch -p0 < fixes.diff
+
+tests:
+ cp -r ../../tests .
+ $(2TO3) tests > tests.diff
+ patch -p0 < tests.diff
+
+clean:
+ rm -rf sqlparse
+ rm -rf tests
+ rm -f sqlparse.diff
+ rm -f tests.diff \ No newline at end of file
diff --git a/extras/py3k/README b/extras/py3k/README
new file mode 100644
index 0000000..bb4cc9b
--- /dev/null
+++ b/extras/py3k/README
@@ -0,0 +1,8 @@
+Initial approach to provide a Python3 version of sqlparse.
+
+All tests pass (as of April 2009), but the Python3 version is
+considered experimental.
+
+To build this version run
+
+ make all
diff --git a/extras/py3k/fixes.diff b/extras/py3k/fixes.diff
new file mode 100644
index 0000000..fa632db
--- /dev/null
+++ b/extras/py3k/fixes.diff
@@ -0,0 +1,44 @@
+--- sqlparse/engine/grouping.py.orig 2009-04-30 06:48:43.000000000 +0200
++++ sqlparse/engine/grouping.py 2009-04-30 06:48:56.000000000 +0200
+@@ -107,7 +107,7 @@
+ T.Name,
+ T.Wildcard)))
+ for t in tl.tokens[i:]:
+- if x.next()(t):
++ if next(x)(t):
+ yield t
+ else:
+ raise StopIteration
+--- sqlparse/sql.py~ 2009-04-30 08:38:16.000000000 +0200
++++ sqlparse/sql.py 2009-04-30 08:39:15.000000000 +0200
+@@ -23,16 +23,13 @@
+ self.ttype = ttype
+
+ def __str__(self):
+- return str(self).encode('latin-1')
++ return self.value or ''
+
+ def __repr__(self):
+ short = self._get_repr_value()
+ return '<%s \'%s\' at 0x%07x>' % (self._get_repr_name(),
+ short, id(self))
+
+- def __unicode__(self):
+- return self.value or ''
+-
+ def to_unicode(self):
+ """Returns a unicode representation of this object."""
+ return str(self)
+@@ -105,11 +102,8 @@
+ self.tokens = tokens
+ Token.__init__(self, None, None)
+
+- def __unicode__(self):
+- return ''.join(str(x) for x in self.flatten())
+-
+ def __str__(self):
+- return str(self).encode('latin-1')
++ return ''.join(str(x) for x in self.flatten())
+
+ def _get_repr_name(self):
+ return self.__class__.__name__