|
|
@@ -37,7 +37,12 @@ def copy_file(source: Path, target: Path, mode: int = 0o644) -> None:
|
|
|
if not source.is_file():
|
|
|
raise FileNotFoundError(source)
|
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
|
- shutil.copyfile(source, target)
|
|
|
+ if source.suffix == ".sh":
|
|
|
+ # A Windows checkout may contain CRLF. Release scripts must keep a
|
|
|
+ # Linux shebang and LF line endings after extraction.
|
|
|
+ target.write_bytes(source.read_bytes().replace(b"\r\n", b"\n"))
|
|
|
+ else:
|
|
|
+ shutil.copyfile(source, target)
|
|
|
target.chmod(mode)
|
|
|
|
|
|
|