#--------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #--------------------------------------------------------------------------------------------- # Add license header to every *.py file in the repo. Can be run multiple times without duplicating the headers. from _common import PY_LICENSE_HEADER, get_files_without_header, has_shebang files_without_header = get_files_without_header() for file_path, file_contents in files_without_header: with open(file_path, 'w') as modified: if has_shebang(file_contents): lines = file_contents.split('\n') modified.write(lines[0]) modified.write('\n' + PY_LICENSE_HEADER) modified.write('\n'.join(lines[1:])) else: modified.write(PY_LICENSE_HEADER + file_contents)
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # Verify that all *.py files have a license header in the file. from __future__ import print_function import sys from _common import get_files_without_header files_without_header = [file_path for file_path, file_contents in get_files_without_header()] if files_without_header: print("Error: The following files don't have the required license headers:", file=sys.stderr) print('\n'.join(files_without_header), file=sys.stderr) print("Error: {} file(s) found without license headers.".format(len(files_without_header)), file=sys.stderr) sys.exit(1) else: print('OK')
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # Verify that all *.py files have a license header in the file. from __future__ import print_function import sys from _common import get_files_without_header files_without_header = [ file_path for file_path, file_contents in get_files_without_header() ] if files_without_header: print( "Error: The following files don't have the required license headers:", file=sys.stderr) print('\n'.join(files_without_header), file=sys.stderr) print("Error: {} file(s) found without license headers.".format( len(files_without_header)), file=sys.stderr) sys.exit(1) else: print('OK')
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # Verify that all *.py files have a license header in the file. from __future__ import print_function import sys from _common import get_files_without_header files_without_header = [file_path for file_path, file_contents in get_files_without_header() if not file_path.endswith('azure_bdist_wheel.py')] if files_without_header: print("Error: The following files don't have the required license headers:", file=sys.stderr) print('\n'.join(files_without_header), file=sys.stderr) print("Error: {} file(s) found without license headers.".format(len(files_without_header)), file=sys.stderr) sys.exit(1) else: print('OK')