Skip to content

Commit

Permalink
[Misc] Fix improper placement of SPDX header in scripts (vllm-project…
Browse files Browse the repository at this point in the history
…#12694)

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Felix Marty <felmarty@amd.com>
  • Loading branch information
russellb authored and fxmarty-amd committed Feb 7, 2025
1 parent 3d5064e commit bdd6fc4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
3 changes: 1 addition & 2 deletions cmake/hipify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

#
# A command line tool for running pytorch's hipify preprocessor on CUDA
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_transformers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Test the functionality of the Transformers backend.
Run `pytest tests/models/test_transformers.py`.
Expand Down
17 changes: 12 additions & 5 deletions tools/check_spdx_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ def check_spdx_header(file_path):
with open(file_path, encoding='UTF-8') as file:
lines = file.readlines()
if not lines:
# not necessary for an empty file like __init__.py
# Empty file like __init__.py
return True
if not lines[0].strip().startswith(SPDX_HEADER_PREFIX):
return False
return True
for line in lines:
if line.strip().startswith(SPDX_HEADER_PREFIX):
return True
return False


def add_header(file_path):
with open(file_path, 'r+', encoding='UTF-8') as file:
lines = file.readlines()
file.seek(0, 0)
file.write(SPDX_HEADER + '\n\n' + ''.join(lines))
if lines and lines[0].startswith("#!"):
file.write(lines[0])
file.write(SPDX_HEADER + '\n')
file.writelines(lines[1:])
else:
file.write(SPDX_HEADER + '\n')
file.writelines(lines)


def main():
Expand Down
2 changes: 1 addition & 1 deletion tools/report_build_time_ninja.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

#!/usr/bin/env python3
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
Expand Down
3 changes: 1 addition & 2 deletions vllm/attention/ops/triton_flash_attention.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

#!/usr/bin/env python
# SPDX-License-Identifier: Apache-2.0
"""
Fused Attention
===============
Expand Down
1 change: 1 addition & 0 deletions vllm/model_executor/models/transformers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 The vLLM team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down

0 comments on commit bdd6fc4

Please sign in to comment.