Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions modules/boost.python/1.83.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module(
name = "boost.python",
version = "1.83.0",
bazel_compatibility = [">=7.6.0"],
compatibility_level = 0,
)

bazel_dep(name = "boost", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.align", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.bind", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.config", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.conversion", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.core", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.detail", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.foreach", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.function", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.graph", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.integer", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.iterator", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.lexical_cast", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.mpl", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.numeric_conversion", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.preprocessor", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.property_map", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.smart_ptr", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.static_assert", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.tuple", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.type_traits", version = "1.83.0.bcr.4")
bazel_dep(name = "boost.utility", version = "1.83.0.bcr.4")
bazel_dep(name = "rules_python", version = "1.8.3")
bazel_dep(name = "rules_cc", version = "0.2.16")

PYTHON_VERSIONS = [
"3.10",
"3.11",
"3.12",
]

DEFAULT_PYTHON_VERSION = PYTHON_VERSIONS[0]

python = use_extension("@rules_python//python/extensions:python.bzl", "python")

[
python.toolchain(python_version = python_version)
for python_version in PYTHON_VERSIONS
]

python.defaults(python_version = DEFAULT_PYTHON_VERSION)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

[
pip.parse(
hub_name = "boost.python_pip",
python_version = python_version,
requirements_lock = "//:requirements_lock.txt",
)
for python_version in PYTHON_VERSIONS
]

use_repo(pip, "boost.python_pip")
57 changes: 57 additions & 0 deletions modules/boost.python/1.83.0/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_python//python:pip.bzl", "whl_filegroup")

whl_filegroup(
name = "numpy_headers",
pattern = "numpy/_core/include/numpy",
whl = "@boost.python_pip//numpy:whl",
)

cc_library(
name = "boost.python",
srcs = glob([
"src/**/*.cpp",
]),
hdrs = glob([
"include/**/*.hpp",
]) + [
":numpy_headers",
],
defines = [
"BOOST_NUMPY_NO_LIB",
"BOOST_PYTHON_NO_LIB",
],
includes = [
"include",
"numpy_headers/numpy/_core/include",
],
local_defines = [
"BOOST_PYTHON_STATIC_LIB",
"BOOST_NUMPY_STATIC_LIB",
],
visibility = ["//visibility:public"],
deps = [
"@boost.align",
"@boost.bind",
"@boost.config",
"@boost.conversion",
"@boost.core",
"@boost.detail",
"@boost.foreach",
"@boost.function",
"@boost.graph",
"@boost.integer",
"@boost.iterator",
"@boost.lexical_cast",
"@boost.mpl",
"@boost.numeric_conversion",
"@boost.preprocessor",
"@boost.property_map",
"@boost.smart_ptr",
"@boost.static_assert",
"@boost.tuple",
"@boost.type_traits",
"@boost.utility",
"@rules_python//python/cc:current_py_cc_headers",
],
)
1 change: 1 addition & 0 deletions modules/boost.python/1.83.0/overlay/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
numpy
4 changes: 4 additions & 0 deletions modules/boost.python/1.83.0/overlay/requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file was autogenerated by uv via the following command:
# uv pip compile modules/boost.python/1.83.0/overlay/requirements.txt --python-version 3.10
numpy==2.2.6
# via -r modules/boost.python/1.83.0/overlay/requirements.txt
12 changes: 12 additions & 0 deletions modules/boost.python/1.83.0/patches/fix_numpy2_compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git src/numpy/dtype.cpp src/numpy/dtype.cpp
--- src/numpy/dtype.cpp
+++ src/numpy/dtype.cpp
@@ -98,7 +98,7 @@
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
}

-int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
+int dtype::get_itemsize() const { return static_cast<int>(PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr())));}

bool equivalent(dtype const & a, dtype const & b) {
// On Windows x64, the behaviour described on
29 changes: 29 additions & 0 deletions modules/boost.python/1.83.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
matrix:
unix_platform:
- debian13
- macos_arm64
- ubuntu2404
- ubuntu2404_arm64
windows_platform:
- windows
bazel: [7.x, 8.x, 9.x, rolling]
tasks:
verify_targets_unix:
name: Verify build targets
platform: ${{ unix_platform }}
bazel: ${{ bazel }}
build_flags:
- '--cxxopt=-std=c++17'
- '--host_cxxopt=-std=c++17'
- '--process_headers_in_dependencies'
build_targets:
- '@boost.python//:boost.python'
verify_targets_windows:
name: Verify build targets
platform: ${{ windows_platform }}
bazel: ${{ bazel }}
build_flags:
- '--cxxopt=/std:c++17'
- '--process_headers_in_dependencies'
build_targets:
- '@boost.python//:boost.python'
14 changes: 14 additions & 0 deletions modules/boost.python/1.83.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"url": "https://github.com/boostorg/python/archive/refs/tags/boost-1.83.0.tar.gz",
"integrity": "sha256-ZwLOzZdZsVXnb8GZmPtukHwRVRX4Lq6AcEuaNSEJnj8=",
"strip_prefix": "python-boost-1.83.0",
"patch_strip": 0,
"overlay": {
"BUILD.bazel": "sha256-KbGk4bLfT9H8ueOW9OhtphJS608IwHr111vTgx1PXZ8=",
"requirements.txt": "sha256-4J9lbBMLnAiyxatxh8iRKV5Entd/6+oqbO7pzJjMsPw=",
"requirements_lock.txt": "sha256-0NGe7dsf9YOR5h/JBzLa6c3/+I4i80L+700jKkIHRyc="
},
"patches": {
"fix_numpy2_compat.patch": "sha256-AfcoirOAynDWBvLcwlo0McQguXPT0bw/XhDwWYd0DGI="
}
}
1 change: 1 addition & 0 deletions modules/boost.python/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"github:boostorg/python"
],
"versions": [
"1.83.0",
"1.89.0.bcr.2",
"1.90.0.bcr.1"
],
Expand Down
Loading