From 2c1c9cc7c7b05c736bd6e951b0bfdbce1394cb4c Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Thu, 2 Jun 2022 13:50:32 +0100 Subject: 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. --- testprogs/visopts.py | 69 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'testprogs/visopts.py') 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}"