-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add script that copies contributing into docs
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Copies ``CONTROBUTING.md`` from root to the docs""" | ||
import shutil | ||
from pathlib import Path | ||
from tempfile import TemporaryFile | ||
|
||
KPOPS_ROOT = Path(__file__).parents[2].resolve() | ||
SOURCE = KPOPS_ROOT / "CONTRIBUTING.md" | ||
DEST = KPOPS_ROOT / "docs/docs/developer/contributing.md" | ||
HEADER = f"<!-- This file is autogenerated by {Path(__file__)}. -->\n".encode() | ||
|
||
# Copy `CONTRIBUTING.md` into the equivalent file in the docs, | ||
# adding a comment at the top which notes that the file is generated | ||
with TemporaryFile() as file_header: | ||
file_header.write(HEADER) | ||
file_header.seek(0) | ||
with DEST.open("w+b") as file_dest: | ||
with SOURCE.open("rb") as file_source: | ||
shutil.copyfileobj(file_header, file_dest) | ||
shutil.copyfileobj(file_source, file_dest) |