mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
apply 2to3 conversions via patches rather than running during build
This commit is contained in:
@@ -36,9 +36,6 @@ CONFIGURE_ENV = ac_cv_lib_pam_pam_start=false \
|
||||
MAKE=/usr/bin/make \
|
||||
YACC=bison
|
||||
|
||||
post-extract:
|
||||
cd ${WRKSRC} && 2to3 -w do_auth.py
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA} ${FILESDIR}/tac_plus.conf.sample ${PREFIX}/share/tacacs
|
||||
rm ${PREFIX}/bin/tac_pwd ${PREFIX}/man/man8/tac_pwd.8 # only works with des/md5 crypt
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
Index: do_auth.py
|
||||
--- do_auth.py.orig
|
||||
+++ do_auth.py
|
||||
@@ -211,7 +211,7 @@ General Public License for more details.
|
||||
Written by Dan Schmidt - Please visit tacacs.org to check for updates.
|
||||
'''
|
||||
|
||||
-import sys,re,getopt,ConfigParser
|
||||
+import sys,re,getopt,configparser
|
||||
from time import strftime
|
||||
|
||||
# I really don't want to deal with these exceptions more than once
|
||||
@@ -230,23 +230,23 @@ def get_attribute(config, the_section, the_option, log
|
||||
#Should not have any exceptions - BUT, just in case
|
||||
try:
|
||||
attributes = config.get(the_section, the_option)
|
||||
- except ConfigParser.NoSectionError:
|
||||
+ except configparser.NoSectionError:
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: Section '%s' Doesn't Exist!\n"
|
||||
% (the_section))
|
||||
sys.exit(1)
|
||||
- except ConfigParser.DuplicateSectionError:
|
||||
+ except configparser.DuplicateSectionError:
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: Duplicate section '%s'\n"
|
||||
% (the_section))
|
||||
sys.exit(1)
|
||||
- except ConfigParser.NoOptionError:
|
||||
+ except configparser.NoOptionError:
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: '%s' not found in section '%s\n'"
|
||||
% (the_option, the_section))
|
||||
sys.exit(1)
|
||||
#To do: finish exceptions.
|
||||
- except ConfigParser.ParsingError:
|
||||
+ except configparser.ParsingError:
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: Can't parse file '%s'! (You got me)\n"
|
||||
% (filename))
|
||||
@@ -298,9 +298,9 @@ def main():
|
||||
argv = sys.argv
|
||||
try:
|
||||
optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
|
||||
- except getopt.GetoptError, err:
|
||||
- print str(err)
|
||||
- print __doc__
|
||||
+ except getopt.GetoptError as err:
|
||||
+ print(str(err))
|
||||
+ print(__doc__)
|
||||
sys.exit(1)
|
||||
for (i, j) in optlist:
|
||||
if i == '-i':
|
||||
@@ -314,15 +314,15 @@ def main():
|
||||
elif i == '-d':
|
||||
device = j
|
||||
elif i in ('?', '-?', 'help', 'Help'):
|
||||
- print __doc__
|
||||
+ print(__doc__)
|
||||
sys.exit(1)
|
||||
elif i == '-D':
|
||||
is_debug = True
|
||||
else:
|
||||
- print 'Unknown option:', i
|
||||
+ print('Unknown option:', i)
|
||||
sys.exit(1)
|
||||
if len(argv) < 7:
|
||||
- print __doc__
|
||||
+ print(__doc__)
|
||||
sys.exit(1)
|
||||
log_file = open (log_name, "a")
|
||||
#DEBUG! We at least got CALLED
|
||||
@@ -384,7 +384,7 @@ def main():
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: No username entered!\n")
|
||||
sys.exit(1)
|
||||
- config = ConfigParser.SafeConfigParser()
|
||||
+ config = configparser.SafeConfigParser()
|
||||
if not (filename in config.read(filename)):
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "Error: Can't open/parse '%s'\n"
|
||||
@@ -491,7 +491,7 @@ def main():
|
||||
for item in return_pairs:
|
||||
#DEBUG
|
||||
# log_file.write("Returning:%s\n" % item.strip())
|
||||
- print item.strip('\n')
|
||||
+ print(item.strip('\n'))
|
||||
if want_tac_pairs:
|
||||
#DEBUG
|
||||
# log_file.write("Exiting status 2\n")
|
||||
@@ -507,7 +507,7 @@ def main():
|
||||
for item in return_pairs:
|
||||
#DEBUG
|
||||
# log_file.write("Returning:%s\n" % item.strip())
|
||||
- print item.strip('\n')
|
||||
+ print(item.strip('\n'))
|
||||
log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
|
||||
+ "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
|
||||
% (user_name, device, this_group, ip_addr))
|
||||
Reference in New Issue
Block a user