[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)
via lldb-commits
lldb-commits at lists.llvm.org
Thu May 22 11:07:48 PDT 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 HEAD~1...HEAD lldb/scripts/version-header-fix.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- version-header-fix.py 2025-05-22 18:04:48.000000 +0000
+++ version-header-fix.py 2025-05-22 18:07:20.543790 +0000
@@ -7,13 +7,14 @@
import argparse
import os
import re
-LLDB_VERSION_REGEX = re.compile(r'^//#define LLDB_VERSION$')
-LLDB_REVISION_REGEX = re.compile(r'^//#define LLDB_REVISION$')
-LLDB_VERSION_STRING_REGEX = re.compile(r'^//#define LLDB_VERSION_STRING$')
+LLDB_VERSION_REGEX = re.compile(r"^//#define LLDB_VERSION$")
+LLDB_REVISION_REGEX = re.compile(r"^//#define LLDB_REVISION$")
+LLDB_VERSION_STRING_REGEX = re.compile(r"^//#define LLDB_VERSION_STRING$")
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument("input_path")
parser.add_argument("output_path")
@@ -38,15 +39,35 @@
# For the defines in lldb-defines.h that define the major, minor and version string
# uncomment each define and populate its value using the arguments passed in.
# e.g. //#define LLDB_VERSION -> #define LLDB_VERSION <LLDB_MAJOR_VERSION>
if version_match:
- output_file.write(re.sub(LLDB_VERSION_REGEX, r'#define LLDB_VERSION ' + lldb_version_major, line))
+ output_file.write(
+ re.sub(
+ LLDB_VERSION_REGEX,
+ r"#define LLDB_VERSION " + lldb_version_major,
+ line,
+ )
+ )
elif revision_match:
- output_file.write(re.sub(LLDB_REVISION_REGEX, r'#define LLDB_REVISION ' + lldb_version_minor, line))
+ output_file.write(
+ re.sub(
+ LLDB_REVISION_REGEX,
+ r"#define LLDB_REVISION " + lldb_version_minor,
+ line,
+ )
+ )
elif version_string_match:
- output_file.write(re.sub(LLDB_VERSION_STRING_REGEX, r'#define LLDB_VERSION_STRING "{0}.{1}.{2}"'.format(lldb_version_major, lldb_version_minor, lldb_version_patch), line))
+ output_file.write(
+ re.sub(
+ LLDB_VERSION_STRING_REGEX,
+ r'#define LLDB_VERSION_STRING "{0}.{1}.{2}"'.format(
+ lldb_version_major, lldb_version_minor, lldb_version_patch
+ ),
+ line,
+ )
+ )
else:
output_file.write(line)
if __name__ == "__main__":
``````````
</details>
https://github.com/llvm/llvm-project/pull/141116
More information about the lldb-commits
mailing list