debian/0000775000000000000000000000000012263243050007165 5ustar debian/copyright0000664000000000000000000000362512263242750011134 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: ply Upstream-Contact: David M. Beazley Source: http://www.dabeaz.com/ply/ Files: * Copyright: 2001-2012 David M. Beazley (Dabeaz LLC) License: BSD-3-clause Files: debian/* Copyright: 2006-2012, Arnaud Fontaine License: BSD-3-clause License: BSD-3-clause All rights reserved. . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of the David Beazley or Dabeaz LLC may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/compat0000664000000000000000000000000212263242750010371 0ustar 5 debian/python3-ply.install0000664000000000000000000000004512263242750012770 0ustar debian/tmp/usr/lib/python3* usr/lib/ debian/virtual-packages.py0000775000000000000000000000172712263242750013021 0ustar #!/usr/bin/python import os import sys import shutil import tempfile import ply.lex import ply.yacc tokens = ['token'] t_token = 'x' def t_error(t): pass def p_dummy(p): 'dummy : token' pass def p_error(p): pass def read_tabversion(filename): file = open(filename) data = {} try: exec file in data finally: file.close() return data['_tabversion'] tmpdir = tempfile.mkdtemp() try: package = sys.argv[1] except IndexError: raise RuntimeError, "ERROR: Required the package name as argument" try: ply.lex.lex(outputdir=tmpdir, optimize=True) ply.yacc.yacc(outputdir=tmpdir, optimize=True, debug=False) lex_tabversion = read_tabversion(os.path.join(tmpdir, 'lextab.py')) yacc_tabversion = read_tabversion(os.path.join(tmpdir, 'parsetab.py')) print '%s-lex-%s, %s-yacc-%s' % (package, lex_tabversion, package, yacc_tabversion) finally: shutil.rmtree(tmpdir) debian/python3-ply.docs0000664000000000000000000000002512263242750012250 0ustar debian/README.Debian debian/python-ply-doc.examples0000664000000000000000000000001212263242750013612 0ustar example/* debian/python-ply.docs0000664000000000000000000000002512263242750012165 0ustar debian/README.Debian debian/README.Debian0000664000000000000000000000030412263242750011231 0ustar Please note: The documentation and examples for this package are in python-ply-doc. When you install that package, you can find the documentation and examples in /usr/share/doc/python-ply-doc. debian/watch0000664000000000000000000000006712263242750010227 0ustar version=3 http://www.dabeaz.com/ply/ ply-(.*)\.tar\.gz debian/python-ply-doc.docs0000664000000000000000000000001312263242750012725 0ustar doc/*.html debian/source/0000775000000000000000000000000012263243050010465 5ustar debian/source/options0000664000000000000000000000004212263242750012105 0ustar extend-diff-ignore = "\.egg-info" debian/source/format0000664000000000000000000000001412263242750011701 0ustar 3.0 (quilt) debian/patches/0000775000000000000000000000000012263243050010614 5ustar debian/patches/0003-Fixed-lexer-line-tracking.patch0000664000000000000000000000116312263242750017125 0ustar From 0c0b575b529d4fe6dc0be179e701a302f27bc127 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Thu, 26 Apr 2012 10:15:09 -0500 Subject: [PATCH 3/3] Fixed lexer line tracking. --- test/calclex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/calclex.py b/test/calclex.py index 67d245f..302f0b0 100644 --- a/test/calclex.py +++ b/test/calclex.py @@ -36,7 +36,7 @@ t_ignore = " \t" def t_newline(t): r'\n+' - t.lineno += t.value.count("\n") + t.lexer.lineno += t.value.count("\n") def t_error(t): print("Illegal character '%s'" % t.value[0]) -- 1.8.5.2 debian/patches/02_relax-lex-tabversion-check.patch0000664000000000000000000000152712263242750017277 0ustar Description: Don't break already built packages with wrong _tabversion Author: Jakub Wilk Forwarded: not-needed --- a/ply/lex.py +++ b/ply/lex.py @@ -222,7 +222,14 @@ exec("import %s as lextab" % tabfile, env,env) lextab = env['lextab'] - if getattr(lextab,"_tabversion","0.0") != __tabversion__: + # python-ply 3.3-1 is shipped by Debian since Squeeze, so + # to not break packages that were built with wrong + # _tabversion we need to explicitly fix it. + actual_tabversion = getattr(lextab, '_tabversion', '0.0') + if actual_tabversion in ('3.3', '3.4'): + actual_tabversion = '3.2' + + if actual_tabversion != __tabversion__: raise ImportError("Inconsistent PLY version") self.lextokens = lextab._lextokens debian/patches/series0000664000000000000000000000030012263242750012030 0ustar 01_fix-lex-tabversion.patch 02_relax-lex-tabversion-check.patch 0001-Fixed-yacc-tests-to-account-for-dict-hash-key-random.patch 0002-More-test-fixes.patch 0003-Fixed-lexer-line-tracking.patch debian/patches/0001-Fixed-yacc-tests-to-account-for-dict-hash-key-random.patch0000664000000000000000000000576612263242750024117 0ustar From 02030ad24d923f16f401744a608573365b2e5542 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Tue, 21 May 2013 20:14:04 -0500 Subject: [PATCH 1/3] Fixed yacc tests to account for dict hash key randomization --- test/testlex.py | 3 +-- test/testyacc.py | 24 +++++++++++++++++++++--- test/yacc_prec1.py | 4 ++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/test/testlex.py b/test/testlex.py index 1f7dd1b..e436781 100755 --- a/test/testlex.py +++ b/test/testlex.py @@ -34,7 +34,7 @@ def pymodule_out_exists(filename): def pymodule_out_remove(filename): os.remove(make_pymodule_path(filename)) -def check_expected(result,expected): +def check_expected(result, expected): if sys.version_info[0] >= 3: if isinstance(result,str): result = result.encode('ascii') @@ -43,7 +43,6 @@ def check_expected(result,expected): resultlines = result.splitlines() expectedlines = expected.splitlines() - if len(resultlines) != len(expectedlines): return False diff --git a/test/testyacc.py b/test/testyacc.py index 2b06b44..4462201 100644 --- a/test/testyacc.py +++ b/test/testyacc.py @@ -34,7 +34,7 @@ def pymodule_out_exists(filename): def pymodule_out_remove(filename): os.remove(make_pymodule_path(filename)) - +# Old implementation (not safe for Python 3.3) def check_expected(result,expected): resultlines = [] for line in result.splitlines(): @@ -52,6 +52,26 @@ def check_expected(result,expected): return False return True +# Check the output to see if it contains all of a set of expected output lines. +# This alternate implementation looks weird, but is needed to properly handle +# some variations in error message order that occurs due to dict hash table +# randomization that was introduced in Python 3.3 +def check_expected(result, expected): + resultlines = set() + for line in result.splitlines(): + if line.startswith("WARNING: "): + line = line[9:] + elif line.startswith("ERROR: "): + line = line[7:] + resultlines.add(line) + + # Selectively remove expected lines from the output + for eline in expected.splitlines(): + resultlines = set(line for line in resultlines if not line.endswith(eline)) + + # Return True if no result lines remain + return not bool(resultlines) + def run_import(module): code = "import "+module exec(code) @@ -342,6 +362,4 @@ class YaccErrorWarningTests(unittest.TestCase): "Precedence rule 'left' defined for unknown symbol '/'\n" )) - - unittest.main() diff --git a/test/yacc_prec1.py b/test/yacc_prec1.py index 2ca6afc..99fcd90 100644 --- a/test/yacc_prec1.py +++ b/test/yacc_prec1.py @@ -12,8 +12,8 @@ from calclex import tokens # Parsing rules precedence = ( - ('left','+','-'), - ('left','*','/'), + ('left', '+', '-'), + ('left', '*', '/'), ('right','UMINUS'), ) -- 1.8.5.2 debian/patches/01_fix-lex-tabversion.patch0000664000000000000000000000212012263242750015664 0ustar Description: Set proper _tabversion in ply.lex Author: Daniele Tricoli Forwarded: https://github.com/dabeaz/ply/pull/1 --- a/ply/lex.py +++ b/ply/lex.py @@ -175,7 +175,7 @@ filename = os.path.join(outputdir,basetabfilename)+".py" tf = open(filename,"w") tf.write("# %s.py. This file automatically created by PLY (version %s). Don't edit!\n" % (tabfile,__version__)) - tf.write("_tabversion = %s\n" % repr(__version__)) + tf.write("_tabversion = %s\n" % repr(__tabversion__)) tf.write("_lextokens = %s\n" % repr(self.lextokens)) tf.write("_lexreflags = %s\n" % repr(self.lexreflags)) tf.write("_lexliterals = %s\n" % repr(self.lexliterals)) @@ -222,7 +222,7 @@ exec("import %s as lextab" % tabfile, env,env) lextab = env['lextab'] - if getattr(lextab,"_tabversion","0.0") != __version__: + if getattr(lextab,"_tabversion","0.0") != __tabversion__: raise ImportError("Inconsistent PLY version") self.lextokens = lextab._lextokens debian/patches/0002-More-test-fixes.patch0000664000000000000000000000324512263242750015221 0ustar From 55ff3fb3608d6112b315c85acd5b4348aaa32e12 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Tue, 21 May 2013 21:26:59 -0500 Subject: [PATCH 2/3] More test fixes --- ply/yacc.py | 8 ++++++-- test/testyacc.py | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ply/yacc.py b/ply/yacc.py index e9f5c65..a29c645 100644 --- a/ply/yacc.py +++ b/ply/yacc.py @@ -195,8 +195,12 @@ class YaccProduction: self.lexer = None self.parser= None def __getitem__(self,n): - if n >= 0: return self.slice[n].value - else: return self.stack[n].value + if isinstance(n, slice): + return [s.value for s in self.slice[n]] + elif n >= 0: + return self.slice[n].value + else: + return self.stack[n].value def __setitem__(self,n,v): self.slice[n].value = v diff --git a/test/testyacc.py b/test/testyacc.py index 4462201..86c991a 100644 --- a/test/testyacc.py +++ b/test/testyacc.py @@ -9,6 +9,7 @@ except ImportError: import sys import os import warnings +import re sys.path.insert(0,"..") sys.tracebacklimit = 0 @@ -57,6 +58,10 @@ def check_expected(result,expected): # some variations in error message order that occurs due to dict hash table # randomization that was introduced in Python 3.3 def check_expected(result, expected): + # Normalize 'state n' text to account for randomization effects in Python 3.3 + expected = re.sub(r' state \d+', 'state ', expected) + result = re.sub(r' state \d+', 'state ', result) + resultlines = set() for line in result.splitlines(): if line.startswith("WARNING: "): -- 1.8.5.2 debian/rules0000775000000000000000000000201012263242763010250 0ustar #!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk # Don't compress .py files DEB_COMPRESS_EXCLUDE := .py DEB_PYTHON_INSTALL_ARGS_ALL += --single-version-externally-managed \ --install-layout=deb PYVERSIONS := $(shell pyversions -s) PY3VERSIONS := $(shell py3versions -s) build: set -e; for pyver in $(PYVERSIONS) $(PY3VERSIONS); do \ echo "Testing with $$pyver"; \ (cd test && $$pyver testlex.py && $$pyver testyacc.py && ./cleanup.sh;)\ done binary-install/python-ply:: pod2man debian/dh_python-ply > dh_python-ply.1 dh_installman -p python-ply dh_python-ply.1 rm dh_python-ply.1 binary-post-install/python-ply:: echo "python-ply:Provides=$$(PYTHONPATH=. python debian/virtual-packages.py $(cdbs_curpkg))" >> \ debian/python-ply.substvars binary-post-install/python3-ply:: echo "python3-ply:Provides=$$(PYTHONPATH=. python debian/virtual-packages.py $(cdbs_curpkg))" >> \ debian/python3-ply.substvars debian/dh_python-ply0000664000000000000000000000442412263242750011720 0ustar #!/usr/bin/perl =head1 NAME dh_python-ply - generate versioned dependencies on python-ply =cut use strict; use warnings; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [B<--dependency-field> I] [S>] I... =head1 DESCRIPTION B is a debhelper program that is responsible for generating the B substitutions and adding them to substvars files. The program will look only at Python modules that are explicitly provided as its arguments, and will use this information to generate a strict versioned dependency on B. =head1 OPTIONS =over 4 =item B<--dependency-field> I Use BI substitution variable instead of B. =back =cut my $dependency_field = "Depends"; init(options => { "dependency-field:s" => \$dependency_field }); if (not @ARGV) { error("at least one argument is required") } foreach my $filename (@ARGV) { open FILE, $filename or error("cannot read $filename: $!"); read FILE, $_, 1024; my $is_lextab = /^_lextokens\b/m; my $is_parsetab = /^_lr_method\b/m; $is_lextab or $is_parsetab or error("$filename doesn't look like a PLY table"); (my $tabversion) = /^_tabversion\s*=\s*'([0-9.]+)'/m or error("$filename was generated by a very old PLY"); my $dependency = sprintf "python-ply-%s-%s", $is_lextab ? "lex" : "yacc", $tabversion; # Prefer real package names of "old" versions of PLY for easier upgrades from squeeze: if ($dependency eq "python-ply-yacc-3.2") { # PLY 3.2, 3.3 and 3.4 embeds the same version number (3.2) in parser tables. $dependency = "python-ply (>= 3.2), python-ply (<< 3.5) | $dependency"; } elsif ($dependency eq "python-ply-lex-3.3") { # PLY 3.2, 3.3 and 3.4 embeds their own version number in lexer tables. $dependency = "python-ply (>= 3.3), python-ply (<< 3.4) | $dependency"; } foreach my $package (@{$dh{DOPACKAGES}}) { addsubstvar($package, "python-ply:$dependency_field", $dependency); } } =head1 SEE ALSO L This program is not a part of debhelper, but it is meant to be used together with it. =head1 AUTHOR Jakub Wilk =cut # vim:ts=4 sw=4 et debian/python-ply.install0000664000000000000000000000010412263242750012701 0ustar debian/tmp/usr/lib/python2* usr/lib/ debian/dh_python-ply usr/bin/ debian/changelog0000664000000000000000000001326612263243034011051 0ustar ply (3.4-3ubuntu2) trusty; urgency=medium * d/rules: Ensure any test failures are correctly detected. -- James Page Wed, 08 Jan 2014 12:35:39 +0000 ply (3.4-3ubuntu1) trusty; urgency=medium * Enable test suite as part of package build: - d/rules: Execute lex and yacc tests for all python versions. - d/p/000*.patch: Cherry picked fixes from upstream VCS to resolve compatibility issues with Python >= 3.3. -- James Page Mon, 06 Jan 2014 12:13:44 +0000 ply (3.4-3) unstable; urgency=low * debian/control: bump Standards-Version to 3.9.3. No changes needed. * Add debian/source/options to ignore changes in egg-info/* to prevent FTBFS if built twice. Closes: #671248. * debian/copyright: switch to version 1.0 of machine-readable format. -- Arnaud Fontaine Mon, 14 May 2012 11:58:48 +0900 ply (3.4-2) unstable; urgency=low * Team upload. * Set PYTHONPATH correctly when generating names of virtual packages. -- Jakub Wilk Mon, 04 Jul 2011 17:37:14 +0200 ply (3.4-1) unstable; urgency=low [ Arnaud Fontaine ] * New upstream release. * Switch to dh_python2. + debian/control: - Bump cdbs dependency to 0.4.90-1~. - Bump python-all dependency to 2.6.6-9~. - Remove Build-Depends on python-support. - Add X-Python-Version field. - Add ${python:Breaks}. * Add python3-ply binary package. Closes: #605659. + debian/control: - Add python3-ply binary package. - Build-Depends on python3-all and add X-Python3-Version field. * debian/copyright: + Update copyright years. * Provide virtual packages for lex and yacc tabversions. Thanks to Jakub Wilk. Closes: #627862. [ Daniele Tricoli ] * debian/control: - Bumped Standard-Version to 3.9.2. No changes needed. * debian/patches/01_fix-lex-tabversion.patch: - Set proper _tabversion in ply.lex. * debian/patches/02_relax-lex-tabversion-check.patch: - Don't break already built packages with wrong _tabversion. * debian/source/format: - Switched to dpkg-source 3.0 (quilt) format. -- Arnaud Fontaine Sun, 12 Jun 2011 20:27:05 +0900 ply (3.3-1) unstable; urgency=low * New upstream release. * debian/control: + Depend on python-pkg-resources instead of python-setuptools as the latter is not necessary on runtime. Closes: #546430. + Update Standards-Version to 3.8.3. No changes needed. + Bump python-support version to 0.90. * Remove useless debian/pycompat. -- Arnaud Fontaine Mon, 28 Sep 2009 11:18:22 +0100 ply (3.2-1) unstable; urgency=low [ Arnaud Fontaine ] * New upstream release. + debian/copyright: - Update license as it is now distributed as a BSD license. + debian/python-ply-doc.docs: - Add all html files. * debian/control: + Add ${misc:Depends} to Depends in case the result of calls debhelper tools adds extra dependencies. + Update Standards-Version to 3.8.1. - Wrap Uploaders field. [ Sandro Tosi ] * debian/control - Switch Vcs-Browser field to viewsvn. -- Arnaud Fontaine Fri, 22 May 2009 00:34:36 +0100 ply (2.5-2) unstable; urgency=low * debian/control: + Move python-setuptools to Build-Depends-Indep. + Add python-setuptools to Suggests. -- Arnaud Fontaine Thu, 29 May 2008 22:12:19 +0200 ply (2.5-1) unstable; urgency=low * New upstream release. Closes: #483368. * debian/control: + Add Build-Depends against python-setuptools (ply now supports eggs). -- Arnaud Fontaine Thu, 29 May 2008 18:37:16 +0200 ply (2.3-2) unstable; urgency=low [ Arnaud Fontaine ] * New email address. [ Piotr Ożarowski ] * debian/control: + Vcs-Browser and Homepage fields added (dpkg support them now). + XS-Vcs-Svn field renamed to Vcs-Svn (dpkg supports it now). [ Sandro Tosi ] * debian/control - uniforming Vcs-Browser field. -- Arnaud Fontaine Sat, 23 Feb 2008 13:02:56 +0000 ply (2.3-1) unstable; urgency=low [ Arnaud Fontaine ] * New upstream release. [ Piotr Ożarowski ] * Added XS-Vcs-Svn field -- Arnaud Fontaine Mon, 16 Apr 2007 18:53:24 +0200 ply (2.2-1) unstable; urgency=low * New upstream release. -- Arnaud Fontaine Sat, 4 Nov 2006 00:45:51 +0100 ply (1.8-1) unstable; urgency=low * New upstream release. -- Arnaud Fontaine Mon, 21 Aug 2006 15:28:48 +0200 ply (1.7-1) unstable; urgency=low * New upstream version. * debian/watch: - Add this file. Thanks to Piotr Ożarowski. * debian/control.in: - Update Standards to 3.7.2. No changes needed. * New Python policy changes. Closes: #373480. + debian/compat: - Update debhelper compatibility to 5. + debian/rules: - Add DEB_PYTHON_SYSTEM=pysupport. + debian/control.in - Clean Build-Depends and Depends, cdbs handles that automatically now. - XB-Python-Version and Provides for binary package. + debian/postinst && debian/prerm: - Remove "hand made" python-support stuff, cdbs does this. -- Arnaud Fontaine Thu, 16 Jun 2006 16:08:24 +0200 ply (1.6-2) unstable; urgency=low [ Arnaud Fontaine ] * Fix typo into debian/control*. * Move Build-Depends-Indep to Build-Depends according to the debian policy. [ Gustavo Franco ] * debian/control: - Standards-Version bumped up to 3.7.0 -- Arnaud Fontaine Sat, 22 Apr 2006 19:26:57 +0200 ply (1.6-1) unstable; urgency=low * Initial release. Closes: #215804. -- Arnaud Fontaine Tue, 11 Apr 2006 22:21:34 +0200 debian/control0000664000000000000000000000550712263242750010605 0ustar Source: ply Section: python Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Arnaud Fontaine Uploaders: Debian Python Modules Team , Gustavo Franco Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.90-1~), python-all (>= 2.6.6-9~), python3-all (>= 3.1.2-6~), perl Build-Depends-Indep: python-setuptools, python3-setuptools X-Python-Version: >= 2.3 X-Python3-Version: >= 3.0 Standards-Version: 3.9.3 Homepage: http://www.dabeaz.com/ply/ Vcs-Svn: svn://svn.debian.org/python-modules/packages/ply/trunk/ Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/ply/trunk/ Package: python-ply Architecture: all Depends: ${python:Depends}, ${misc:Depends} Provides: ${python:Provides}, ${python-ply:Provides} Breaks: ${python:Breaks} Suggests: python-ply-doc, python-pkg-resources Description: Lex and Yacc implementation for Python2 PLY is yet another implementation of lex and yacc for Python. Although several other parsing tools are available for Python, there are several reasons why you might want to take a look at PLY: * It's implemented entirely in Python. * It uses LR-parsing which is reasonably efficient and well suited for larger grammars. * PLY provides most of the standard lex/yacc features including support for empty productions, precedence rules, error recovery, and support for ambiguous grammars. * PLY is extremely easy to use and provides very extensive error checking. Package: python3-ply Architecture: all Depends: ${python3:Depends}, ${misc:Depends} Provides: ${python3:Provides}, ${python3-ply:Provides} Breaks: ${python3:Breaks} Suggests: python-ply-doc, python3-pkg-resources Description: Lex and Yacc implementation for Python3 PLY is yet another implementation of lex and yacc for Python. Although several other parsing tools are available for Python, there are several reasons why you might want to take a look at PLY: * It's implemented entirely in Python. * It uses LR-parsing which is reasonably efficient and well suited for larger grammars. * PLY provides most of the standard lex/yacc features including support for empty productions, precedence rules, error recovery, and support for ambiguous grammars. * PLY is extremely easy to use and provides very extensive error checking. Package: python-ply-doc Section: doc Architecture: all Depends: ${misc:Depends} Description: Lex and Yacc implementation for Python (documentation) PLY is yet another implementation of lex and yacc for Python. . This package contains the documentation for Ply.