asn2wrs: use system lex and yacc from ply if available

Tested with python-ply 3.11 and Python 3.7.3 on Arch Linux using the
'ninja asn1' command.

Bundling lex.py and yacc.py is one distribution method suggested by PLY
upstream (https://www.dabeaz.com/ply/README.txt), but since it is also
available in many Linux distributions, we could potentially remove it in
the future. Windows developers can install it through pip if needed.

Change-Id: I9c847072916ee33da49994820b435ec1d7110303
Reviewed-on: https://code.wireshark.org/review/33708
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2019-06-22 19:42:11 +01:00
parent 99a87a68ca
commit 7dfcb4425a
3 changed files with 8 additions and 21 deletions

View File

@ -1,18 +0,0 @@
Description: Use lex/yacc from ply
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/554613
Author: Jakub Wilk <ubanus@users.sf.net>
--- a/tools/asn2wrs.py
+++ b/tools/asn2wrs.py
@@ -70,8 +70,8 @@
import getopt
import traceback
-import lex
-import yacc
+from ply import lex
+from ply import yacc
if sys.version_info[0] < 3:
from string import maketrans

View File

@ -1,3 +1,2 @@
04_asn2wrs_ply.patch
09_idl2wrs.patch
16_licence_about_location.patch

View File

@ -47,8 +47,14 @@ import time
import getopt
import traceback
import lex
import yacc
try:
from ply import lex
from ply import yacc
except ImportError:
# Fallback: use lex.py and yacc from the tools directory within the
# Wireshark source tree if python-ply is not installed.
import lex
import yacc
if sys.version_info[0] < 3:
from string import maketrans