Skip to content

Commit 5696fb3

Browse files
Merge pull request #43 from LouRohanNV/copyrightYears
Fix license_format to support proper date ranges
2 parents c3b5212 + a8bfc32 commit 5696fb3

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

mujoco_usd_converter/_impl/_flatten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33
import pathlib
44
import shutil

mujoco_usd_converter/_impl/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33
import pathlib
44
import tempfile

tests/testAssetStructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33
import pathlib
44

tools/license_format.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33
import argparse
44
import logging
@@ -9,9 +9,20 @@
99

1010
__copyright = "# SPDX-FileCopyrightText: Copyright (c) {years} The Newton Developers"
1111
__identifier = "# SPDX-License-Identifier: Apache-2.0"
12+
__start_year = 2025
13+
14+
# Build regex to match valid year patterns
15+
# Valid: single year (2025-current) OR range (start_year-end_year) where both <= current year
16+
# Invalid: future years beyond current year
17+
__current_year = datetime.now().year
18+
__single_years = "|".join(str(year) for year in range(__start_year, __current_year + 1))
19+
__range_starts = "|".join(str(year) for year in range(__start_year, __current_year + 1))
20+
__range_ends = "|".join(str(year) for year in range(__start_year, __current_year + 1))
21+
__years_pattern = f"(?:{__single_years}|(?:{__range_starts})-(?:{__range_ends}))"
22+
1223
# Escape special regex characters in the copyright template
1324
__copyright_template = re.escape(__copyright).replace(re.escape("{years}"), "{years}")
14-
__copyright_years = __copyright_template.replace("{years}", f"(?:2025|(?:20[0-9][0-4])-{datetime.now().year})")
25+
__copyright_years = __copyright_template.replace("{years}", __years_pattern)
1526
__copyright_regex = re.compile(f"^{__copyright_years}$")
1627

1728

0 commit comments

Comments
 (0)