Skip to content

Commit c807124

Browse files
authored
sdist: remove .egg-info and setup.cfg from sdist (#2734)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change Follow up to #2601 clean up .egg-info/ and setup.cfg from sdist ## Are these changes tested? Yes Check the new sdist ``` rm -rf dist build pyiceberg.egg-info uv build --sdist tar -tzf dist/pyiceberg-*.tar.gz | grep -E "(build/|setup.cfg|\.egg-info)" ``` Diffed too ``` diff -qr ./dist/pyiceberg-0.10.0 ~/Downloads/nightly/sdist/ | sort differ Files ./dist/pyiceberg-0.10.0/Makefile and /Users/kevinliu/Downloads/nightly/sdist/Makefile differ Files ./dist/pyiceberg-0.10.0/PKG-INFO and /Users/kevinliu/Downloads/nightly/sdist/PKG-INFO differ Files ./dist/pyiceberg-0.10.0/dev/.rat-excludes and /Users/kevinliu/Downloads/nightly/sdist/dev/.rat-excludes differ Files ./dist/pyiceberg-0.10.0/pyproject.toml and /Users/kevinliu/Downloads/nightly/sdist/pyproject.toml differ new Only in ./dist/pyiceberg-0.10.0/tests: .DS_Store Only in ./dist/pyiceberg-0.10.0: MANIFEST.in Only in ./dist/pyiceberg-0.10.0: setup.py removed Only in /Users/kevinliu/Downloads/nightly/sdist: build-module.py Only in /Users/kevinliu/Downloads/nightly/sdist: poetry.lock ``` In sdist, ran RAT check and tests ``` make check-license make test-coverage ``` ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. --> No
1 parent 1220295 commit c807124

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

dev/.rat-excludes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ build
55
.gitignore
66
uv.lock
77
mkdocs/*
8-
setup.cfg
9-
(^|.*/)[^/]*\.egg-info(/.*)?$

setup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@
1818
import os
1919

2020
from setuptools import Extension, find_packages, setup
21+
from setuptools.command.sdist import sdist as _sdist
22+
23+
24+
class sdist(_sdist):
25+
"""Custom sdist that excludes .egg-info and setup.cfg."""
26+
27+
def make_release_tree(self, base_dir: str, files: list[str]) -> None:
28+
# Filter egg-info from the file manifest
29+
files = [f for f in files if ".egg-info" not in f]
30+
31+
super().make_release_tree(base_dir, files)
32+
33+
# Remove setup.cfg after setuptools creates it
34+
setup_cfg = os.path.join(base_dir, "setup.cfg")
35+
if os.path.exists(setup_cfg):
36+
os.remove(setup_cfg)
37+
2138

2239
allowed_to_fail = os.environ.get("CIBUILDWHEEL", "0") != "1"
2340

@@ -69,4 +86,5 @@
6986
},
7087
include_package_data=True,
7188
ext_modules=ext_modules,
89+
cmdclass={"sdist": sdist},
7290
)

0 commit comments

Comments
 (0)