Skip to content

Commit f451fae

Browse files
committed
Additional attributes in .gitattributes do not interfece with the license maintainer
1 parent 5b46918 commit f451fae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.githooks/license_maintainer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ def file_license(attributes):
9797
with open(attributes, 'r+b') as f:
9898
# Read in .gitattributes
9999
tmp_mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
100-
# Removing all comment lines
101-
gitattributes = re.sub(r'(?m)^\#.*\n?', '', tmp_mm).split()
100+
# Removing all comment lines and other attributes
101+
pattern = re.compile("|".join([r'(?m)^\#.*\n?', r'^((?!licensefile).)*$']))
102+
gitattributes = re.sub(pattern, '', tmp_mm).split()
102103
# Obtain list of files
103104
fil = [x for x in gitattributes if not 'licensefile' in x]
104105
# Remove licensefile= from strings

0 commit comments

Comments
 (0)