Skip to content

Commit 59e9952

Browse files
russellbshreyankg
authored andcommitted
[Misc] Fix improper placement of SPDX header in scripts (vllm-project#12694)
Signed-off-by: Russell Bryant <[email protected]>
1 parent 0e69193 commit 59e9952

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

cmake/hipify.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# SPDX-License-Identifier: Apache-2.0
2-
31
#!/usr/bin/env python3
2+
# SPDX-License-Identifier: Apache-2.0
43

54
#
65
# A command line tool for running pytorch's hipify preprocessor on CUDA

tests/models/test_transformers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
12
"""Test the functionality of the Transformers backend.
23
34
Run `pytest tests/models/test_transformers.py`.

tools/check_spdx_header.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,25 @@ def check_spdx_header(file_path):
1010
with open(file_path, encoding='UTF-8') as file:
1111
lines = file.readlines()
1212
if not lines:
13-
# not necessary for an empty file like __init__.py
13+
# Empty file like __init__.py
1414
return True
15-
if not lines[0].strip().startswith(SPDX_HEADER_PREFIX):
16-
return False
17-
return True
15+
for line in lines:
16+
if line.strip().startswith(SPDX_HEADER_PREFIX):
17+
return True
18+
return False
1819

1920

2021
def add_header(file_path):
2122
with open(file_path, 'r+', encoding='UTF-8') as file:
2223
lines = file.readlines()
2324
file.seek(0, 0)
24-
file.write(SPDX_HEADER + '\n\n' + ''.join(lines))
25+
if lines and lines[0].startswith("#!"):
26+
file.write(lines[0])
27+
file.write(SPDX_HEADER + '\n')
28+
file.writelines(lines[1:])
29+
else:
30+
file.write(SPDX_HEADER + '\n')
31+
file.writelines(lines)
2532

2633

2734
def main():

tools/report_build_time_ninja.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#!/usr/bin/env python3
12
# SPDX-License-Identifier: Apache-2.0
23

3-
#!/usr/bin/env python3
44
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
55
# Use of this source code is governed by a BSD-style license that can be
66
# found in the LICENSE file.

vllm/attention/ops/triton_flash_attention.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# SPDX-License-Identifier: Apache-2.0
2-
31
#!/usr/bin/env python
2+
# SPDX-License-Identifier: Apache-2.0
43
"""
54
Fused Attention
65
===============

vllm/model_executor/models/transformers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
12
# Copyright 2024 The vLLM team.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)