mirror of
https://github.com/mesonbuild/meson.git
synced 2026-06-24 08:48:03 +00:00
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright 2018 The Meson development team
|
|
|
|
'''
|
|
Copy files
|
|
'''
|
|
|
|
import argparse
|
|
import shutil
|
|
import typing as T
|
|
from pathlib import Path
|
|
|
|
PathLike = T.Union[Path,str]
|
|
|
|
def copy_files(files: T.List[str], input_dir: PathLike, output_dir: PathLike) -> None:
|
|
if not input_dir:
|
|
raise ValueError(f'Input directory value is not set')
|
|
if not output_dir:
|
|
raise ValueError(f'Output directory value is not set')
|
|
|
|
input_dir = Path(input_dir).resolve()
|
|
output_dir = Path(output_dir).resolve()
|
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
for f in files:
|
|
if (input_dir/f).is_dir():
|
|
shutil.copytree(input_dir/f, output_dir/f)
|
|
else:
|
|
shutil.copy2(input_dir/f, output_dir/f)
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description='Copy files')
|
|
parser.add_argument('files', metavar='FILE', nargs='*')
|
|
parser.add_argument('-C', dest='input_dir', required=True)
|
|
parser.add_argument('--output-dir', required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
copy_files(files=args.files,
|
|
input_dir=args.input_dir,
|
|
output_dir=args.output_dir)
|