Skip to content

Commit

Permalink
dev-python/lightgbm: new package, add 4.5.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
  • Loading branch information
littlewu2508 committed Dec 13, 2024
1 parent cba66fe commit 710b668
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-python/lightgbm/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST lightgbm-4.5.0.tar.gz 1701072 BLAKE2B 1323d27ad7f34b43699c7d6605d34a6cbca4c85ace1ffdecfd3d169132c6bf97ae23b48634957af093d235f37c85d7ad157a16d93b15eab4ad5bae38ac938aff SHA512 66cf32bd9dc9cd74629052e59b6fe8e404c264a9ef529d40b073685c5ded9a1deb028e78b7ccff48cfe78f29fcc9746ec957a38b14d86c7fa89fd3ed88fbf6ac
14 changes: 14 additions & 0 deletions dev-python/lightgbm/files/lightgbm-4.5.0-loadlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Index: lightgbm-4.5.0/lightgbm/basic.py
===================================================================
--- lightgbm-4.5.0.orig/lightgbm/basic.py
+++ lightgbm-4.5.0/lightgbm/basic.py
@@ -261,8 +261,7 @@ def _log_callback(msg: bytes) -> None:

def _load_lib() -> ctypes.CDLL:
"""Load LightGBM library."""
- lib_path = find_lib_path()
- lib = ctypes.cdll.LoadLibrary(lib_path[0])
+ lib = ctypes.cdll.LoadLibrary("lib_lightgbm.so")
lib.LGBM_GetLastError.restype = ctypes.c_char_p
callback = ctypes.CFUNCTYPE(None, ctypes.c_char_p)
lib.callback = callback(_log_callback) # type: ignore[attr-defined]
30 changes: 30 additions & 0 deletions dev-python/lightgbm/lightgbm-4.5.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
DISTUTILS_USE_PEP517=scikit-build-core

inherit distutils-r1 pypi

DESCRIPTION="LightGBM Python Package"
HOMEPAGE="https://github.com/microsoft/LightGBM"
SRC_URI="$(pypi_sdist_url "${PN^}" "${PV}")"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="dev-python/wheel[${PYTHON_USEDEP}]
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/scipy[${PYTHON_USEDEP}]
dev-python/scikit-learn[${PYTHON_USEDEP}]
sci-libs/lightgbm"
distutils_enable_tests pytest

PATCHES=( "${FILESDIR}/${PN}-4.5.0-loadlib.patch" )

python_compile() {
SKBUILD_WHEEL_CMAKE=false distutils-r1_python_compile
}
11 changes: 11 additions & 0 deletions dev-python/lightgbm/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
<pkgmetadata>
<maintainer type="person">
<email>heroxbd@gentoo.org</email>
</maintainer>
<upstream>
<remote-id type="github">microsoft/LightGBM</remote-id>
<remote-id type="pypi">Lightgbm</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit 710b668

Please sign in to comment.