]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
scripts: Ignore editor temporary files
authorteor <teor@torproject.org>
Fri, 3 Apr 2020 09:11:08 +0000 (19:11 +1000)
committerteor <teor@torproject.org>
Fri, 3 Apr 2020 09:16:57 +0000 (19:16 +1000)
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
scripts/maint/rename_c_identifier.py

index c6c5026711fa1c2bac0d3b3dde631c2e14fde222..6c7b2525358f4119dfc6dea7771b0da589b44860 100755 (executable)
@@ -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"
index 6e0c1d8cf1b6f8300f054fe58e2cfd14b00bec63..77802e10f388773ddf2684d4a593dcb3528079c3 100755 (executable)
@@ -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"}