]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man/90-rearrange-path: apply "ruff format" and "ruff check --fix"
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 19 Feb 2026 16:48:59 +0000 (01:48 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 May 2026 17:44:46 +0000 (02:44 +0900)
man/90-rearrange-path.py

index b5b6294754caed64b8a4d3518dfdbfb1520a7961..278311f0ab52321d3ad5f00624fc0ddfcb15ba45 100755 (executable)
@@ -17,6 +17,7 @@ interesting generators.
 import os
 import pathlib
 
+
 def rearrange_bin_sbin(path):
     """Make sure any pair of …/bin, …/sbin directories is in this order
 
@@ -27,15 +28,16 @@ def rearrange_bin_sbin(path):
     for i in range(len(items)):
         if 'sbin' in items[i].parts:
             ind = items[i].parts.index('sbin')
-            bin = pathlib.Path(*items[i].parts[:ind], 'bin', *items[i].parts[ind+1:])
-            if bin in items[i+1:]:
-                j = i + 1 + items[i+1:].index(bin)
+            bin = pathlib.Path(*items[i].parts[:ind], 'bin', *items[i].parts[ind + 1 :])
+            if bin in items[i + 1 :]:
+                j = i + 1 + items[i + 1 :].index(bin)
                 items[i], items[j] = items[j], items[i]
     return ':'.join(p.as_posix() for p in items)
 
+
 if __name__ == '__main__':
-    path = os.environ['PATH'] # This should be always set.
-                              # If it is not, we will just crash, which is OK too.
+    # This should be always set. If it is not, we will just crash, which is OK too.
+    path = os.environ['PATH']
     new = rearrange_bin_sbin(path)
     if new != path:
-        print('PATH={}'.format(new))
+        print(f'PATH={new}')