diff --git a/stub_uploader/build_wheel.py b/stub_uploader/build_wheel.py index a55a1833..44631727 100644 --- a/stub_uploader/build_wheel.py +++ b/stub_uploader/build_wheel.py @@ -281,14 +281,16 @@ def create_py_typed(metadata: Metadata, pkg_data: PackageData, dst: Path) -> Non py_typed_path.write_text("partial\n" if metadata.partial else "") -def copy_changelog(distribution: str, dst: str) -> None: +def copy_license(ts_data: TypeshedData, dst: Path) -> None: + """Copy the license file from the typeshed repository to the build directory.""" + shutil.copy(ts_data.typeshed_path / "LICENSE", dst / "LICENSE") + + +def copy_changelog(distribution: str, dst: Path) -> None: """Copy changelog to the build directory.""" try: - shutil.copy( - os.path.join(CHANGELOG_PATH, f"{distribution}.md"), - os.path.join(dst, CHANGELOG), - ) - with open(os.path.join(dst, "MANIFEST.in"), "a") as f: + shutil.copy(CHANGELOG_PATH / f"{distribution}.md", dst / CHANGELOG) + with open(dst / "MANIFEST.in", "a") as f: f.write(f"include {CHANGELOG}\n") except FileNotFoundError: pass # Ignore missing changelogs @@ -447,7 +449,8 @@ def main( (tmpdir / "README.md").write_text( generate_long_description(distribution, ts_data, metadata) ) - copy_changelog(distribution, str(tmpdir)) + copy_license(ts_data, tmpdir) + copy_changelog(distribution, tmpdir) print(f"\033[0;33mRunning '{sys.executable} -m build --no-isolation' in {tmpdir}") print() diff --git a/stub_uploader/const.py b/stub_uploader/const.py index 5b44aab4..d7ec9f1c 100644 --- a/stub_uploader/const.py +++ b/stub_uploader/const.py @@ -6,5 +6,5 @@ TYPES_PREFIX = "types-" _ROOT = pathlib.Path(__file__).parent.parent -CHANGELOG_PATH = str((_ROOT / "data" / "changelogs").resolve()) +CHANGELOG_PATH = (_ROOT / "data" / "changelogs").resolve() UPLOADED_PATH = str((_ROOT / "data" / "uploaded_packages.txt").resolve())