Skip to content

Commit 308382c

Browse files
committed
[ci] [python-package] support setuptools<61 in build-python.sh (fixes #6665)
1 parent bbeecc0 commit 308382c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build-python.sh

+15-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,21 @@ if test "${INSTALL}" = true; then
312312
echo 'requires = ["setuptools"]' >> ./pyproject.toml
313313
echo 'build-backend = "setuptools.build_meta"' >> ./pyproject.toml
314314
echo "" >> ./pyproject.toml
315-
echo "recursive-include lightgbm *.dll *.dylib *.so" > ./MANIFEST.in
315+
echo "recursive-include lightgbm VERSION.txt py.typed *.py *.so" > ./MANIFEST.in
316316
echo "" >> ./MANIFEST.in
317+
# create a setup.cfg for systems with setuptools<61 (e.g Ubuntu 22.04 python3-pip)
318+
# ref: https://github.com/microsoft/LightGBM/issues/6665#issuecomment-2412748042
319+
echo '[metadata]' > ./setup.cfg
320+
echo 'name = lightgbm' >> ./setup.cfg
321+
echo "version = $(head -1 ../VERSION.txt)" >> ./setup.cfg
322+
echo 'description = lightgbm' >> ./setup.cfg
323+
echo "" >> ./setup.cfg
324+
echo '[options]' >> ./setup.cfg
325+
echo 'packages = lightgbm' >> ./setup.cfg
326+
echo 'include_package_data = True' >> ./setup.cfg
327+
echo "" >> ./setup.cfg
328+
echo '[options.packages.find]' >> ./setup.cfg
329+
echo 'where = lightgbm' >> ./setup.cfg
317330
mkdir -p ./lightgbm/lib
318331
if test -f ../lib_lightgbm.so; then
319332
echo "found pre-compiled lib_lightgbm.so"
@@ -376,4 +389,4 @@ if test "${INSTALL}" = true; then
376389
fi
377390

378391
echo "cleaning up"
379-
rm -rf ./lightgbm-python
392+
#rm -rf ./lightgbm-python

0 commit comments

Comments
 (0)