1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-03 11:12:13 +00:00

net-mgmt/arpwatch: Add python 2 compatibility to the massagevendor

script. This allows use on pfsense <= 2.4.4.

Approved by:	matthew (mentor, implicit)
This commit is contained in:
Craig Leres 2019-12-26 22:47:17 +00:00
parent e56f7abf8f
commit 0bbb0f76b6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=520959
2 changed files with 41 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= arpwatch
PORTVERSION= 3.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net-mgmt
MASTER_SITES= https://ee.lbl.gov/downloads/arpwatch/ \
LOCAL/leres/arpwatch

View File

@ -0,0 +1,40 @@
--- massagevendor.py.in.orig 2019-12-26 22:30:49 UTC
+++ massagevendor.py.in
@@ -1,6 +1,6 @@
#!@PYTHON@
"""massagevendor - convert IEEE oui.csv to ethercodes.dat format"""
-# @(#) $Id: massagevendor.py.in 1505 2019-11-30 18:35:23Z leres $ (LBL)
+# @(#) $Id: massagevendor.py.in 1516 2019-12-26 22:28:17Z leres $ (LBL)
#
# Copyright (c) 2000, 2004, 2009, 2010, 2013, 2015, 2016, 2019
# The Regents of the University of California. All rights reserved.
@@ -35,6 +35,8 @@
# into ethercodes.dat format.
#
+from __future__ import print_function
+
import argparse
import csv
import os
@@ -63,7 +65,10 @@ def process(f):
tup = [x[1:] if x[0] == '0' else x for x in tup]
vendor = ':'.join(tup)
- company = row[2].encode('utf-8').decode('ascii', 'ignore')
+ company = row[2]
+ if sys.version_info[0] < 3:
+ company = unicode(company, 'utf-8')
+ company = company.encode('utf-8').decode('ascii', 'ignore')
lines.append('%s\t%s' % (vendor, company))
@@ -88,7 +93,7 @@ def main(argv=None):
# os.environ[pathstr] = '%s:%s' % (localsbin, os.environ[pathstr])
PROG = os.path.basename(argv[0])
- version = '$Revision: 1505 $'.strip('$').rstrip()
+ version = '$Revision: 1516 $'.strip('$').rstrip()
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter)