Merge pull request #89421 from /pre-commit-fix-copyright_headers

This commit is contained in:
Rémi Verschelde 2024-03-15 17:01:24 +01:00
commit 691bd17df8
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 51 additions and 47 deletions

View file

@ -39,10 +39,10 @@ repos:
entry: python3 misc/scripts/copyright_headers.py
exclude: |
(?x)^(
tests/python_build.*|
.*thirdparty.*|
.*platform/android/java/lib/src/com.*|
.*-so_wrap.*|
core/math/bvh_.*\.inc$|
platform/android/java/lib/src/com.*|
platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.*|
platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.*|
platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.*

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
header = """\
@ -35,12 +36,15 @@ header = """\
/**************************************************************************/
"""
fname = sys.argv[1]
if len(sys.argv) < 2:
print("Invalid usage of copyright_headers.py, it should be called with a path to one or multiple files.")
sys.exit(1)
for f in sys.argv[1:]:
fname = f
# Handle replacing $filename with actual filename and keep alignment
fsingle = fname.strip()
if fsingle.find("/") != -1:
fsingle = fsingle[fsingle.rfind("/") + 1 :]
fsingle = os.path.basename(fname.strip())
rep_fl = "$filename"
rep_fi = fsingle
len_fl = len(rep_fl)