author | Felix Yan
<felixonmars@archlinux.org> 2015-10-03 02:47:10 UTC |
committer | Felix Yan
<felixonmars@archlinux.org> 2015-10-03 02:47:10 UTC |
parent | 75f650ac0eb296bb1903bb6c15b5567ce3eefd2d |
PKGBUILD | +5 | -10 |
python-3.5.patch | +0 | -216 |
diff --git a/PKGBUILD b/PKGBUILD index cc09259..9798733 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,24 +5,19 @@ pkgbase=python-ply pkgname=(python-ply python2-ply) -pkgver=3.7 -pkgrel=2 +pkgver=3.8 +pkgrel=1 pkgdesc='Implementation of lex and yacc parsing tools' arch=('any') url='http://www.dabeaz.com/ply/' license=('BSD') makedepends=('python-setuptools' 'python2-setuptools') source=("${url}ply-$pkgver.tar.gz" - LICENSE - python-3.5.patch) -sha256sums=('f85fb7b44c1c9a04873e6d76fa2c2eef43f2cfd81468aa714a9c63af7ae0af80' - '87c20dd0a774f4d4ff837b4f1555f7eb1ed1b8dc1e3223cd105e5c1e282d62bf' - 'b7969d290e659d9756a2b0ad3b19481a4b32e1ec79590db1c7ab64bcc6519029') + LICENSE) +sha256sums=('e7d1bdff026beb159c9942f7a17e102c375638d9478a7ecd4cc0c76afd8de0b8' + '87c20dd0a774f4d4ff837b4f1555f7eb1ed1b8dc1e3223cd105e5c1e282d62bf') prepare() { - # https://github.com/dabeaz/ply/pull/78 - (cd ply-$pkgver; patch -p1 -i ../python-3.5.patch) - cp -a ply-$pkgver{,-py2} } diff --git a/python-3.5.patch b/python-3.5.patch deleted file mode 100644 index f474c23..0000000 --- a/python-3.5.patch +++ /dev/null @@ -1,216 +0,0 @@ -From 1186219ceece79c1faa55a8dce31cfb235ccfb13 Mon Sep 17 00:00:00 2001 -From: Barry Warsaw <barry@python.org> -Date: Mon, 14 Sep 2015 15:38:42 -0400 -Subject: [PATCH] Fixes for Python 3.5 compatibility. - ---- - test/testlex.py | 77 +++++++++++++++++++++++++++++++++++---------------------- - 1 file changed, 47 insertions(+), 30 deletions(-) - -diff --git a/test/testlex.py b/test/testlex.py -index fd5002e..3880f6f 100755 ---- a/test/testlex.py -+++ b/test/testlex.py -@@ -16,14 +16,22 @@ - - import ply.lex - --def make_pymodule_path(filename): -+try: -+ from importlib.util import cache_from_source -+except ImportError: -+ # Python 2.7, but we don't care. -+ cache_from_source = None -+ -+ -+def make_pymodule_path(filename, optimization=None): - path = os.path.dirname(filename) - file = os.path.basename(filename) - mod, ext = os.path.splitext(file) - -- if sys.hexversion >= 0x3040000: -- import importlib.util -- fullpath = importlib.util.cache_from_source(filename, ext=='.pyc') -+ if sys.hexversion >= 0x3050000: -+ fullpath = cache_from_source(filename, optimization=optimization) -+ elif sys.hexversion >= 0x3040000: -+ fullpath = cache_from_source(filename, ext=='.pyc') - elif sys.hexversion >= 0x3020000: - import imp - modname = mod+"."+imp.get_tag()+ext -@@ -32,11 +40,12 @@ def make_pymodule_path(filename): - fullpath = filename - return fullpath - --def pymodule_out_exists(filename): -- return os.path.exists(make_pymodule_path(filename)) -+def pymodule_out_exists(filename, optimization=None): -+ return os.path.exists(make_pymodule_path(filename, -+ optimization=optimization)) - --def pymodule_out_remove(filename): -- os.remove(make_pymodule_path(filename)) -+def pymodule_out_remove(filename, optimization=None): -+ os.remove(make_pymodule_path(filename, optimization=optimization)) - - def implementation(): - if platform.system().startswith("Java"): -@@ -156,8 +165,12 @@ def test_lex_ignore2(self): - def test_lex_re1(self): - self.assertRaises(SyntaxError,run_import,"lex_re1") - result = sys.stderr.getvalue() -+ if sys.hexversion < 0x3050000: -+ msg = "Invalid regular expression for rule 't_NUMBER'. unbalanced parenthesis\n" -+ else: -+ msg = "Invalid regular expression for rule 't_NUMBER'. missing ), unterminated subpattern at position 0" - self.assert_(check_expected(result, -- "Invalid regular expression for rule 't_NUMBER'. unbalanced parenthesis\n", -+ msg, - contains=True)) - - def test_lex_re2(self): -@@ -173,10 +186,15 @@ def test_lex_re3(self): - # "Invalid regular expression for rule 't_POUND'. unbalanced parenthesis\n" - # "Make sure '#' in rule 't_POUND' is escaped with '\\#'\n")) - -+ if sys.hexversion < 0x3050000: -+ msg = ("Invalid regular expression for rule 't_POUND'. unbalanced parenthesis\n" -+ "Make sure '#' in rule 't_POUND' is escaped with '\\#'\n") -+ else: -+ msg = ("Invalid regular expression for rule 't_POUND'. missing ), unterminated subpattern at position 0\n" -+ "ERROR: Make sure '#' in rule 't_POUND' is escaped with '\#'") - self.assert_(check_expected(result, -- "Invalid regular expression for rule 't_POUND'. unbalanced parenthesis\n" -- "Make sure '#' in rule 't_POUND' is escaped with '\\#'\n", -- contains=True)) -+ msg, -+ contains=True), result) - - def test_lex_rule1(self): - self.assertRaises(SyntaxError,run_import,"lex_rule1") -@@ -365,7 +383,6 @@ def test_lex_optimize(self): - "(NUMBER,4,1,2)\n")) - self.assert_(os.path.exists("lextab.py")) - -- - p = subprocess.Popen([sys.executable,'-O','lex_optimize.py'], - stdout=subprocess.PIPE) - result = p.stdout.read() -@@ -375,8 +392,8 @@ def test_lex_optimize(self): - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("lextab.pyo")) -- pymodule_out_remove("lextab.pyo") -+ self.assert_(pymodule_out_exists("lextab.pyo", 1)) -+ pymodule_out_remove("lextab.pyo", 1) - - p = subprocess.Popen([sys.executable,'-OO','lex_optimize.py'], - stdout=subprocess.PIPE) -@@ -387,7 +404,7 @@ def test_lex_optimize(self): - "(NUMBER,4,1,2)\n")) - - if test_pyo: -- self.assert_(pymodule_out_exists("lextab.pyo")) -+ self.assert_(pymodule_out_exists("lextab.pyo", 2)) - try: - os.remove("lextab.py") - except OSError: -@@ -397,7 +414,7 @@ def test_lex_optimize(self): - except OSError: - pass - try: -- pymodule_out_remove("lextab.pyo") -+ pymodule_out_remove("lextab.pyo", 2) - except OSError: - pass - -@@ -430,8 +447,8 @@ def test_lex_optimize2(self): - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("opt2tab.pyo")) -- pymodule_out_remove("opt2tab.pyo") -+ self.assert_(pymodule_out_exists("opt2tab.pyo", 1)) -+ pymodule_out_remove("opt2tab.pyo", 1) - p = subprocess.Popen([sys.executable,'-OO','lex_optimize2.py'], - stdout=subprocess.PIPE) - result = p.stdout.read() -@@ -440,7 +457,7 @@ def test_lex_optimize2(self): - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("opt2tab.pyo")) -+ self.assert_(pymodule_out_exists("opt2tab.pyo", 2)) - try: - os.remove("opt2tab.py") - except OSError: -@@ -450,7 +467,7 @@ def test_lex_optimize2(self): - except OSError: - pass - try: -- pymodule_out_remove("opt2tab.pyo") -+ pymodule_out_remove("opt2tab.pyo", 2) - except OSError: - pass - -@@ -480,8 +497,8 @@ def test_lex_optimize3(self): - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo")) -- pymodule_out_remove("lexdir/sub/calctab.pyo") -+ self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo", 1)) -+ pymodule_out_remove("lexdir/sub/calctab.pyo", 1) - - p = subprocess.Popen([sys.executable,'-OO','lex_optimize3.py'], - stdout=subprocess.PIPE) -@@ -491,7 +508,7 @@ def test_lex_optimize3(self): - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo")) -+ self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo", 2)) - try: - shutil.rmtree("lexdir") - except OSError: -@@ -526,8 +543,8 @@ def test_lex_opt_alias(self): - "(+,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: -- self.assert_(pymodule_out_exists("aliastab.pyo")) -- pymodule_out_remove("aliastab.pyo") -+ self.assert_(pymodule_out_exists("aliastab.pyo", 1)) -+ pymodule_out_remove("aliastab.pyo", 1) - - p = subprocess.Popen([sys.executable,'-OO','lex_opt_alias.py'], - stdout=subprocess.PIPE) -@@ -538,7 +555,7 @@ def test_lex_opt_alias(self): - "(NUMBER,4,1,2)\n")) - - if test_pyo: -- self.assert_(pymodule_out_exists("aliastab.pyo")) -+ self.assert_(pymodule_out_exists("aliastab.pyo", 2)) - try: - os.remove("aliastab.py") - except OSError: -@@ -548,7 +565,7 @@ def test_lex_opt_alias(self): - except OSError: - pass - try: -- pymodule_out_remove("aliastab.pyo") -+ pymodule_out_remove("aliastab.pyo", 2) - except OSError: - pass - -@@ -593,8 +610,8 @@ def test_lex_many_tokens(self): - "(TOK999,'TOK999:',1,47)\n" - )) - -- self.assert_(pymodule_out_exists("manytab.pyo")) -- pymodule_out_remove("manytab.pyo") -+ self.assert_(pymodule_out_exists("manytab.pyo", 1)) -+ pymodule_out_remove("manytab.pyo", 1) - try: - os.remove("manytab.py") - except OSError: