From d1011b3754b22dba895d5a7eaa63a82fd607c462 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Mon, 16 Mar 2026 10:33:30 +0100 Subject: [PATCH 1/2] Bump vsce-helper version --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b35e0e74..fc621398 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "@graphql-codegen/cli": "^6.1.2", "@graphql-codegen/typescript-graphql-request": "^6.4.0", "@graphql-codegen/typescript-operations": "^5.0.8", - "@open-cmsis-pack/vsce-helper": "^0.2.4", + "@open-cmsis-pack/vsce-helper": "^0.3.0", "@playwright/test": "^1.58.2", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", @@ -5589,21 +5589,21 @@ } }, "node_modules/@open-cmsis-pack/vsce-helper": { - "version": "0.2.4", - "integrity": "sha512-WynZtqOo9IM0mCkSKLhSXvD9RpY87t0KUm0hEewASFVTZZyGJut7FRfeYr7Ffo8UCZBIq2LxTshLvNZst0Sy3g==", + "version": "0.3.0", + "integrity": "sha512-2qb0JIl43LUgj/ypRIdiGPcAAx3JcyYGutbPKXZayAQKtHUQEpL/Z2LlkOWSq9hQ1kZYYVq9InRhU5naJ06Zhw==", "dev": true, "license": "Apache-2.0", "dependencies": { "extract-zip": "^2.0.1", "node-fetch": "^3.3.2", "octokit": "^5.0.3", - "tar": "^7.5.8", + "tar": "^7.5.11", "tempfile": "^6.0.1", "type-fest": "^5.4.4", "yargs": "^18.0.0" }, "engines": { - "node": "^20.19.0", + "node": "^22.22.0", "npm": "^10.8.0" }, "optionalDependencies": { diff --git a/package.json b/package.json index 0961b7a6..dfc98151 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "@graphql-codegen/cli": "^6.1.2", "@graphql-codegen/typescript-graphql-request": "^6.4.0", "@graphql-codegen/typescript-operations": "^5.0.8", - "@open-cmsis-pack/vsce-helper": "^0.2.4", + "@open-cmsis-pack/vsce-helper": "^0.3.0", "@playwright/test": "^1.58.2", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", From 783c41cd76a3fc9e1399fc1e75e0555000f98f65 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Mon, 16 Mar 2026 10:45:14 +0100 Subject: [PATCH 2/2] Updated script to fix correct copyright year --- update_copyright_years.py | 81 +++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/update_copyright_years.py b/update_copyright_years.py index 5e78d827..8e58b9d6 100644 --- a/update_copyright_years.py +++ b/update_copyright_years.py @@ -1,15 +1,20 @@ #!/usr/bin/env python3 """ -Copyright (C) 2025-2026 Arm Limited +Copyright 2025-2026 Arm Limited -This script updates copyright headers in source files to reflect the current year. -It supports headers in the format: - Copyright (C) Arm Limited - Copyright (C) - Arm Limited -If the header does not reflect the current year, it will be updated to -. -SPDX-FileCopyrightText headers are also updated similarly. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at -The script is generated using ChatGPT + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +generated with AI """ import re, sys, pathlib @@ -18,39 +23,63 @@ CURRENT_YEAR = datetime.datetime.now().year # Use system year COPYRIGHT_PATTERN = re.compile( - r'(?PCopyright(?:\s*\(c\))?[^0-9\n]{0,40})' + r'\bCopyright(?:[ \t]*\(c\))?[ \t]*' r'(?P\d{4})' - r'(?:\s*-\s*(?P\d{4}))?', - flags=re.IGNORECASE -) -SPDX_PATTERN = re.compile( - r'(?PSPDX-FileCopyrightText:\s*)' - r'(?P\d{4})' - r'(?:\s*-\s*(?P\d{4}))?', + r'(?:[ \t]*-[ \t]*(?P\d{4}))?' + r'(?:[ \t]+Arm[ \t]+Limited\b)*', flags=re.IGNORECASE ) def update_text(t: str): changed = False + + def canonical_copyright(y1: int, y2: int | None) -> str: + if y2 is None: + return f"Copyright {y1} Arm Limited" + return f"Copyright {y1}-{y2} Arm Limited" + def repl(m): nonlocal changed y1 = int(m.group('y1')) y2 = m.group('y2') if y2: y2 = int(y2) - if y2 >= CURRENT_YEAR: return m.group(0) - changed = True - return f"{m.group('prefix')}{y1}-{CURRENT_YEAR}" + target_y2 = y2 if y2 >= CURRENT_YEAR else CURRENT_YEAR + new_text = canonical_copyright(y1, target_y2) else: - if y1 == CURRENT_YEAR: return m.group(0) - changed = True - return f"{m.group('prefix')}{y1}-{CURRENT_YEAR}" + new_text = ( + canonical_copyright(y1, None) + if y1 == CURRENT_YEAR + else canonical_copyright(y1, CURRENT_YEAR) + ) + + if new_text == m.group(0): + return m.group(0) + + changed = True + return new_text + t2 = COPYRIGHT_PATTERN.sub(repl, t) - t2 = SPDX_PATTERN.sub(repl, t2) return t2, changed + +def collect_paths() -> list[str]: + # Prefer explicit CLI paths; otherwise read piped stdin. + if len(sys.argv) > 1: + return [p.strip() for p in sys.argv[1:] if p.strip()] + if not sys.stdin.isatty(): + return [p.strip() for p in sys.stdin if p.strip()] + return [] + def main(): - paths = [p.strip() for p in sys.stdin if p.strip()] + paths = collect_paths() + if not paths: + print( + "Usage: python update_copyright_years.py ...\n" + " or: | python update_copyright_years.py" + ) + return 2 + updated = 0 for p in paths: fp = pathlib.Path(p) @@ -69,5 +98,7 @@ def main(): print(f"[OK ] {p}") updated += 1 print(f"Updated {updated} files to year {CURRENT_YEAR}") + return 0 + if __name__ == "__main__": - main() + raise SystemExit(main())