[libcxx-commits] [libcxx] [libc++] Add script to create new Github issues for tracking conformance (PR #118139)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 29 13:44:41 PST 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/118139
None
>From 921ae2bc5d52e4c37fb569462bc9b9e3c86b0759 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 2 Aug 2024 12:58:37 -0400
Subject: [PATCH] [libc++] Add script to create new Github issues for tracking
conformance
---
...ze_csv_status_files.py => status-files.py} | 74 +++++++++++++++----
1 file changed, 58 insertions(+), 16 deletions(-)
rename libcxx/utils/{synchronize_csv_status_files.py => status-files.py} (80%)
diff --git a/libcxx/utils/synchronize_csv_status_files.py b/libcxx/utils/status-files.py
similarity index 80%
rename from libcxx/utils/synchronize_csv_status_files.py
rename to libcxx/utils/status-files.py
index 8317dde770baf6..a3a39963426193 100755
--- a/libcxx/utils/synchronize_csv_status_files.py
+++ b/libcxx/utils/status-files.py
@@ -322,6 +322,33 @@ def sync_csv(rows: List[Tuple], from_github: List[PaperInfo]) -> List[Tuple]:
return results
+def create_github_issues(rows: List[Tuple], labels: List[str]) -> None:
+ """
+ Given a list of CSV rows representing newly voted issues and papers, create the Github issues
+ representing those and add them to the conformance table.
+ """
+ for row in rows:
+ paper = PaperInfo.from_csv_row(row)
+ paper_name = paper.paper_name.replace('``', '`').replace('\\', '')
+
+ create_cli = ['gh', 'issue', 'create', '--repo', 'llvm/llvm-project',
+ '--title', f'{paper.paper_number}: {paper_name}',
+ '--body', f'**Link:** https://wg21.link/{paper.paper_number}',
+ '--project', 'libc++ Standards Conformance',
+ '--label', 'libc++']
+
+ for label in labels:
+ create_cli += ['--label', label]
+
+ issue_link = subprocess.check_output(create_cli).decode().strip()
+ print(f"\nCreated tracking issue for {paper.paper_number}: {issue_link}")
+
+ # TODO: It would be possible to adjust the "Meeting voted" field automatically, but we need
+ # the ID of the just-created issue.
+ # adjust_meeting = ['gh', 'project', 'item-edit', '--project-id', 'PVT_kwDOAQWwKc4AlOgt',
+ # '--field-id', 'PVTF_lADOAQWwKc4AlOgtzgdUEXI',
+ # '--text', paper.meeting, '--id', tracking.original['id']]
+
CSV_FILES_TO_SYNC = [
'Cxx17Issues.csv',
'Cxx17Papers.csv',
@@ -333,21 +360,36 @@ def sync_csv(rows: List[Tuple], from_github: List[PaperInfo]) -> List[Tuple]:
'Cxx2cPapers.csv',
]
-def main():
- libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
- # Extract the list of PaperInfos from issues we're tracking on Github.
- print("Loading all issues from Github")
- gh_command_line = ['gh', 'project', 'item-list', LIBCXX_CONFORMANCE_PROJECT, '--owner', 'llvm', '--format', 'json', '--limit', '9999999']
- project_info = json.loads(subprocess.check_output(gh_command_line))
- from_github = [PaperInfo.from_github_issue(i) for i in project_info['items']]
-
- for filename in CSV_FILES_TO_SYNC:
- print(f"Synchronizing {filename} with Github issues")
- file = libcxx_root / 'docs' / 'Status' / filename
- csv = load_csv(file)
- synced = sync_csv(csv, from_github)
- write_csv(file, synced)
+def main(argv):
+ import argparse
+ parser = argparse.ArgumentParser(prog='status-files',
+ description='Manipulate the libc++ conformance status files and Github issues')
+ parser.add_argument('--synchronize', action='store_true', help="Synchronize the CSV files with the online Github issues.")
+ parser.add_argument('--create-new', help="Create new Github issues from the CSV rows located in the given file.")
+ parser.add_argument('--labels', nargs='+', help="When creating new Github issues, this is a list of labels to use on the created issues (e.g. lwg-issue, wg21 paper, c++23).")
+ args = parser.parse_args(argv)
+
+ if args.synchronize:
+ libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+ # Extract the list of PaperInfos from issues we're tracking on Github.
+ print("Loading all issues from Github")
+ gh_command_line = ['gh', 'project', 'item-list', LIBCXX_CONFORMANCE_PROJECT, '--owner', 'llvm', '--format', 'json', '--limit', '9999999']
+ project_info = json.loads(subprocess.check_output(gh_command_line))
+ from_github = [PaperInfo.from_github_issue(i) for i in project_info['items']]
+
+ for filename in CSV_FILES_TO_SYNC:
+ print(f"Synchronizing {filename} with Github issues")
+ file = libcxx_root / 'docs' / 'Status' / filename
+ csv = load_csv(file)
+ synced = sync_csv(csv, from_github)
+ write_csv(file, synced)
+
+ elif args.create_new:
+ print(f"Creating new Github issues from {args.create_new}")
+ new = load_csv(args.create_new)
+ create_github_issues(new, args.labels)
if __name__ == '__main__':
- main()
+ import sys
+ main(sys.argv[1:])
More information about the libcxx-commits
mailing list