[libc-commits] [libc] [libc] Make hdrgen emit correct relative paths for llvm-libc-types (PR #127150)

via libc-commits libc-commits at lists.llvm.org
Thu Feb 13 16:52:00 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r 912b154f3a3f8c3cebf5cc5731fd8b0749762da5...6ea03b4875cb9d6d720c292410f5afe26fb31b2e libc/utils/hdrgen/header.py libc/utils/hdrgen/tests/test_integration.py libc/utils/hdrgen/type.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- header.py	2025-02-14 00:42:45.000000 +0000
+++ header.py	2025-02-14 00:51:32.125970 +0000
@@ -39,11 +39,14 @@
             {
                 PurePosixPath("llvm-libc-macros") / macro.header
                 for macro in self.macros
                 if macro.header is not None
             }
-            | {PurePosixPath("llvm-libc-types") / f"{typ.type_name}.h" for typ in self.types}
+            | {
+                PurePosixPath("llvm-libc-types") / f"{typ.type_name}.h"
+                for typ in self.types
+            }
         )
 
     def public_api(self):
         # Python 3.12 has .relative_to(dir, walk_up=True) for this.
         path_prefix = PurePosixPath("../" * (len(PurePosixPath(self.name).parents) - 1))
@@ -51,14 +54,11 @@
         def relpath(file):
             return path_prefix / file
 
         content = [
             f"#include {file}"
-            for file in sorted(
-                f'"{relpath(file)!s}"'
-                for file in self.includes()
-            )
+            for file in sorted(f'"{relpath(file)!s}"' for file in self.includes())
         ]
 
         for macro in self.macros:
             # When there is nothing to define, the Macro object converts to str
             # as an empty string.  Don't emit a blank line for those cases.

``````````

</details>


https://github.com/llvm/llvm-project/pull/127150


More information about the libc-commits mailing list