diff --git a/python-package/packager/nativelib.py b/python-package/packager/nativelib.py index 3d714eca5abf..c279314da277 100644 --- a/python-package/packager/nativelib.py +++ b/python-package/packager/nativelib.py @@ -16,7 +16,7 @@ def _lib_name() -> str: """Return platform dependent shared object name.""" - if system() in ["Linux", "OS400"] or system().upper().endswith("BSD"): + if system() in ["Linux", "Android", "OS400"] or system().upper().endswith("BSD"): name = "libxgboost.so" elif system() == "Darwin": name = "libxgboost.dylib" diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index e4cc1bca28a0..0a242f22955e 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -49,6 +49,10 @@ pyspark = ["pyspark", "scikit-learn", "cloudpickle"] [tool.hatch.build.targets.wheel.hooks.custom] +[tool.cibuildwheel.android.environment] +# Required for pthread_getname_np +ANDROID_API_LEVEL = "26" + [tool.isort] profile = "black" diff --git a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py index 097c76830ac0..3a18b69c69ee 100644 --- a/python-package/xgboost/libpath.py +++ b/python-package/xgboost/libpath.py @@ -49,7 +49,7 @@ def find_lib_path() -> List[str]: ] ) dll_path = [os.path.join(p, "xgboost.dll") for p in dll_path] - elif sys.platform.startswith(("linux", "freebsd", "emscripten")): + elif sys.platform.startswith(("linux", "android", "freebsd", "emscripten")): dll_path = [os.path.join(p, "libxgboost.so") for p in dll_path] elif sys.platform == "darwin": dll_path = [os.path.join(p, "libxgboost.dylib") for p in dll_path] diff --git a/python-package/xgboost/testing/__init__.py b/python-package/xgboost/testing/__init__.py index a68a20e0823b..9c1cfd98e659 100644 --- a/python-package/xgboost/testing/__init__.py +++ b/python-package/xgboost/testing/__init__.py @@ -64,7 +64,7 @@ def has_ipv6() -> bool: """Check whether IPv6 is enabled on this host.""" # connection error in macos, still need some fixes. - if system() not in ("Linux", "Windows"): + if system() not in ("Linux", "Android", "Windows"): return False if socket.has_ipv6: