-
Notifications
You must be signed in to change notification settings - Fork 724
Add license to framework sdist builds #3002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,11 @@ | |
| shutil.rmtree(build_tools_copy) | ||
| shutil.copytree(build_tools_dir, build_tools_copy) | ||
|
|
||
| license_src = current_file_path.parent.parent / "LICENSE" | ||
| license_dst = current_file_path / "LICENSE" | ||
| if license_src.is_file(): | ||
| shutil.copyfile(license_src, license_dst) | ||
|
|
||
|
|
||
| from build_tools.build_ext import get_build_ext | ||
| from build_tools.utils import copy_common_headers, min_python_version_str | ||
|
|
@@ -131,7 +136,10 @@ def get_cuda_major_version() -> int: | |
| python_requires=f">={min_python_version_str()}", | ||
| install_requires=install_requires, | ||
| tests_require=test_requirements(), | ||
| license_files=("LICENSE",), | ||
| ) | ||
| if any(x in sys.argv for x in (".", "sdist", "bdist_wheel")): | ||
| shutil.rmtree(common_headers_dir) | ||
| shutil.rmtree("build_tools") | ||
| if license_dst.is_file(): | ||
| license_dst.unlink() | ||
|
Comment on lines
+144
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__main__The
shutil.copyfilecall runs unconditionally at import time (module scope), whilelicense_dst.unlink()only executes when__name__ == "__main__"and specific build commands are insys.argv. If any tooling inspects or imports this file without running it as__main__(e.g., certain PEP 517 build-backend introspection steps), theLICENSEfile will be copied to the framework source directory and never removed. Placing the copy inside theif __name__ == "__main__":block — mirroring howcommon_headers_diris handled — would keep the lifecycle symmetric. The same issue is present intransformer_engine/pytorch/setup.py.