commit a762234ba27d89f3394e560c2b0cf976648ca779 Author: teor teor@torproject.org Date: Fri Apr 3 19:11:08 2020 +1000
scripts: Ignore editor temporary files
Ignore editor temporary files when autostyling in: * rectify_include_paths.py * rename_c_identifier.py
Obviously correct changes to already-reviewed code. --- scripts/maint/rectify_include_paths.py | 12 ++++++++++++ scripts/maint/rename_c_identifier.py | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/scripts/maint/rectify_include_paths.py b/scripts/maint/rectify_include_paths.py index c6c502671..6c7b25253 100755 --- a/scripts/maint/rectify_include_paths.py +++ b/scripts/maint/rectify_include_paths.py @@ -29,6 +29,12 @@ def get_include_map(): exclude(["ext", "win32"], dirnames)
for fname in fnames: + # Avoid editor temporary files + if fname.startswith("."): + continue + if fname.startswith("#"): + continue + if fname.endswith(".h"): if fname in includes: warn("Multiple headers named %s"%fname) @@ -63,6 +69,12 @@ for dirpath,dirnames,fnames in os.walk("src"): exclude(["trunnel"], dirnames)
for fname in fnames: + # Avoid editor temporary files + if fname.startswith("."): + continue + if fname.startswith("#"): + continue + if fname.endswith(".c") or fname.endswith(".h"): fname = os.path.join(dirpath, fname) tmpfile = fname+".tmp" diff --git a/scripts/maint/rename_c_identifier.py b/scripts/maint/rename_c_identifier.py index 6e0c1d8cf..77802e10f 100755 --- a/scripts/maint/rename_c_identifier.py +++ b/scripts/maint/rename_c_identifier.py @@ -44,7 +44,8 @@ def is_c_file(fn): False """ fn = os.path.split(fn)[1] - if fn.startswith("."): + # Avoid editor temporary files + if fn.startswith(".") or fn.startswith("#"): return False ext = os.path.splitext(fn)[1] return ext in {".c", ".h", ".i", ".inc"}
tor-commits@lists.torproject.org