You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Pre-commit: Fix copyright_headers.py to run on all relevant files
It was only running on the first file passed by pre-commit, instead of all. Fixes compatibility with Windows paths to get the basename.
This commit is contained in:
@@ -39,10 +39,10 @@ repos:
|
|||||||
entry: python3 misc/scripts/copyright_headers.py
|
entry: python3 misc/scripts/copyright_headers.py
|
||||||
exclude: |
|
exclude: |
|
||||||
(?x)^(
|
(?x)^(
|
||||||
tests/python_build.*|
|
|
||||||
.*thirdparty.*|
|
.*thirdparty.*|
|
||||||
.*platform/android/java/lib/src/com.*|
|
|
||||||
.*-so_wrap.*|
|
.*-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/GLSurfaceView.*|
|
||||||
platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.*|
|
platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.*|
|
||||||
platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.*
|
platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
header = """\
|
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
|
# Handle replacing $filename with actual filename and keep alignment
|
||||||
fsingle = fname.strip()
|
fsingle = os.path.basename(fname.strip())
|
||||||
if fsingle.find("/") != -1:
|
|
||||||
fsingle = fsingle[fsingle.rfind("/") + 1 :]
|
|
||||||
rep_fl = "$filename"
|
rep_fl = "$filename"
|
||||||
rep_fi = fsingle
|
rep_fi = fsingle
|
||||||
len_fl = len(rep_fl)
|
len_fl = len(rep_fl)
|
||||||
|
|||||||
Reference in New Issue
Block a user