Skip to content

Commit 8591248

Browse files
authored
Merge branch 'master' into rocm2
2 parents c66b8f3 + 18c11f8 commit 8591248

File tree

10 files changed

+196
-116
lines changed

10 files changed

+196
-116
lines changed

.ci/check-python-dists.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
PY_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
2727
if [ "$PY_MINOR_VER" -gt 7 ]; then
2828
echo "pydistcheck..."
29-
pip install 'pydistcheck>=0.7.0'
29+
pip install 'pydistcheck>=0.9.1'
3030
if { test "${TASK}" = "cuda" || test "${METHOD}" = "wheel"; }; then
3131
pydistcheck \
3232
--inspect \

.ci/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if [[ $OS_NAME == "macos" ]]; then
2222
if [[ $COMPILER == "clang" ]]; then
2323
brew install libomp
2424
else # gcc
25-
brew install 'gcc@12'
25+
brew install 'gcc@14'
2626
fi
2727
if [[ $TASK == "mpi" ]]; then
2828
brew install open-mpi

.ci/test-windows.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Remove-Item $env:TMPDIR -Force -Recurse -ErrorAction Ignore
1818

1919
if ($env:TASK -eq "r-package") {
2020
& .\.ci\test-r-package-windows.ps1 ; Assert-Output $?
21-
Exit 0
21+
exit 0
2222
}
2323

2424
if ($env:TASK -eq "cpp-tests") {
2525
cmake -B build -S . -DBUILD_CPP_TEST=ON -DUSE_DEBUG=ON -A x64
2626
cmake --build build --target testlightgbm --config Debug ; Assert-Output $?
2727
.\Debug\testlightgbm.exe ; Assert-Output $?
28-
Exit 0
28+
exit 0
2929
}
3030

3131
if ($env:TASK -eq "swig") {
@@ -59,7 +59,7 @@ if ($env:TASK -eq "swig") {
5959
if ($env:AZURE -eq "true") {
6060
cp ./build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar ; Assert-Output $?
6161
}
62-
Exit 0
62+
exit 0
6363
}
6464

6565
# setup for Python

.ci/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ ARCH=$(uname -m)
1414
LGB_VER=$(head -n 1 "${BUILD_DIRECTORY}/VERSION.txt")
1515

1616
if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "gcc" ]]; then
17-
export CXX=g++-12
18-
export CC=gcc-12
17+
export CXX=g++-14
18+
export CC=gcc-14
1919
elif [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "clang" ]]; then
2020
export CXX=clang++
2121
export CC=clang

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
args: ["--strict"]
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
2626
# Ruff version.
27-
rev: v0.9.5
27+
rev: v0.9.10
2828
hooks:
2929
# Run the linter.
3030
- id: ruff
@@ -39,13 +39,13 @@ repos:
3939
hooks:
4040
- id: shellcheck
4141
- repo: https://github.com/crate-ci/typos
42-
rev: v1.29.5
42+
rev: v1.30.2
4343
hooks:
4444
- id: typos
4545
args: ["--force-exclude"]
4646
exclude: (\.gitignore$)|(^\.editorconfig$)
4747
- repo: https://github.com/henryiii/validate-pyproject-schema-store
48-
rev: 2025.02.03
48+
rev: 2025.03.10
4949
hooks:
5050
- id: validate-pyproject
5151
files: python-package/pyproject.toml$

build-python.sh

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
# Use precompiled library.
5656
# Only used with 'install' command.
5757
# --time-costs
58-
# Output time costs for different internal routines.
58+
# Compile version that outputs time costs for different internal routines.
5959
# --user
6060
# Install into user-specific instead of global site-packages directory.
6161
# Only used with 'install' command.
6262

6363
set -e -u
6464

65-
echo "building lightgbm"
65+
echo "[INFO] building lightgbm"
6666

6767
# Default values of arguments
6868
INSTALL="false"
@@ -136,9 +136,8 @@ while [ $# -gt 0 ]; do
136136
# flags #
137137
#########
138138
--bit32)
139-
export CMAKE_GENERATOR="Visual Studio 17 2022"
140-
export CMAKE_GENERATOR_PLATFORM="Win32"
141-
echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with generator '${CMAKE_GENERATOR}'."
139+
echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with Visual Studio."
140+
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.args=-AWin32"
142141
;;
143142
--cuda)
144143
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON"
@@ -150,9 +149,9 @@ while [ $# -gt 0 ]; do
150149
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON"
151150
;;
152151
--mingw)
153-
export CMAKE_GENERATOR='MinGW Makefiles'
154152
# ref: https://stackoverflow.com/a/45104058/3986677
155153
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND"
154+
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.args=-G'MinGW Makefiles'"
156155
;;
157156
--mpi)
158157
BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON"
@@ -174,7 +173,7 @@ while [ $# -gt 0 ]; do
174173
PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --user"
175174
;;
176175
*)
177-
echo "invalid argument '${1}'"
176+
echo "[ERROR] invalid argument '${1}'. Aborting"
178177
exit 1
179178
;;
180179
esac
@@ -315,18 +314,28 @@ if test "${INSTALL}" = true; then
315314
echo "" >> ./MANIFEST.in
316315
mkdir -p ./lightgbm/lib
317316
if test -f ../lib_lightgbm.so; then
318-
echo "found pre-compiled lib_lightgbm.so"
317+
echo "[INFO] found pre-compiled lib_lightgbm.so"
319318
cp ../lib_lightgbm.so ./lightgbm/lib/lib_lightgbm.so
320319
elif test -f ../lib_lightgbm.dylib; then
321-
echo "found pre-compiled lib_lightgbm.dylib"
320+
echo "[INFO] found pre-compiled lib_lightgbm.dylib"
322321
cp ../lib_lightgbm.dylib ./lightgbm/lib/lib_lightgbm.dylib
322+
elif test -f ../lib_lightgbm.dll; then
323+
echo "[INFO] found pre-compiled lib_lightgbm.dll"
324+
cp ../lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll
323325
elif test -f ../Release/lib_lightgbm.dll; then
324-
echo "found pre-compiled Release/lib_lightgbm.dll"
326+
echo "[INFO] found pre-compiled Release/lib_lightgbm.dll"
325327
cp ../Release/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll
326328
elif test -f ../windows/x64/DLL/lib_lightgbm.dll; then
327-
echo "found pre-compiled windows/x64/DLL/lib_lightgbm.dll"
329+
echo "[INFO] found pre-compiled windows/x64/DLL/lib_lightgbm.dll"
328330
cp ../windows/x64/DLL/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll
329331
cp ../windows/x64/DLL/lib_lightgbm.lib ./lightgbm/lib/lib_lightgbm.lib
332+
elif test -f ../windows/x64/Debug_DLL/lib_lightgbm.dll; then
333+
echo "[INFO] found pre-compiled windows/x64/Debug_DLL/lib_lightgbm.dll"
334+
cp ../windows/x64/Debug_DLL/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll
335+
cp ../windows/x64/Debug_DLL/lib_lightgbm.lib ./lightgbm/lib/lib_lightgbm.lib
336+
else
337+
echo "[ERROR] cannot find pre-compiled library. Aborting"
338+
exit 1
330339
fi
331340
rm -f ./*.bak
332341
else
@@ -336,29 +345,27 @@ if test "${INSTALL}" = true; then
336345
fi
337346

338347
if test "${BUILD_SDIST}" = true; then
339-
echo "--- building sdist ---"
348+
echo "[INFO] --- building sdist ---"
340349
rm -f ../dist/*.tar.gz
341-
# shellcheck disable=SC2086
342-
python -m build \
343-
--sdist \
344-
--outdir ../dist \
345-
${BUILD_ARGS} \
346-
.
350+
# use xargs to work with args that contain whitespaces
351+
# note that empty echo string leads to that xargs doesn't run the command
352+
# in some implementations of xargs
353+
# ref: https://stackoverflow.com/a/8296746
354+
echo "--sdist --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build
347355
fi
348356

349357
if test "${BUILD_WHEEL}" = true; then
350-
echo "--- building wheel ---"
358+
echo "[INFO] --- building wheel ---"
351359
rm -f ../dist/*.whl || true
352-
# shellcheck disable=SC2086
353-
python -m build \
354-
--wheel \
355-
--outdir ../dist \
356-
${BUILD_ARGS} \
357-
.
360+
# use xargs to work with args that contain whitespaces
361+
# note that empty echo string leads to that xargs doesn't run the command
362+
# in some implementations of xargs
363+
# ref: https://stackoverflow.com/a/8296746
364+
echo "--wheel --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build
358365
fi
359366

360367
if test "${INSTALL}" = true; then
361-
echo "--- installing lightgbm ---"
368+
echo "[INFO] --- installing lightgbm ---"
362369
cd ../dist
363370
if test "${BUILD_WHEEL}" = true; then
364371
PACKAGE_NAME="$(echo lightgbm*.whl)"
@@ -377,5 +384,5 @@ if test "${INSTALL}" = true; then
377384
cd ../
378385
fi
379386

380-
echo "cleaning up"
387+
echo "[INFO] cleaning up"
381388
rm -rf ./lightgbm-python

0 commit comments

Comments
 (0)