[antlr] 01/01: * Team upload. * Add Python 3 support: - Add a patch, half made with sixer, half by hand, to add support for Py3. - Add runtime depends on python-six in python-antlr. - Add a python3 package in debian/control. - Add build-depends to python3-all-dev in debian/control (do we really need the -dev part here?). - Insert correct code to install the Py2 & Py3 modules using setup.py, so we are packaging the antlr.py AND its corresponding generated egg-info. * Ran wrap-and-sort -bast to minimize git diff and have a cleaner debian/control. This was already partially done in 2.7.7+dfsg-8, probably by hand. * Removed ante-dilluvian Replaces:+Breaks:, now useless after a few releases of Debian.
Thomas Goirand
zigo at moszumanska.debian.org
Wed Oct 25 16:12:56 UTC 2017
This is an automated email from the git hooks/post-receive script.
zigo pushed a commit to branch master
in repository antlr.
commit 8a22414f06dd2086134c7fb70f5088535f348a99
Author: Thomas Goirand <thomas at goirand.fr>
Date: Wed Oct 25 16:12:45 2017 +0000
* Team upload.
* Add Python 3 support:
- Add a patch, half made with sixer, half by hand, to add support for Py3.
- Add runtime depends on python-six in python-antlr.
- Add a python3 package in debian/control.
- Add build-depends to python3-all-dev in debian/control (do we really need
the -dev part here?).
- Insert correct code to install the Py2 & Py3 modules using setup.py, so
we are packaging the antlr.py AND its corresponding generated egg-info.
* Ran wrap-and-sort -bast to minimize git diff and have a cleaner
debian/control. This was already partially done in 2.7.7+dfsg-8, probably
by hand.
* Removed ante-dilluvian Replaces:+Breaks:, now useless after a few releases
of Debian.
---
debian/changelog | 19 +++
debian/control | 89 ++++++-----
debian/patches/python3-compat.patch | 297 ++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 12 +-
5 files changed, 380 insertions(+), 38 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 7673c77..bfdaea5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,22 @@
+antlr (2.7.7+dfsg-9) unstable; urgency=medium
+
+ * Team upload.
+ * Add Python 3 support:
+ - Add a patch, half made with sixer, half by hand, to add support for Py3.
+ - Add runtime depends on python-six in python-antlr.
+ - Add a python3 package in debian/control.
+ - Add build-depends to python3-all-dev in debian/control (do we really need
+ the -dev part here?).
+ - Insert correct code to install the Py2 & Py3 modules using setup.py, so
+ we are packaging the antlr.py AND its corresponding generated egg-info.
+ * Ran wrap-and-sort -bast to minimize git diff and have a cleaner
+ debian/control. This was already partially done in 2.7.7+dfsg-8, probably
+ by hand.
+ * Removed ante-dilluvian Replaces:+Breaks:, now useless after a few releases
+ of Debian.
+
+ -- Thomas Goirand <zigo at debian.org> Wed, 25 Oct 2017 15:53:54 +0000
+
antlr (2.7.7+dfsg-8) unstable; urgency=medium
* Team upload.
diff --git a/debian/control b/debian/control
index 263476f..13a4e8e 100644
--- a/debian/control
+++ b/debian/control
@@ -2,15 +2,19 @@ Source: antlr
Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
-Uploaders: Torsten Werner <twerner at debian.org>
+Uploaders:
+ Torsten Werner <twerner at debian.org>,
Build-Depends:
debhelper (>= 10),
default-jdk,
- python (>= 2.6.6-3~),
- python-all-dev (>= 2.3.5-11),
- sharutils
+ dh-python,
+ python-all-dev,
+ python-setuptools,
+ python3-all-dev,
+ python3-setuptools,
+ sharutils,
Build-Depends-Indep:
- maven-repo-helper
+ maven-repo-helper,
Standards-Version: 4.1.1
Vcs-Git: https://anonscm.debian.org/git/pkg-java/antlr.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/antlr.git
@@ -21,7 +25,7 @@ Architecture: all
Depends:
default-jre-headless | java5-runtime-headless | java6-runtime-headless,
libantlr-java (= ${binary:Version}),
- ${misc:Depends}
+ ${misc:Depends},
Description: language tool for constructing recognizers, compilers etc
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is
a language tool that provides a framework for constructing recognizers,
@@ -37,22 +41,28 @@ Description: language tool for constructing recognizers, compilers etc
files (e.g., HTML, SGML). ANTLR is designed to handle all of your
translation tasks.
-Package: libantlr-java
+Package: antlr-doc
+Section: doc
Architecture: all
-Depends: ${misc:Depends}
-Replaces: antlr (<< 2.7.7-8)
-Breaks: antlr (<< 2.7.7-8)
-Description: language tool for constructing recognizers, compilers etc (java library)
- ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is
- a language tool that provides a framework for constructing recognizers,
- compilers, and translators from grammatical descriptions containing C++
- or Java actions [You can use PCCTS 1.xx to generate C-based parsers].
+Depends:
+ ${misc:Depends},
+Description: language tool for constructing recognizers, compilers etc
+ This package contains the documentation and examples for antlr.
+ ANTLR stands for ANother Tool for Language Recognition,
+ (formerly PCCTS). It is a language tool that provides a framework
+ for constructing recognizers, compilers, and translators from
+ grammatical descriptions containing C++ or Java actions
+ [You can use PCCTS 1.xx to generate C-based parsers].
+ .
+ See antlr package for a complete description
Package: libantlr-dev
Section: libdevel
Architecture: any
-Depends: ${misc:Depends}
-Recommends: antlr
+Depends:
+ ${misc:Depends},
+Recommends:
+ antlr,
Description: language tool for constructing recognizers, compilers etc
ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is
a language tool that provides a framework for constructing recognizers,
@@ -61,29 +71,38 @@ Description: language tool for constructing recognizers, compilers etc
.
These are the static libraries for C++.
-Package: antlr-doc
-Section: doc
+Package: libantlr-java
Architecture: all
-Depends: ${misc:Depends}
-Conflicts: antlr (<< 2.7.6-8)
-Description: language tool for constructing recognizers, compilers etc
- This package contains the documentation and examples for antlr.
- ANTLR stands for ANother Tool for Language Recognition,
- (formerly PCCTS). It is a language tool that provides a framework
- for constructing recognizers, compilers, and translators from
- grammatical descriptions containing C++ or Java actions
- [You can use PCCTS 1.xx to generate C-based parsers].
- .
- See antlr package for a complete description
+Depends:
+ ${misc:Depends},
+Description: language tool for constructing recognizers, compilers etc (java library)
+ ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is
+ a language tool that provides a framework for constructing recognizers,
+ compilers, and translators from grammatical descriptions containing C++
+ or Java actions [You can use PCCTS 1.xx to generate C-based parsers].
Package: python-antlr
Section: python
Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}
-Replaces: antlr (<< 2.7.7-10)
-Breaks: antlr (<< 2.7.7-10)
-Description: language tool for constructing recognizers, compilers etc
- This package contains the Python version of antlr. ANTLR stands for
+Depends:
+ python-six,
+ ${misc:Depends},
+ ${python:Depends},
+Description: language tool for constructing recognizers, compilers etc - Python 2.7
+ This package contains the Python 2.7 version of antlr. ANTLR stands for
+ ANother Tool for Language Recognition, (formerly PCCTS).
+ .
+ See antlr package for a complete description.
+
+Package: python3-antlr
+Section: python
+Architecture: all
+Depends:
+ python3-six,
+ ${misc:Depends},
+ ${python3:Depends},
+Description: language tool for constructing recognizers, compilers etc - Python 3.x
+ This package contains the Python 3.x version of antlr. ANTLR stands for
ANother Tool for Language Recognition, (formerly PCCTS).
.
See antlr package for a complete description.
diff --git a/debian/patches/python3-compat.patch b/debian/patches/python3-compat.patch
new file mode 100644
index 0000000..1b0cb13
--- /dev/null
+++ b/debian/patches/python3-compat.patch
@@ -0,0 +1,297 @@
+Description: Python3 compat
+Author: Thomas Goirand <zigo at debian.org>
+Bug-Debian: https://bugs.debian.org/614505
+Forwarded: no
+Last-Update: 2017-10-24
+
+--- antlr-2.7.7+dfsg.orig/lib/python/antlr/antlr.py
++++ antlr-2.7.7+dfsg/lib/python/antlr/antlr.py
+@@ -2,13 +2,11 @@
+ ## details..........Copyright (C) Wolfgang Haefelinger, 2004.
+
+ ## get sys module
++from __future__ import print_function
+ import sys
+
+-version = sys.version.split()[0]
+-if version < '2.2.1':
+- False = 0
+-if version < '2.3':
+- True = not False
++import six
++from six.moves import range
+
+ ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
+ ### global symbols ###
+@@ -45,7 +43,7 @@ def version():
+
+ def error(fmt,*args):
+ if fmt:
+- print "error: ", fmt % tuple(args)
++ print("error: ", fmt % tuple(args))
+
+ def ifelse(cond,_then,_else):
+ if cond :
+@@ -55,7 +53,7 @@ def ifelse(cond,_then,_else):
+ return r
+
+ def is_string_type(x):
+- return (isinstance(x,str) or isinstance(x,unicode))
++ return (isinstance(x,str) or isinstance(x,six.text_type))
+
+ def assert_string_type(x):
+ assert is_string_type(x)
+@@ -549,9 +547,9 @@ class Token(object):
+ Token.badToken = Token( type=INVALID_TYPE, text="<no text>")
+
+ if __name__ == "__main__":
+- print "testing .."
++ print("testing ..")
+ T = Token.badToken
+- print T
++ print(T)
+
+ ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
+ ### CommonToken ###
+@@ -622,16 +620,16 @@ class CommonToken(Token):
+
+ if __name__ == '__main__' :
+ T = CommonToken()
+- print T
++ print(T)
+ T = CommonToken(col=15,line=1,text="some text", type=5)
+- print T
++ print(T)
+ T = CommonToken()
+ T.setLine(1).setColumn(15).setText("some text").setType(5)
+- print T
+- print T.getLine()
+- print T.getColumn()
+- print T.getText()
+- print T.getType()
++ print(T)
++ print(T.getLine())
++ print(T.getColumn())
++ print(T.getText())
++ print(T.getType())
+
+ ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
+ ### CommonHiddenStreamToken ###
+@@ -811,7 +809,7 @@ class CharBuffer(InputBuffer):
+
+ ### use unicode chars instead of ASCII ..
+ self.queue.append(c)
+- except Exception,e:
++ except Exception as e:
+ raise CharStreamIOException(e)
+ ##except: # (mk) Cannot happen ...
+ ##error ("unexpected exception caught ..")
+@@ -901,7 +899,7 @@ class TokenStreamSelector(TokenStream):
+ while 1:
+ try:
+ return self._input.nextToken()
+- except TokenStreamRetryException,r:
++ except TokenStreamRetryException as r:
+ ### just retry "forever"
+ pass
+
+@@ -1342,23 +1340,23 @@ class CharScanner(TokenStream):
+ self.setColumn(nc)
+
+ def panic(self,s='') :
+- print "CharScanner: panic: " + s
++ print("CharScanner: panic: " + s)
+ sys.exit(1)
+
+ def reportError(self,ex) :
+- print ex
++ print(ex)
+
+ def reportError(self,s) :
+ if not self.getFilename():
+- print "error: " + str(s)
++ print("error: " + str(s))
+ else:
+- print self.getFilename() + ": error: " + str(s)
++ print(self.getFilename() + ": error: " + str(s))
+
+ def reportWarning(self,s) :
+ if not self.getFilename():
+- print "warning: " + str(s)
++ print("warning: " + str(s))
+ else:
+- print self.getFilename() + ": warning: " + str(s)
++ print(self.getFilename() + ": warning: " + str(s))
+
+ def resetText(self) :
+ self.text.setLength(0)
+@@ -1418,16 +1416,16 @@ class CharScanner(TokenStream):
+ return c.__class__.lower()
+
+ def traceIndent(self):
+- print ' ' * self.traceDepth
++ print(' ' * self.traceDepth)
+
+ def traceIn(self,rname):
+ self.traceDepth += 1
+ self.traceIndent()
+- print "> lexer %s c== %s" % (rname,self.LA(1))
++ print("> lexer %s c== %s" % (rname,self.LA(1)))
+
+ def traceOut(self,rname):
+ self.traceIndent()
+- print "< lexer %s c== %s" % (rname,self.LA(1))
++ print("< lexer %s c== %s" % (rname,self.LA(1)))
+ self.traceDepth -= 1
+
+ def uponEOF(self):
+@@ -1492,7 +1490,7 @@ class CharScanner(TokenStream):
+ func=args[0]
+ args=args[1:]
+ apply(func,args)
+- except RecognitionException, e:
++ except RecognitionException as e:
+ ## catastrophic failure
+ self.reportError(e);
+ self.consume();
+@@ -1548,7 +1546,7 @@ class BitSet(object):
+
+ def __init__(self,data=None):
+ if not data:
+- BitSet.__init__(self,[long(0)])
++ BitSet.__init__(self,[0])
+ return
+ if isinstance(data,int):
+ BitSet.__init__(self,[long(data)])
+@@ -1568,7 +1566,7 @@ class BitSet(object):
+ def __str__(self):
+ bits = len(self.data) * BitSet.BITS
+ s = ""
+- for i in xrange(0,bits):
++ for i in range(0,bits):
+ if self.at(i):
+ s += "1"
+ else:
+@@ -1607,7 +1605,7 @@ class BitSet(object):
+
+ def bitMask(self,bit):
+ pos = bit & BitSet.MOD_MASK ## bit mod BITS
+- return (1L << pos)
++ return (1 << pos)
+
+ def set(self,bit,on=True):
+ # grow bitset as required (use with care!)
+@@ -1615,8 +1613,8 @@ class BitSet(object):
+ mask = self.bitMask(bit)
+ if i>=len(self.data):
+ d = i - len(self.data) + 1
+- for x in xrange(0,d):
+- self.data.append(0L)
++ for x in range(0,d):
++ self.data.append(0)
+ assert len(self.data) == i+1
+ if on:
+ self.data[i] |= mask
+@@ -1908,16 +1906,16 @@ class Parser(object):
+ col = x.getLine()
+ text = x.getText()
+ fmt = fmt + 'unexpected symbol at line %s (column %s) : "%s"'
+- print >>sys.stderr, fmt % (line,col,text)
++ print(fmt % (line,col,text), file=sys.stderr)
+ else:
+- print >>sys.stderr, fmt,str(x)
++ print(fmt,str(x), file=sys.stderr)
+
+ def reportWarning(self,s):
+ f = self.getFilename()
+ if f:
+- print "%s:warning: %s" % (f,str(x))
++ print("%s:warning: %s" % (f,str(x)))
+ else:
+- print "warning: %s" % (str(x))
++ print("warning: %s" % (str(x)))
+
+ def rewind(self, pos) :
+ self.inputState.input.rewind(pos)
+@@ -1945,7 +1943,7 @@ class Parser(object):
+ self.inputState.input = t
+
+ def traceIndent(self):
+- print " " * self.traceDepth
++ print(" " * self.traceDepth)
+
+ def traceIn(self,rname):
+ self.traceDepth += 1
+@@ -2034,20 +2032,20 @@ class LLkParser(Parser):
+ self.k = 1
+
+ def trace(self,ee,rname):
+- print type(self)
++ print(type(self))
+ self.traceIndent()
+ guess = ""
+ if self.inputState.guessing > 0:
+ guess = " [guessing]"
+ print(ee + rname + guess)
+- for i in xrange(1,self.k+1):
++ for i in range(1,self.k+1):
+ if i != 1:
+ print(", ")
+ if self.LT(i) :
+ v = self.LT(i).getText()
+ else:
+ v = "null"
+- print "LA(%s) == %s" % (i,v)
++ print("LA(%s) == %s" % (i,v))
+ print("\n")
+
+ def traceIn(self,rname):
+@@ -2108,10 +2106,10 @@ class TreeParser(object):
+ raise MismatchedTokenException(getTokenNames(), t, ttype, True)
+
+ def reportError(self,ex):
+- print >>sys.stderr,"error:",ex
++ print("error:",ex, file=sys.stderr)
+
+ def reportWarning(self, s):
+- print "warning:",s
++ print("warning:",s)
+
+ def setASTFactory(self,f):
+ self.astFactory = f
+@@ -2123,7 +2121,7 @@ class TreeParser(object):
+ self.astFactory.setASTNodeType(nodeType)
+
+ def traceIndent(self):
+- print " " * self.traceDepth
++ print(" " * self.traceDepth)
+
+ def traceIn(self,rname,t):
+ self.traceDepth += 1
+@@ -2683,7 +2681,7 @@ class ASTFactory(object):
+
+ def error(self, e):
+ import sys
+- print >> sys.stderr, e
++ print(e, file=sys.stderr)
+
+ def setTokenTypeASTNodeType(self, tokenType, className):
+ """
+@@ -2770,7 +2768,7 @@ def make(*nodes):
+ if not nodes:
+ return None
+
+- for i in xrange(0,len(nodes)):
++ for i in range(0,len(nodes)):
+ node = nodes[i]
+ if node:
+ assert isinstance(node,AST)
+@@ -2780,7 +2778,7 @@ def make(*nodes):
+ if root:
+ root.setFirstChild(None)
+
+- for i in xrange(1,len(nodes)):
++ for i in range(1,len(nodes)):
+ if not nodes[i]:
+ continue
+ if not root:
diff --git a/debian/patches/series b/debian/patches/series
index f61c4f1..02955a6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
gcc.diff
bin___antlr.diff
antlr-config.patch
+python3-compat.patch
diff --git a/debian/rules b/debian/rules
index 547fb6b..781b18a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,11 @@
#!/usr/bin/make -f
+PYTHON3S:=$(shell py3versions -vr 2>/dev/null)
+
include /usr/share/dpkg/pkg-info.mk
%:
- dh $@ --with maven-repo-helper --with python2
+ dh $@ --with maven-repo-helper --with python2,python3
override_dh_auto_configure:
cp /usr/share/misc/config.* scripts
@@ -26,8 +28,10 @@ override_dh_auto_build-arch:
override_dh_auto_test:
override_dh_auto_install-indep:
- mkdir -p debian/python-antlr/usr/lib/$$(pyversions -d)/dist-packages
- install -m644 lib/python/antlr/antlr.py debian/python-antlr/usr/lib/$$(pyversions -d)/dist-packages/.
+ set -e && cd lib/python && python setup.py install --install-layout=deb --root $(CURDIR)/debian/python-antlr && cd ..
+ set -e && cd lib/python && for pyvers in $(PYTHON3S); do \
+ python$$pyvers setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-antlr ; \
+ done && cd ..
override_dh_auto_install-arch:
$(MAKE) -C lib/cpp install prefix=`pwd`/debian/libantlr-dev/usr
@@ -48,6 +52,8 @@ override_dh_installexamples:
override_dh_auto_clean:
-cd lib/cpp; $(MAKE) clean
-find -name Makefile | xargs rm -f
+ -rm -rf lib/python/build
+ -rm -rf scripts/run-antlr
get-orig-pom:
wget -O debian/pom.xml http://repository.sonatype.org/service/local/repositories/central/content/antlr/antlr/$(DEB_VERSION_UPSTREAM)/antlr-$(DEB_VERSION_UPSTREAM).pom
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/antlr.git
More information about the pkg-java-commits
mailing list