You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2019/11/19 06:35:00 UTC

[trafficserver] branch 8.0.x updated: Replaces Python -> Python3 in a few utilities (#6187)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.0.x by this push:
     new 3d2c4e6  Replaces Python -> Python3 in a few utilities (#6187)
3d2c4e6 is described below

commit 3d2c4e6f65b0b0dee8f50e01dcf90626c4303e0a
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Mon Nov 18 14:56:49 2019 +0800

    Replaces Python -> Python3 in a few utilities (#6187)
    
    
    (cherry picked from commit ae62e8a120eb4ea6d5925917fe9db11b8d5d0bf0)
---
 contrib/python/compare_RecordsConfigcc.py | 36 +++++++++++++++----------------
 contrib/python/compare_records_config.py  |  4 ++--
 tools/check-unused-dependencies           |  2 +-
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/contrib/python/compare_RecordsConfigcc.py b/contrib/python/compare_RecordsConfigcc.py
old mode 100644
new mode 100755
index 41992aa..802c718
--- a/contrib/python/compare_RecordsConfigcc.py
+++ b/contrib/python/compare_RecordsConfigcc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -23,8 +23,8 @@ import string
 try:
     src_dir = sys.argv[1]
 except IndexError:
-    print "Usage: %s [trafficserver_source_dir]" % sys.argv[0]
-    print "Compares values in RecordsConfig.cc with the default records.config file"
+    print("Usage: %s [trafficserver_source_dir]" % sys.argv[0])
+    print("Compares values in RecordsConfig.cc with the default records.config file")
     sys.exit(1)
 
 # We expect these keys to differ between files, so ignore them
@@ -56,12 +56,12 @@ with open("%s/mgmt/RecordsConfig.cc" % src_dir) as fh:
         m = cc_re.search(line)
         if m:
             value = m.group(3)
-            value = string.lstrip(value, '"')
-            value = string.rstrip(value, '"')
+            value = value.lstrip('"')
+            value = value.rstrip('"')
             rc_cc[m.group(1)] = (m.group(2), value)
 
 # Process records.config.default.in
-with open("%s/proxy/config/records.config.default.in" % src_dir) as fh:
+with open("%s/configs/records.config.default.in" % src_dir) as fh:
     in_re = re.compile(r'(?:CONFIG|LOCAL) (\S+)\s+(\S+)\s+(\S+)')
     for line in fh:
         m = in_re.match(line)
@@ -81,37 +81,37 @@ with open("%s/doc/admin-guide/files/records.config.en.rst" % src_dir) as fh:
 # Compare the two
 # If a value is in RecordsConfig.cc  and not records.config.default.in, it is
 # ignored right now.
-print "# Comparing RecordsConfig.cc -> records.config.default.in"
+print("# Comparing RecordsConfig.cc -> records.config.default.in")
 for key in rc_in:
     if key in ignore_keys:
         continue
     if key not in rc_cc:
-        print "%s missing -> %s" % (key, "%s %s" % rc_in[key])
+        print("%s missing -> %s" % (key, "%s %s" % rc_in[key]))
         continue
     if rc_cc[key] != rc_in[key]:
-        print "%s : %s -> %s" % (key, "%s %s" % rc_cc[key], "%s %s" % rc_in[key])
+        print("%s : %s -> %s" % (key, "%s %s" % rc_cc[key], "%s %s" % rc_in[key]))
 
 # Search for undocumented variables ...
 missing = [k for k in rc_cc if k not in rc_doc]
 if len(missing) > 0:
-    print
-    print "Undocumented configuration variables:"
+    print()
+    print("Undocumented configuration variables:")
     for m in sorted(missing):
-        print "\t%s %s" % (m, "%s %s" % rc_cc[m])
+        print("\t%s %s" % (m, "%s %s" % rc_cc[m]))
 
 # Search for incorrectly documented default values ...
 defaults = [k for k in rc_cc if k in rc_doc and rc_cc[k] != rc_doc[k]]
 if len(defaults) > 0:
-    print
-    print "Incorrectly documented defaults:"
+    print()
+    print("Incorrectly documented defaults:")
     for d in sorted(defaults):
-        print "\t%s %s -> %s" % (d, "%s %s" % rc_cc[d], "%s %s" % rc_doc[d])
+        print("\t%s %s -> %s" % (d, "%s %s" % rc_cc[d], "%s %s" % rc_doc[d]))
 
 
 # Search for stale documentation ...
 stale = [k for k in rc_doc if k not in rc_cc]
 if (len(stale) > 0):
-    print
-    print "Stale documentation:"
+    print()
+    print("Stale documentation:")
     for s in sorted(stale):
-        print "\t%s" % (s)
+        print("\t%s" % (s))
diff --git a/contrib/python/compare_records_config.py b/contrib/python/compare_records_config.py
old mode 100644
new mode 100755
index acde26a..bd610a9
--- a/contrib/python/compare_records_config.py
+++ b/contrib/python/compare_records_config.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -61,7 +61,7 @@ def compare_settings(old, new):
             # Skip predefined values
             continue
         if old[key] != new[key]:
-            print "%s %s -> %s" % (key, old[key], new[key])
+            print("%s %s -> %s" % (key, old[key], new[key]))
 
 
 if __name__ == '__main__':
diff --git a/tools/check-unused-dependencies b/tools/check-unused-dependencies
index 431d184..45ee526 100755
--- a/tools/check-unused-dependencies
+++ b/tools/check-unused-dependencies
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements. See the NOTICE file distributed with