From: Denis Ovsienko Date: Thu, 2 Jun 2022 12:50:32 +0000 (+0100) Subject: Convert visopts.py to Python 3. [skip ci] X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/2c1c9cc7c7b05c736bd6e951b0bfdbce1394cb4c Convert visopts.py to Python 3. [skip ci] In Python 3 "print" is a function, not a keyword; rearrange some imports clauses; redo the BPF expression escaping; for clarity use the full syntax within the string template; fix and improve the dot subprocess management; use modern HTTP server props. This revision has been tested to work with Python 3.8, it should work with earlier Python 3 versions as well. --- diff --git a/testprogs/visopts.py b/testprogs/visopts.py index 80c14639..bcc34af8 100755 --- a/testprogs/visopts.py +++ b/testprogs/visopts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ This program parses the output from pcap_compile() to visualize the CFG after @@ -37,13 +37,11 @@ Note: import sys, os import string -import subprocess -import json html_template = string.Template(""" - BPF compiler optimization phases for $expr + BPF compiler optimization phases for "${expr_html}"