paddyroddy commented on code in PR #47141:
URL: https://github.com/apache/arrow/pull/47141#discussion_r2623326916
##########
python/setup.py:
##########
@@ -395,11 +397,41 @@ def has_ext_modules(foo):
return True
+class CopyLicenseSdist(sdist):
+ """Custom sdist command that copies license files from parent directory."""
+
+ def make_release_tree(self, base_dir, files):
+ # Call parent to do the normal work
+ super().make_release_tree(base_dir, files)
+
+ # Define source (parent dir) and destination (sdist root) for license
files
+ license_files = [
+ ("LICENSE.txt", "../LICENSE.txt"),
+ ("NOTICE.txt", "../NOTICE.txt"),
+ ]
+
+ for dest_name, src_path in license_files:
+ src_full = os.path.join(os.path.dirname(__file__), src_path)
+ dest_full = os.path.join(base_dir, dest_name)
+
+ # Remove any existing file/symlink at destination
+ if os.path.exists(dest_full) or os.path.islink(dest_full):
+ os.unlink(dest_full)
+
+ # Copy the actual file
+ if os.path.exists(src_full):
+ shutil.copy2(src_full, dest_full)
+ print(f"Copied {src_path} to {dest_name} in sdist")
+ else:
+ print(f"Warning: Could not find {src_full}")
Review Comment:
Good point
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]