[tor-commits] [tor/master] Teach --check-subsystem-order to take input from stdin

teor at torproject.org teor at torproject.org
Tue Apr 7 07:36:57 UTC 2020


commit 978b7ef45c21169a01a81cd1b206530cbcd47fe2
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Mar 26 12:30:30 2020 -0400

    Teach --check-subsystem-order to take input from stdin
---
 scripts/maint/practracker/includes.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/maint/practracker/includes.py b/scripts/maint/practracker/includes.py
index 7af378d5c..7d70a6a0a 100755
--- a/scripts/maint/practracker/includes.py
+++ b/scripts/maint/practracker/includes.py
@@ -254,11 +254,18 @@ def walk_c_files(topdir="src"):
                     for err in consider_include_rules(fullpath, f):
                         yield err
 
+def open_or_stdin(fname):
+    if fname == '-':
+        return sys.stdin
+    else:
+        return open(fname)
+
 def check_subsys_file(fname, uses_dirs):
     uses_closure = closure(uses_dirs)
     ok = True
     previous_subsystems = []
-    with open(fname) as f:
+
+    with open_or_stdin(fname) as f:
         for line in f:
             _, name, fname = line.split()
             fname = re.sub(r'^.*/src/', "", fname)





More information about the tor-commits mailing list